Reference
Rate limits
Each key gets a token bucket: bursts of 120 requests, refilled at 2 per second.
The limit
Each API key has a bucket of 120 requests. Every request takes one; the bucket refills at 2 per second, up to 120. So you can burst 120 requests at once, and sustain 2 per second (120 a minute) indefinitely.
- The bucket is per key and shared by v2 and v3. Two keys on one account have two buckets.
- Every authenticated request counts, including ones that fail validation.
- Requests with an invalid key are refused before the limit is checked, and
GET /api/v3/statusisn’t limited at all. - A full bucket takes 60 seconds to refill from empty.
Headers
Every response to an authenticated request includes:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | The bucket size, 120. |
X-RateLimit-Remaining | Whole requests left right now, after this one. |
X-RateLimit-Reset | Seconds until the bucket is completely full again. A duration, not a Unix timestamp. |
A response with headroom
HTTP/1.1 200 OK
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 117
X-RateLimit-Reset: 2When you hit the limit
The request isn’t processed. Both APIs answer HTTP 429 with a Retry-After header in seconds — the only time v2 doesn’t answer 200.
v3429Too Many Requests
{
"error": {
"code": "rate_limited",
"message": "Too many requests. Retry after 3s.",
"details": {
"retry_after": 3
},
"doc_url": "/docs/errors#rate_limited",
"request_id": "req_f8xrrISYryqXQcXJ3x"
}
}v2429Too Many Requests
{
"error": "Too many requests"
}Wait for Retry-After, then retry. A simple wrapper:
async function call(url, init, attempt = 0) {
const res = await fetch(url, init)
if (res.status !== 429 || attempt >= 5) return res
const wait = Number(res.headers.get("Retry-After") ?? 1)
await new Promise((r) => setTimeout(r, wait * 1000))
return call(url, init, attempt + 1)
}<?php
function call(string $url, array $fields, int $attempt = 0): array
{
$ch = curl_init($url);
$retryAfter = 1;
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => http_build_query($fields),
CURLOPT_HEADERFUNCTION => function ($ch, $line) use (&$retryAfter) {
if (stripos($line, 'Retry-After:') === 0) $retryAfter = (int) trim(substr($line, 12));
return strlen($line);
},
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status === 429 && $attempt < 5) {
sleep(max(1, $retryAfter));
return call($url, $fields, $attempt + 1);
}
return json_decode($body, true);
}import time
import requests
def call(method, url, attempt=0, **kwargs):
res = requests.request(method, url, timeout=30, **kwargs)
if res.status_code != 429 or attempt >= 5:
return res
time.sleep(int(res.headers.get("Retry-After", "1")))
return call(method, url, attempt + 1, **kwargs)Staying under the limit
- Batch status checks. v2
status,refill,refill_statusandcanceltake up to 100 IDs per call; v3GET /orderstakesidsorstatus=active. Checking 1,000 orders is ten requests, not a thousand. - Poll only what moves. Completed, Partial and Canceled are final; stop asking about them.
- Cache the service list. It changes rarely; refreshing it every few minutes is plenty.
- Use webhooks instead of polling. They don’t count against your limit. See Webhooks.
Something unclear or out of date? Write to [email protected] and quote the page.