# Rate limits Every developer app is rate-limited by tier. The limits below apply per app, per environment, measured against a rolling 60-second window. ## Tiers | Tier | Requests per minute | |------|---------------------| | **Sandbox** | 60 | | **Starter** | 300 | | **Growth** | 1,000 | | **Enterprise** | 5,000 | - **Sandbox apps** are always on the sandbox tier — the 60/min limit is a nudge to keep integration tests polite, not a commercial ceiling. Move to a production tier when you go live. - **Starter / Growth / Enterprise** are production tiers, assigned when the app is provisioned. Upgrading tiers is a portal action; contact your Gallantree account manager for the current tier availability. ## Response headers Every response carries three headers so you can throttle client-side: | Header | Meaning | |--------|---------| | `x-ratelimit-limit` | The tier limit (constant per app) | | `x-ratelimit-remaining` | Requests you can still make in the current window | | `x-ratelimit-reset` | Unix timestamp (seconds since epoch, UTC) when the window resets | Watch `x-ratelimit-remaining` in your client — if it hits `0`, the next request will return `429` regardless of urgency. ## When you're throttled ```http HTTP/1.1 429 Too Many Requests Retry-After: 27 x-ratelimit-limit: 300 x-ratelimit-remaining: 0 x-ratelimit-reset: 1755267600 { "message": "Too many requests. Please try again later." } ``` - **`Retry-After`** is seconds until the next request will succeed. Respect it — retrying earlier just wastes cycles and does not reset the window. - **Exponential back-off** on top of `Retry-After` is polite behaviour when the server is under load; consider a jittered `Retry-After × 1.5` on the first retry. ## Sizing your integration If you're pulling data on a schedule, plan the polling cadence against your tier — a sync that lists every loan every minute at page-size 25 uses **N/25 requests per run**, so a 1,000-loan lender fits comfortably on Starter (40 requests, well under 300/min) but a 30,000-loan lender needs Growth or webhooks (see [Subscribe to events](webhooks/subscribe.md)). Webhooks are almost always a better answer than polling — they don't count against your API rate limit, and they arrive within seconds of the underlying change. ## Runnable example — client-side back-off ```bash call() { response=$(curl -sS -w "\n%{http_code}" -D headers.tmp \ "https://developers.gallantreecapital.com/api/v1/loans" \ -H "x-api-key: $GALLANTREE_API_KEY") status=$(echo "$response" | tail -n1) body=$(echo "$response" | head -n -1) if [ "$status" = "429" ]; then wait=$(grep -i "^retry-after:" headers.tmp | awk '{print $2}' | tr -d '\r') echo "429 — sleeping ${wait}s" sleep "$wait" call else echo "$body" fi } call ```