Errors & Troubleshooting
HTTP Status Codes
- 200 — Success
- 400 — Bad request (invalid params)
- 401 — Unauthorized (API key issue)
- 402 — Payment required
- 403 — Forbidden (endpoint not in your plan, or your credit, overage or free-trial cap has been reached; the message says which)
- 404 — Not found
- 429 — Rate limit exceeded
- 500 — Server error
Error responses follow this format:
{ "message": "description" }Common Errors
"Could not verify API Key" (401)API-Key header (not Authorization)"this API-key is not allowed to access this endpoint" (403)"cannot use timeLast and timeGte/timeLte together""limit must be between 1 and 1000"Rate Limit Handling (429)
When a retry can succeed at all, a 429 from a rate limit carries a Retry-After header with the seconds to wait before retrying. Wait that long, and back off exponentially with jitter when the header is absent:
import random
import time
import requests
def request_with_backoff(url, headers, max_retries=5):
for attempt in range(max_retries):
resp = requests.get(url, headers=headers)
if resp.status_code == 429:
retry_after = resp.headers.get("Retry-After")
delay = int(retry_after) if retry_after else min(2 ** attempt, 30)
time.sleep(delay + random.uniform(0, 1))
continue
return resp
return respWebSocket Errors
Errors on the v2 stream (/ws/v2/transfers) arrive in-band as an error frame. The connection stays open; only the offending frame is rejected.
{
"channel": "transfers",
"type": "error",
"subscription_id": "binance-eth",
"code": "count_reset_required",
"message": "count history is unavailable; refresh count baselines from REST and reconnect"
}subscription_id— the subscription the rejected frame addressed; omitted when the frame named nonecode— one of the codes belowmessage— human-readable detailretry_after_ms— present when the server asks you to wait before retrying
Error Codes
protocol_error— Malformed frame, unknown subscription, or an operation that subscription does not supportresource_limit— A connection limit was exceeded, for example too many subscriptions in the initial frame or too many resolved filter terms; the connection is left unconfiguredoutput_limit— Output budget exceeded; retry afterretry_after_msload_busy— A count load for that subscription is already in progresscount_replaying— Count replay is not ready yet; retryload_invalidated— The count load was invalidated by a reorg; request it againcount_reset_required— Count history is unavailable; refresh count baselines from REST and reconnectinternal_error— Transient server failure; retry the request
Credits and WebSockets
Credits are checked when the connection is opened, the same way as a REST call. A key that is out of credits is refused at connection time with a 402 or 403 and a message body; no error frame is sent over the socket. Rows delivered on an open connection are billed per row, see Credit Pricing.