# Rate limits and retries

## Rate limit

Each API key may make 120 requests per minute across all endpoints. Requests
with a missing or invalid key are limited to 30 per minute per IP address.
Over a limit, Chambr returns `429 rate_limited` with a `Retry-After` header in
seconds.

## Timeouts

Give `POST /v1/calls` a client timeout of at least 60 seconds. Finding the
rep's speaker and classifying the call type can take 30 seconds; sending
`transcript.rep_speaker` and `call_type` skips both. After a timeout, retry:
the request is [idempotent](https://developers.staging.chambr.ai/idempotency.md).

## Retry rules

| Response | Do |
|---|---|
| `429 rate_limited` | Wait `Retry-After` seconds, then retry |
| `503 inference_unavailable` | Wait `Retry-After`, or resend with `transcript.rep_speaker` |
| `500 internal_error`, network error, timeout | Retry with exponential backoff, for example 2, 4, 8 and 16 seconds, then alert |
| Any other `4xx` | Do not retry unchanged; fix the request. See [Errors](https://developers.staging.chambr.ai/errors.md) |

## Backfills

Send one or two calls per second rather than all at once. Scoring takes
longer during a large backfill.
