Skip to content

Search the docs

Jump to any page or section

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/status isn’t limited at all.
  • A full bucket takes 60 seconds to refill from empty.

Headers

Every response to an authenticated request includes:

Rate limit headers
HeaderMeaning
X-RateLimit-LimitThe bucket size, 120.
X-RateLimit-RemainingWhole requests left right now, after this one.
X-RateLimit-ResetSeconds 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: 2

When 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)
}

Staying under the limit

  • Batch status checks. v2 status, refill, refill_status and cancel take up to 100 IDs per call; v3 GET /orders takes ids or status=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.