Rate limits
When the Roots API answers 429, and how to retry.
A 429 has two causes: a request budget per client IP address, and a per-resource lock that stops two operations racing on the same account or counterparty.
Request budget
Requests are counted per client IP address: one budget of 600 requests per rolling 60 seconds, shared across all endpoints. A request over it is a 429 with code rate_limited and a Retry-After header giving the seconds to wait.
Per-resource locks
| Request | Locks | 429 when |
|---|---|---|
POST /api/v1/transfers | The source account, plus the destination account or counterparty | Any of them already has a transfer or status change in progress. |
PATCH /api/v1/accounts/{account_id} | The account | A transfer or another status change on that account is in progress. |
PATCH /api/v1/counterparties/{counterparty_id} that changes status | The counterparty | A transfer to that counterparty is in progress. |
A lock lasts only as long as the request that holds it, and never more than 60 seconds. Locks do not queue: the second request is refused at once with Retry-After: 1. Resend it with the same Idempotency-Key and body.
{
"type": "https://docs.roots.finance/docs/errors#rate_limited",
"title": "Too Many Requests",
"status": 429,
"detail": "account acct_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d has a transfer in progress",
"code": "rate_limited",
"instance": "/api/v1/transfers",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736"
}Retry a 429
- Wait the number of seconds in the
Retry-Afterheader. A lock429sendsRetry-After: 1. - Back off exponentially with jitter, and cap the number of attempts.
- Resend with the same
Idempotency-Keyand the identical body. If the first request has committed by then, you get its stored response. See Idempotency. - Serialize your own transfers per source account where you can. Parallel transfers from one account collide on its lock.
Build a well-behaved client
- Bound concurrency per account and per counterparty.
- Use webhooks instead of polling for status changes.
- Do not retry
4xxresponses other than429.
Next steps
- Read Errors for the full list of codes.
Updated 28 days ago
Did this page help you?