OTP API Rate Limits: Poll Without Being Throttled
If you build anything that reads OTP codes automatically, you will meet rate limits. An OTP API lets you ask for a code, check whether it has arrived, and cancel an order, but it does not let you ask as often as you like. Poll too fast and the API answers with an error, slows you down, or blocks the key for a while. The fix is not to poll harder. It is to poll on a pattern the API tolerates, and to stop once you have the answer.
This guide explains how OTP API rate limits work, the polling pattern that stays under them, and what to do when a code never arrives. It is written for developers, but the ideas are simple enough for anyone who runs an automated check.
OTP API Rate Limits: How They Work
A rate limit caps how many requests you can make in a window of time, for example, a number of requests per minute per API key, or per order. The provider sets the limit to protect its servers and to stop automated abuse, and it applies the limit whether your requests are useful or not. When you pass the limit, the API answers with an error instead of a result, often a 429 status, or a message saying to slow down.
The exact limits are in the API documentation, and they differ between providers, so read them before you write any polling code. Do not guess. A limit you have not read is a limit you will hit, and a blocked key stops every order, not just the one you were polling. The SMSFeel OTP API documentation lists the endpoints and the expected behaviour, and it is the first thing to read before you build.
A Polling Pattern That Works
The pattern that works is simple. Ask once, wait a few seconds, ask again, and wait a little longer each time. Start with a short wait of a few seconds between checks. If the code has not arrived, double the wait, a few seconds, then more, then more, up to a cap of about half a minute between checks. This is called backoff, and it keeps you well under most rate limits while still catching the code soon after it arrives.
Poll one order at a time, and never run several pollers on the same order, because each one counts against the same limit. Two pollers asking every three seconds are the same as one poller asking every second and a half, and the limit does not care which script sent the request. Set a hard stop as well. If the order window ends with no code, stop polling, cancel the order from the dashboard if it is still within the active window, and try one different number instead. A poller without a hard stop is a poller that burns quota on a dead order.
Backoff, Jitter and the Mistakes That Get Keys Throttled
Backoff works better with a small random delay added to each wait, which is called jitter. Without it, every poller in your system asks at the same moment after the same wait, and the requests arrive in bursts that trip the limit even though the average rate is fine. Add a second or two of random delay, and the bursts smooth out. It is a small change, and it is the difference between a system that runs all day and one that gets throttled at peak hours.
The common mistakes are easy to list. Polling every second from the start. Running the same check from several workers at once. Retrying a failed request immediately instead of waiting. Treating a 429 error as a reason to try again faster, when it is a signal to slow down. Each of these is fixable in a few lines of code, and each one is cheaper to fix before the key is blocked than after. Log every 429 response, and treat a rising count as a warning, not as noise.
When the Code Never Arrives
Sometimes the code never comes, and no polling pattern can fix that. Check the dashboard first. If the order shows no message after the full window, the number may be blocked. Cancel the order from the dashboard if it is still within the active window, and try one different number from a different range. Do not keep polling a dead order, and do not retry the same number, because the result will be the same.
If the account will need future codes, move to a rental and keep it active. For a main earning account, your own Pakistani SIM is still the lowest-risk option, and a private rental kept active long term is next-best. Never use a public shared number for an account that matters, and never use one number for multiple accounts. If polling is not the right fit at all, webhooks are the alternative, and our guide on receiving OTP codes instantly with webhooks explains how to stop polling and get codes pushed to your server instead.
Building a Poller That Lasts
A poller that lasts is built around three numbers: the first wait, the backoff step, and the hard stop. Set the first wait to a few seconds, double it on each empty check up to about half a minute, and stop when the order window ends. Add jitter, poll one order at a time, and log every error so you can see a limit approaching before it hits. Test it against one order first, watch the logs for a day, and only then scale it up.
Keep the API key safe as well. A key that leaks is a key that gets used by someone else, and their requests count against your limit. Store it in a secret, not in code, rotate it if it is ever exposed, and give each service its own key so one bad poller cannot block the rest. For the full setup, read the SMSFeel SMS API guide, and the guide on getting your SMSFeel API key walks through the first request step by step. The pricing page shows the live cost of numbers before you scale up.
Frequently Asked Questions
What is an OTP API rate limit?
It is a cap on how many requests you can make in a window of time, per API key or per order. Pass it, and the API answers with an error instead of a result, often a 429 status.
How often should I poll for a code?
Start with a wait of a few seconds, then double the wait on each empty check, up to about half a minute. This backoff pattern keeps you under most limits while catching the code soon after it arrives.
What is backoff, and why does it help?
Backoff means waiting longer after each empty check. It spreads your requests out, so you stay under the rate limit instead of hammering the API at a fixed pace.
Can I run several pollers on the same order?
No. Every poller counts against the same limit, so several pollers on one order will trip it faster than one poller alone. Poll one order at a time.
What should I do when I get a 429 error?
Slow down. A 429 is a signal to wait longer between requests, not to retry faster. Log it, increase the wait, and check your polling pattern.
Is there an alternative to polling?
Yes. Webhooks push the code to your server the moment it arrives, so you do not need to poll at all. Our webhooks guide explains the setup and the polling fallback.