Per-client limits
Two buckets apply to every request you make with client credentials. Both are keyed by your API client, so all of your businesses share them.
The write bucket is the one that heavy data ingestion reaches first. If you sync many businesses in parallel, keep the combined write rate across all of them under the write limit, or retry on
429.
Business access tokens
Requests made with a business access token are keyed by business instead of by client. Each business has an overall bucket of 50 requests per second across all endpoints, and the write bucket applies per business at the same rates as above.Endpoint-specific limits
Some endpoints have their own bucket in addition to the limits above. These are documented on the individual endpoint pages. A request succeeds only when every bucket that applies to it has a token available.Rate limit headers
Rate limits should never be approached by normal read traffic. They exist to bound heavy data ingestion, such as backfills or nightly resyncs. Nonetheless, we recommend adding retries on all Layer API calls. To assist in retries, responses from write endpoints and from endpoints with their own bucket include the following headers, which describe the most specific bucket that applies to the endpoint:X-RateLimit-Limit: the capacity of the bucket.X-RateLimit-Remaining: the number of tokens remaining in the bucket.X-RateLimit-Reset: a UTC timestamp (in seconds) that specifies when the bucket refills.
- Error code
429: Too Many Requests Retry-Afterheader indicating (in seconds) how long to wait before retrying the request.
Retry-After interval and then retrying is sufficient to recover from rate limiting. Do not retry immediately, because the bucket does not refill until the next reset.