Short answer: The official Binance API documentation is on developers.binance.com, and the Spot documents are also kept in the binance-spot-api-docs repository on GitHub. Spot REST runs under /api/v3, while USD-M futures, COIN-M futures, options and portfolio margin each have their own host. As read on 6 November 2026, official pages disagree on several test hosts, so check that a host answers before you build on it.
The documentation spans two sites, more than 20 product sections and several test environments, and some pages contradict each other. Pages were read and public endpoints called on 6 November 2026 (Istanbul time); no real API key was used, so signed requests succeeded only against a local mock.
This is a technical guide, not a recommendation to use Binance or any strategy, and automated trading can lose money. Availability depends on your jurisdiction and the platform's terms. For readers in Turkey, Article 99/A of Capital Markets Law No. 6362 treats activity by foreign crypto-asset platforms directed at Turkish residents as unauthorized.
Where is the official Binance API documentation?
Use developers.binance.com for every product and the GitHub repository for Spot, whose README says anything its documents do not describe is unsupported.
- Developer site: Documentation, API Reference, and SDKs & Tools. Every page opened showed "Last modified on October 30, 2026", so the changelogs, not that stamp, date a change.
- GitHub:
binance/binance-spot-api-docsholds the Spot REST, WebSocket, user data, FIX and SBE documents, the error, filter and enum lists, andCHANGELOG.md, last updated 30 October 2026. - Changelogs: Spot keeps its own; futures, options and portfolio margin share one, latest entry 23 October 2026.
- Old copies: search also shows forks of the former
binance-official-api-docs, one last changed on 16 June 2020. - Markdown copies:
developers.binance.com/en/docs/llms.txtlists a.mdcopy of each page; plain HTTP clients got those, but only an empty HTTP 202 challenge from the HTML pages.
Binance API endpoint map: base URLs and testnets
Each product family has its own host and path prefix, and the test environment differs by product.
| Product | Production | Test | Answered |
|---|---|---|---|
Spot REST /api/v3 | api.binance.com, api-gcp, api1 to api4; public data only: data-api.binance.vision | Testnet testnet.binance.vision; Demo Mode demo-api.binance.com | Yes |
| Spot WebSocket API, streams, FIX | ws-api.binance.com, stream.binance.com:9443, fix-oe.binance.com:9000 | Separate testnet and Demo Mode hosts | Yes; FIX not tried |
USD-M /fapi | fapi.binance.com; streams fstream.binance.com/public, /market, /private | demo-fapi.binance.com or testnet.binancefuture.com | Yes, both |
COIN-M /dapi | dapi.binance.com; streams dstream.binance.com | demo-dapi.binance.com | Yes |
Options /eapi | eapi.binance.com | demo-fapi.binance.com | Production only |
Portfolio Margin /papi | papi.binance.com | None documented | Yes |
Wallet, Margin, other /sapi | api.binance.com | Not on the Spot Testnet | Not tried |
The Spot Testnet resets about once a month without notice and has its own prices; Demo Mode, available since 29 January 2026, matches the live exchange's features, filters and limits with realistic, not real, prices. Production Spot hosts shared one weight counter; each test environment kept its own. Stream limits are in the Binance WebSocket guide and futures test accounts in Binance Futures testnet API key.
Binance API v3 and the other version numbers
/api/v3 is the Spot REST path, not a separate product, and elsewhere the version varies by endpoint.
- The last Spot
/api/v1endpoints were due to retire on 25 March 2026, yet on 6 November 2026api.binance.comstill answered 9 of the 14;GET /api/v1/timereturned HTTP 404. - USD-M places orders at
/fapi/v1/orderbut serves/fapi/v3/accountand/fapi/v3/balance, and/sapiruns from v1 to v4.
Key types and signing are compared in API signature generation; key setup is in the Binance API key guide.
Binance API GitHub: official connectors and licenses
Most connectors are MIT-licensed; the documentation repository has no open-source license, and some linked repositories are renamed, deprecated or idle.
| Repository | License | Status |
|---|---|---|
binance-spot-api-docs | None; its terms file points to Binance's Terms of Use | Updated 30 October 2026 |
binance-connector-python | MIT | One PyPI package per product, such as binance-sdk-spot 13.4.0; the older binance-connector and binance-futures-connector say they are deprecated |
binance-connector-js, -java, -go, -rust, -ruby | MIT | Updated October or November 2026 |
binance-connector-php | README says MIT; its LICENSE link returned 404 | REST only |
binance-connector-dotnet | MIT | Last updated 18 June 2024 |
binance-public-data | Dataset terms of 26 August 2026: CC BY-NC-SA 4.0; commercial use needs a separate written license | Bulk files at data.binance.vision; see the historical data guide |
Those terms cover data.binance.vision "and associated endpoints" without naming data-api.binance.vision, so read them before any commercial use of either. Official samples sit in each connector's examples folder and the MIT-licensed Postman collections.
Binance API changelog: what moved in 2026
Several 2026 changes removed endpoints and URL forms that older tutorials still show.
| Effective | Change |
|---|---|
| 20 February 2026 | Spot listenKey endpoints removed; account events now use a WebSocket API subscription (user data stream guide) |
| 25 March 2026 | Last Spot /api/v1 endpoints due to retire (most still answer) |
| 2 April 2026 | Successful Spot orders and cancels weigh 0; RAW_REQUESTS limit 300,000 per 5 minutes (rate limits) |
| 23 April 2026 | USD-M stream URLs without /public, /market or /private lose market and user data |
| 8 May 2026 | serverShutdown event on Spot WebSocket API and streams; reconnect on it |
| 26 August 2026 | USD-M userTrades history documented as 3 months, not 6 |
| 16 October 2026 | USD-M and COIN-M income history drop the page parameter |
Error responses are explained in Binance API error codes.
Where official Binance pages disagree
Seven conflicts or errors turned up between official sources, and tests settled most.
| Topic | What the pages say | What a test showed |
|---|---|---|
| Futures test host | USD-M General Info: demo-fapi.binance.com. Its WebSocket API page: testnet.binancefuture.com. The change log's last testnet entry, 24 January 2024: fstream.binancefuture.com; none announces the demo hosts | Both REST hosts answered, sharing one weight counter |
| Options test host | Options General Info: demo-fapi.binance.com | HTTP 403 for /eapi paths there; testnet.binancefuture.com listed 680 option symbols |
| Spot Testnet hosts | Testnet General Info lists api1.testnet.binance.vision | The name did not resolve at Google or Cloudflare DNS |
| Old USD-M stream URLs | Change log, 2 April 2026, and its notice: legacy URLs "no longer available" after 23 April 2026. Connect page: they still carry /public streams | The Connect page held: /ws/btcusdt@markPrice sent 0 events in 8 seconds, /market/ws/btcusdt@markPrice 3, /ws/btcusdt@bookTicker 1,149 |
| Python package | Python connector page: "for example binance-spot" and "Python 3.9 or newer" | PyPI's binance-spot is a third-party 2023 package, not Binance's; binance-sdk-spot requires Python 3.11 to 3.15 |
| Connector list | Spot README: old Node.js and Rust names and the deprecated TypeScript repository. SDK page: binance-connector-js, binance-connector-rust | Old names redirect |
| USD-M signed example | General Info's curl examples call https://fapi/binance.com | That host does not resolve; the base endpoint is fapi.binance.com |
Hypothetical example. A bot still subscribed to /ws/btcusdt@markPrice stays connected but receives no mark prices, so its risk checks run on stale data; alert on missing events, not only on disconnects.
Binance API sample: a public call and a signing test
No live key is needed: the code uses public endpoints, Binance's published signing example and a local mock.
Never paste a live API secret into a chat, AI assistant, online HMAC tool, issue or support ticket. The secret below is the illustrative one from the Spot REST documentation. The code ran on 6 November 2026 with Python 3.11.3 and requests 2.31.0. The Spot Testnet that day returned -2015 (HTTP 401) for a made-up key and -1021 (HTTP 400) when the timestamp was 20 seconds old, so the mock checks the timestamp first; -1022 is assumed, as it needs a real key.
import hashlib, hmac, threading, time
from decimal import Decimal, InvalidOperation
from http.server import BaseHTTPRequestHandler, HTTPServer
from urllib.parse import parse_qsl, urlencode, urlsplit
import requests
def one(items, **want): # several matches is an error
hits = [x for x in items if all(x.get(k) == v for k, v in want.items())]
if len(hits) == 1:
return hits[0]
raise LookupError(f"{want}: {len(hits)} matches")
def num(value): # exact text; never inf, nan or 0.0
try:
d = Decimal(str(value))
except InvalidOperation:
d = Decimal("NaN")
if d.is_finite() and d > 0:
return format(d, "f")
raise ValueError(f"refused {repr(value)}")
def sign(secret, query):
return hmac.new(secret.encode(), query.encode(), hashlib.sha256).hexdigest()
def call(base, path, params=(), key="", secret=None, method="GET", offset_ms=0):
query, headers = urlencode(list(params)), {}
if secret is not None: # signed: check credentials first
if not key or not secret:
raise ValueError("signed call without key or secret")
query += f"{'&' if query else ''}timestamp={int(time.time() * 1000) + offset_ms}"
query += "&signature=" + sign(secret, query)
headers["X-MBX-APIKEY"] = key
r = requests.request(method, f"{base}{path}?{query}", headers=headers, timeout=10)
if r.status_code == 200: # status first; error bodies vary
return r.json(), r.headers.get("X-MBX-USED-WEIGHT-1M")
try:
err = dict(r.json())
except (ValueError, TypeError):
err = {}
raise RuntimeError(r.status_code, err.get("code"), err.get("msg"))
t0 = time.time()
server, _ = call("https://api.binance.com", "/api/v3/time")
offset = server["serverTime"] - round((t0 + time.time()) * 500)
info, used = call("https://api.binance.com", "/api/v3/exchangeInfo", [("symbol", "BTCUSDT")])
print("offset", offset, "ms |", one(info["symbols"], symbol="BTCUSDT")["status"], "| weight", used)
SECRET = "NhqPtmdSJYdKjVHjA7PZj4Mge3R5YNiP1e3UZjInClVN65XAbvqqM6A7H5fATj0j"
doc = [("symbol", "LTCBTC"), ("side", "BUY"), ("type", "LIMIT"), ("timeInForce", "GTC"),
("quantity", "1"), ("price", "0.1"), ("recvWindow", "5000"), ("timestamp", "1499827319559")]
assert sign(SECRET, urlencode(doc)) == "c8db56825ae71d6d79447849e617115f4a920fa2acdcab2b053c4b2838bd6b71"
print("documented signature reproduced")
class Mock(BaseHTTPRequestHandler):
def do_POST(self):
query = urlsplit(self.path).query
unsigned, _, sig = query.rpartition("&signature=")
f, now = dict(parse_qsl(query)), time.time() * 1000 + offset
ts, window = int(f.get("timestamp", 0)), float(f.get("recvWindow", 5000))
secret = {"mock-key": "mock-secret"}.get(self.headers.get("X-MBX-APIKEY", ""))
if not (ts < now + 1000 and now - ts <= window):
code, err = 400, (-1021, "Timestamp for this request is outside of the recvWindow.")
elif secret is None:
code, err = 401, (-2015, "Invalid API-key, IP, or permissions for action.")
elif not hmac.compare_digest(sign(secret, unsigned), sig.lower()):
code, err = 400, (-1022, "Signature for this request is not valid.")
else:
code, err = 200, None
self.send_response(code)
self.send_header("Content-Type", "application/json")
self.end_headers()
self.wfile.write((f'{{"code":{err[0]},"msg":"{err[1]}"}}' if err else '{"orderId":1}').encode())
def log_message(self, *args):
pass
srv = HTTPServer(("127.0.0.1", 0), Mock)
threading.Thread(target=srv.serve_forever, daemon=True).start()
mock = f"http://127.0.0.1:{srv.server_port}"
order = [("symbol", "BTCUSDT"), ("side", "BUY"), ("type", "MARKET"), ("quantity", num("0.001"))]
for label, key, secret, skew in [("valid", "mock-key", "mock-secret", offset),
("wrong secret", "mock-key", "other", offset),
("unknown key", "nobody", "mock-secret", offset),
("6 s stale", "mock-key", "mock-secret", offset - 6000),
("empty secret", "mock-key", "", offset)]:
try:
print(label, "->", call(mock, "/api/v3/order", order, key, secret, "POST", skew)[0])
except (RuntimeError, ValueError) as err:
print(label, "->", err)
for bad in (float("1e400"), float("1e-400"), "abc"):
try:
num(bad)
except ValueError as err:
print(err)
Output:
offset 1297 ms | TRADING | weight 21
documented signature reproduced
valid -> {'orderId': 1}
wrong secret -> (400, -1022, 'Signature for this request is not valid.')
unknown key -> (401, -2015, 'Invalid API-key, IP, or permissions for action.')
6 s stale -> (400, -1021, 'Timestamp for this request is outside of the recvWindow.')
empty secret -> signed call without key or secret
refused inf
refused 0.0
refused 'abc'
Binance's clock ran about 1.3 seconds ahead of the test machine, inside the default recvWindow of 5,000 milliseconds (maximum 60,000). A timestamp 1 second or more ahead of the server is rejected, so measure the offset instead of widening the window. Weight 21 is 1 for the time call plus 20 for exchangeInfo. For integration work in general, see exchange API integration; naming Binance here does not mean Fincode integrates it or has built on it.
Frequently asked questions
Where is the official Binance API documentation?
On developers.binance.com, and for Spot also in the binance-spot-api-docs repository on GitHub.
What is the Binance API v3?
It is the /api/v3 path of the Spot REST API. The /api/v1 endpoints were due to retire on 25 March 2026, yet most still answered on 6 November 2026; futures endpoints use v1, v2 or v3 per endpoint.
Where is the Binance futures API documentation?
USD-M (/fapi) and COIN-M (/dapi) futures each have a General Info page on developers.binance.com and share one change log with options (/eapi) and portfolio margin (/papi).
Is there an official Binance Python library?
Yes. The MIT-licensed binance-connector-python repository publishes one PyPI package per product, such as binance-sdk-spot 13.4.0 (29 October 2026) for Python 3.11 to 3.15.
Sources
- Binance Spot API documentation on GitHub: README (document list, connectors, testnet scope) (opens in a new tab)
- Binance Spot API CHANGELOG (last updated 30 October 2026) (opens in a new tab)
- Binance Spot REST API: base endpoints, timing security and signed request examples (opens in a new tab)
- Binance Spot Testnet: General Info (last modified 30 October 2026) (opens in a new tab)
- Binance Spot Demo Mode: General Info (hosts, comparison with the testnet) (opens in a new tab)
- Binance USD-M Futures: General Info (last modified 30 October 2026) (opens in a new tab)
- Binance USD-M Futures: WebSocket API General Info (last modified 30 October 2026) (opens in a new tab)
- Binance USD-M Futures: WebSocket market streams, Connect (routed paths) (opens in a new tab)
- Binance Options: General Info (last modified 30 October 2026) (opens in a new tab)
- Binance Derivatives: Change log (latest entry 23 October 2026) (opens in a new tab)
- Binance Developer Docs: SDKs and Tools (official connectors) (opens in a new tab)
- Binance Developer Docs: Python connector (last modified 30 October 2026) (opens in a new tab)
- PyPI: binance-sdk-spot 13.4.0 (uploaded 29 October 2026) (opens in a new tab)
- Binance Vision Dataset Terms (last updated 26 August 2026) (opens in a new tab)
- Capital Markets Law No. 6362, Article 99/A (Turkish, consolidated text) (opens in a new tab)
This guide is general information about software and markets, not investment, legal or tax advice. Automated trading can lose money, past or backtested performance does not guarantee future results, and the rules that apply depend on your jurisdiction and your exchange's terms. Sources, checks and corrections: see the editorial policy.