How long to wait after exceeding Sanity API limit?
When you exceed Sanity's API rate limit, the wait time depends on which specific limit you hit. According to the technical limits documentation, Sanity enforces rate limits in two ways:
Per-IP Rate Limits (enforced per second):
- Maximum mutation rate: 25 requests/second
- Maximum upload rate: 25 requests/second
- Maximum global API call rate: 500 requests/second
Concurrent Rate Limits (per dataset):
- Maximum concurrent queries: 500
- Maximum concurrent mutations: 100
When you hit a rate limit, you'll receive an HTTP 429 response with helpful headers:
retry-after: Tells you how many seconds to wait before retryingratelimit-reset: Time in seconds until the limit resetsx-ratelimit-limit-*: Shows your rate limit thresholdx-ratelimit-remaining-*: Shows how many requests you have left
How long to wait:
Since these are rolling window limits (measured per second), you typically only need to wait 1-2 seconds for the per-IP limits to reset. The key is to check the retry-after header in the 429 response - it will tell you the exact wait time.
Best practices to avoid hitting limits:
- Implement exponential backoff: When you get a 429, check the
retry-afterheader and wait that duration before retrying - Throttle batch operations: For mutations, stay well under 25 req/s by adding delays between requests (50-100ms works well)
- Use the API CDN: Cached responses through the API CDN have unlimited rate limits
- Process in smaller batches: Break large operations into chunks of 10-20 requests at a time
For most use cases, spacing out your requests by 40-50ms will keep you comfortably under the 25 req/s mutation limit without triggering rate limiting at all.
Show original thread2 replies
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.