Rate limits
How many requests a key can make, the headers that tell you where you stand, and what to do when you hit a limit.
Limits per key
| What | Limit |
|---|---|
| Requests of any kind | 120 a minute per key |
| Creates: POST to videos, avatars, ugc, images, tools, audio and swap | 20 a minute per key |
Quotes, uploads, job lookups and lists count towards the 120; every create counts towards both. Limits are per key, so separate apps with separate keys never slow each other down. Jobs keep running in the background however many you start, and you pay only for the ones that succeed.
The 429 response and Retry-After
Over a limit, a request gets 429 rate_limited with a Retry-After header: the number of seconds to wait before trying again. Nothing was started and nothing is charged.
Wait at least that long, then retry with the same Idempotency-Key. The SDKs do this for you, with backoff. If you send bursts, spread them out with a small queue on your side.
Rate limit headers
Every response carries these headers. On a create they describe the 20-a-minute create limit; on every other call, the 120.
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed in a minute |
X-RateLimit-Remaining | Requests left right now |
X-RateLimit-Reset | When the next request frees up, in Unix seconds |