API basics
Early accessRate limits
The Terra API limits requests per key and per organization. Every response tells you where you stand, so you can slow down before you hit the limit.
Headers#
| Header | Meaning |
|---|---|
RateLimit-Limit | The number of requests allowed in the current window |
RateLimit-Remaining | How many requests are left in the current window |
RateLimit-Reset | Seconds until the current window ends |
Limits are counted per API key, per dashboard session, and per client IP on public routes, in fixed windows. Sign-in routes add their own tighter limits.
When you hit the limit#
The API returns 429 with the code RATE_LIMITED, a Retry-After header and retryAfter in the body, both in seconds:
Text
HTTP/1.1 429 Too Many RequestsRetry-After: <seconds> { "error": { "code": "RATE_LIMITED", "message": "...", "requestId": "req_...", "retryAfter": <seconds> } }Wait that long, then retry with exponential backoff and jitter. Retried creates must reuse the same Idempotency-Key (see Idempotency).
Public checkout routes#
The public routes that hosted checkout uses (/v1/checkout/...) have strict per-IP limits and Turnstile checks. Do not call them from your server: use the authenticated routes with your secret key.
Edge protection#
On top of the API's own limits, Cloudflare's edge applies WAF and rate-limit rules to /api/v1. A burst that looks like abuse may be stopped at the edge before it reaches the API.
Good habits#
- Read
RateLimit-Remainingand slow down as it approaches zero. - Batch your own work: create payment intents when a customer checks out, not ahead of time.
- Use webhooks instead of polling for payment status.
- Give background jobs their own key with only the scopes they need, so you can watch and revoke them separately. Remember that the organization-wide limit still covers every key.