All articles

600 requests per minute per key: five getStatus polling mistakes that make your bot hit the rate limit

Your bot is handling a couple dozen orders at once. Yesterday everything worked, but today some getStatus calls are getting rejected. The polling loop is usually to blame. Our virtual number API counts its rate limit per key: 600 requests per minute. Every request made with that key counts, from getNumber to setStatus, so careless getStatus polling eats up the budget for the whole bot.

Five mistakes that eat up the limit

  1. Polling with no pause. A getStatus loop with no delay fires a new request the moment the previous response comes back, and a single order like that can burn through the key's per-minute budget. Asking more often won't make the code arrive sooner. It shows up when the service sends the SMS to the number. Put a pause between polls of the same order, and start timing it from the moment the response arrives.

  2. Polling finished orders. The bot got the code but never closed the order, so the polling thread keeps asking for its status. Or the order expired, the money is already back on your balance, and the number sits in the queue until the next restart. Did the code work? Call setStatus with status 6 (complete), and the order leaves the queue. Need another code on the same number? Send status 3 and keep polling. After status 8 (cancel), or as soon as getStatus reports that the order is closed, remove it from the queue right away.

  3. Retries without backoff. A request fails with a network timeout or gets rejected by the rate limit, and the bot retries it immediately. When every worker does this, each rejection spawns another request, and the key stays over the limit until the load drops off on its own. Retry with a growing pause, for example 1, 2, 4, 8 seconds, capped at half a minute. Add random jitter so the workers don't all wake up in the same second.

  4. One key for every environment. The production bot, the test environment, and that "quick one-off" script all share the same 600 requests per minute. A test run uses up the whole per-minute budget, and production orders stop getting statuses. In your dashboard you can issue several named keys, such as prod-bot, staging, and local. We show the key string only once and keep only its fingerprint after that, so put it in your secrets store right away. That way, if a test key leaks, you can revoke it without stopping the production bot.

  5. A timeout that ignores the activation window. Each service has its own window, currently one hour, set by the catalog. A single constant for all services gets it wrong in both directions. If the bot gives up early and cancels the order, the code might have arrived in the minutes that were left. If the bot waits past the deadline, it keeps polling an order that has already closed, and the money for it has already been refunded to your balance automatically. Store a timeout for each service. Also keep in mind that you can't cancel an order until one minute after purchase. A bot that cancels right away will get rejected and start retrying the cancellation.

How to fit several workers into 600 requests per minute

The easiest way to calculate your budget is from the polling interval:

orders in progress × (60 / interval in seconds) + other calls ≤ 600

An order polled every 5 seconds costs 12 requests per minute. If the key does nothing but getStatus, that's 50 orders at once. But getNumber, setStatus, getBalance, and retries count too, so leave some headroom for them, say one fifth. That leaves 480 requests for getStatus: 40 orders at a 5-second interval or 80 at a 10-second interval. Four workers sharing one key get 10 or 20 orders each.

Now for the upper bound. The base cap is 100 concurrent orders, and your actual cap depends on your account's reputation. A hundred orders polled every 5 seconds generate 1200 getStatus calls per minute, twice the key's limit. At a 10-second interval it comes out to exactly 600, with no room left for other calls.

The limit applies per key, not per worker, so your workers need a shared limiter. The simplest approach is to move polling into a single loop. Once per interval, it goes through the active orders and hands the results out to the workers. If your processes run on different machines, keep the request counter in shared storage. You don't need to check the balance and prices before every getNumber. Refresh them with getBalance and getPrices on a schedule.

Track down keys from forgotten scripts

Open the "API Keys" list in your dashboard and look at the "Last used" date. A key nobody has used in a long time is usually left over from a prototype or an old test environment. Revoke it, and the string sitting in that forgotten config stops working. If the date is recent but the name doesn't tell you what's running on the key, find that script. It has its own rate limit, but the balance is shared, and it can buy numbers with your money. Revoke anything you don't need, and give each active environment its own key with a clear name.

Your first number in a minute

Signing up takes a minute, topping up a couple more, and the code arrives in 20 seconds.

Buy a number
No subscription feeCancel with a refund in the first hour