2

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?

philnash
  • 70,667
  • 10
  • 60
  • 88
Durgendra
  • 145
  • 2
  • 11

3 Answers3

3

Twilio Developer Evangelist here.

First - if you're on a trial account you may be running into trial account limits. You will need to upgrade your account to send more than 35 messages a day.

The Verify 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

Kelley Robinson
  • 768
  • 1
  • 6
  • 10
  • Actually, at first I was trying to get the OTP from same mobile number multiple times. Then when I switched to another mobile number or device, I was getting same error. I assume the Verify API link was disabled for some time. – Durgendra Aug 02 '21 at 12:09
  • I'm also getting this issue with two different phone numbers @KelleyRobinson – Luke Brown Mar 08 '22 at 15:52
1

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.

Ciarán Bruen
  • 5,221
  • 13
  • 59
  • 69
  • Good call out! Here's more detail on Trial Account Limitations: https://support.twilio.com/hc/en-us/articles/360036052753-Twilio-Free-Trial-Limitations#h_01F1GNJ8B8NZSNKQCW26Y3S4MJ – Kelley Robinson Jun 14 '23 at 16:50
-1

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.