Issue with API rate limits causing errors in build script
Based on the technical limits documentation, I can help clarify the situation with the IP rate limit block.
How Long Does the Block Last?
The good news is that IP rate limit blocks are temporary and reset automatically. According to the documentation, the rate limits are enforced per second. This means:
- Once you exceed the rate limit (e.g., more than 25 mutations/second or 500 total API calls/second), you'll receive HTTP
429responses - The block lasts only until the current one-second period ends
- After that second passes, the counter resets and requests can resume
So your developer should be able to make requests again within seconds of stopping the migration activity that triggered the limit. There's no permanent IP blacklist - it's just a per-second throttle.
Understanding the Rate Limits
The per-IP rate limits are:
- Maximum mutation rate: 25 req/s (POST to
/data/mutate) - Maximum upload rate: 25 req/s (POST to
/assets/) - Maximum global API call rate: 500 req/s
Best Practices for Data Migration
To avoid hitting these limits during migrations:
Use the CLI import tool: The
sanity dataset importcommand is specifically designed for bulk imports and handles rate limiting automatically with built-in retry logic and proper throttlingImplement throttling: If writing a custom migration script, add delays between batches of requests to stay under the 25 req/s limit for mutations
Use transactions: Batch multiple mutations into single transaction requests where possible to reduce the total number of API calls
Add retry logic: Implement exponential backoff when you receive 429 responses - wait a bit longer after each retry
If You Need Higher Limits
If your developer continues to experience issues or if you need to perform large-scale migrations that require higher limits, you should contact Sanity support to discuss your specific needs. Enterprise customers can work with Sanity to customize limits for their use case.
For immediate relief, the simplest solution is to slow down the migration script to stay under 25 requests per second, or better yet, use the official sanity dataset import CLI tool which handles all of this automatically.
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.