简体   繁体   中英

Twilio REST Exception HTTP 429 error: Unable to create record: Too many requests

I have created an app in Django. Using Twilio Verify API (free trial) for OTP.

Problem:- It's working fine but when a user try to get the OTP multiple times, Twilio creates an exception "HTTP 429 error: Unable to create record: Too many requests". After this I was not able to use this for the whole day even for different mobile number or device.

How to bypass this issue and precisely what is the reason behind this issue?

Twilio Developer Evangelist here. TheVerify API has rate limits for sending SMS codes to the same phone number , ~5 requests within 10 minutes. I'm not sure why it wasn't working with a different phone number, though - let me know if you're still having issues after you try the below.

You're definitely not the first person to run into this issue, so I have a blog post that should answer the question: How to test Twilio Verify without getting rate limited

tl;dr your options include -

  1. Complete a verification lifecycle by calling the Verification Check endpoint
  2. Wait for the verification to expire (in 10 minutes)

I also recommend spinning up a Verification Testing Dashboard that will help you check/cancel a verification during development.

Here's another blog post about managing retry logic that's also designed to prevent hitting API rate limits: https://www.twilio.com/blog/best-practices-retry-logic-sms-2fa

This may have been solved by now but for anyone else it's possible that the free Twilio trial account has expired or used up it's allocated requests. This happened me as I had forgotten I was using a trial account in a test environment, and when tests started to fail this was the issue.

I encountered the same problem with email channel when a user tries to send verify api multiple times and gets this error. All other emails would get the same error, and nobody can get verified. This looks to me that one user gets rate limited and it could affect all other users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM