When Twilio responds to an API request with Error 429, this indicates the maximum number of concurrent API requests has been reached. This guide covers suggest best practices for avoiding Error 429 responses.
Avoid unnecessary fetching
If you are submitting a significant number of HTTP GET requests to our REST API, please consider one or more of the following:
StatusCallBackrequests into your application for the resource endpoint you are utilizing. Storing Twilio's callback responses may allow you to query your server(s) locally, instead of performing additional GET requests. Here are two examples for adding callbacks to your application:
- Implement a Debugger Webhook to automatically write to your servers on selected error thresholds, reducing the need for additional fetching.
- Move data like call recordings and media from Twilio to your own servers. Once the data has been successfully moved, delete data stored on Twilio servers if no longer needed. This is a recommended business practice for privacy, security, and compliance between your customers and your company, and may reduce Twilio monthly storage costs.
Implement retries with exponential backoff
When an API request receives an Error 429 response, this request is never processed. Any requests with Error 429 responses are always safe to retry. Here's a selection of documentation from major cloud providers discussing their best practices for retries with exponential backoff.
- Google - Implementing exponential backoff: https://cloud.google.com/iot/docs/how-tos/exponential-backoff
- Amazon - Error Retries and Exponential Backoff in AWS: https://docs.aws.amazon.com/general/latest/gr/api-retries.html
- Microsoft - Implement retries with exponential backoff: https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/implement-retries-exponential-backoff
More help needed
If you have implemented both best practices, but continue to receive Error 429 responses, please contact our Support team with your relevant use case information.