Skip to main content

Rate limits

Limits are counted per key, in two separate buckets:

BucketDefaultEndpoints
read60 requests / minuteall GET
trade20 requests / minuteall POST
  • Windows are fixed calendar minutes; they reset at second :00 of each minute.
  • Every request that reaches the rate-limit check counts, including ones that then fail validation or get 429.
  • Admins can change the limits without notice. Read the current values from rate_limits in the GET /key/ response.

Headers​

Requests rejected before the rate-limit check (all 401s, and the 403s ip_not_allowed, api_disabled, api_blocked, kyc_required and insufficient_scope) are not counted and carry no rate-limit headers. See the check order. Every other response carries:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 57
X-RateLimit-Reset: 1762510560
HeaderMeaning
X-RateLimit-LimitRequests per minute allowed in this endpoint's bucket
X-RateLimit-RemainingRequests left in the current window
X-RateLimit-ResetUnix time (seconds) when the window resets (the start of the next minute)

429 responses​

When you exceed the limit you get 429 with code throttled and a Retry-After header:

HTTP/1.1 429 Too Many Requests
Retry-After: 12
Content-Type: application/json

{"type": "client_error", "errors": [{"code": "throttled", "detail": "...", "attr": null}]}

Back off for at least Retry-After seconds before trying again. Hammering after a 429 only makes the wait longer.

Which requests are safe to retry?​

RequestRetry
All GETsAlways safe
POST /quotes/Safe; a duplicate quote is harmless
POST /orders/ and POST /limit-orders/Only with a client_id. See safe retries
POST /limit-orders/{order_id}/cancel/Safe; if it was already cancelled you get order_not_cancellable

Retry 502, 503 (e.g. price_unavailable) and 504 with the same backoff.

Python example​

rate_limit.py
"""Respect rate limits: read the X-RateLimit-* headers and back off on 429 (and 502/503/504).

Limits are per key: read bucket (all GET) 60/min, trade bucket (all POST) 20/min by default.
GET /key/ reports the current values.
"""
import os
import random
import time

import requests

BASE = os.environ.get("TALANO_BASE_URL", "https://service.talano.ir/api/public/v1")

s = requests.Session()
s.headers["X-API-Key"] = os.environ["TALANO_API_KEY"]

RETRYABLE = {429, 502, 503, 504}


def get(path: str, max_retries: int = 4) -> requests.Response:
"""GET with backoff. GETs are always safe to retry."""
for attempt in range(max_retries + 1):
r = s.get(f"{BASE}{path}", timeout=10)
if r.status_code not in RETRYABLE or attempt == max_retries:
return r
retry_after = r.headers.get("Retry-After")
if retry_after is not None:
wait = float(retry_after) # the server tells you exactly how long
else:
wait = min(30, 2 ** attempt) + random.uniform(0, 1) # exponential backoff + jitter
print(f"{r.status_code}, waiting {wait:.1f}s")
time.sleep(wait)
raise RuntimeError("unreachable")


key = get("/key/").json()
print("limits:", key["rate_limits"])

r = get("/balances/")
print("remaining this minute:", r.headers.get("X-RateLimit-Remaining"),
"resets at:", r.headers.get("X-RateLimit-Reset"))
for b in r.json():
print(b["asset"], "available:", b["available"])

Tips​

  • Because windows are fixed, if you use up the limit mid-minute, wait until X-RateLimit-Reset.
  • For prices, read GET /markets/{market_id}/price/ every few seconds instead of in a tight loop. 60 per minute means at most one per second across all GETs for that key.
  • Watch X-RateLimit-Remaining and slow down yourself when it gets close to zero.
  • Use a separate key per application so the limits do not affect each other.