SMS Verification API: Integration Walkthrough
An SMS verification API lets your code order a phone number, wait for a verification text, read the code and close the order, all without anyone clicking through a dashboard. Teams use it to test their own sign-up flows, to run Telegram bots and small stores that resell numbers, and to automate QA across many countries. This walkthrough uses the SMS Feel API as the example. It goes through the full lifecycle of an order, the parts that usually go wrong, and the guardrails that stop a bug from emptying your balance. It is written for developers, but we have kept it readable for anyone planning an integration.
Short answer: An SMS verification API lets your code order a number, receive the verification text and close the order automatically. With the SMS Feel developer API you use your dashboard API key, wait for the code by polling or a webhook, and cancel within 10 minutes if no code arrives so the amount returns to the wallet.
What the SMS verification API covers
The SMS Feel API has separate endpoints for different products, all using the same API key from your dashboard:
- One-time numbers for single SMS codes, through the main handler at https://smsfeel.com/stubs/handler_api.php.
- Rental numbers for repeat codes over a chosen period, through a separate rental handler.
- Temporary email for services that send codes by email, through an email handler.
Every request carries your key as an api_key query parameter. Responses on the main handler are JSON with a success flag. The documentation also lists meaningful HTTP status codes, such as 401 for a bad key and 402 for insufficient balance, but the docs advise checking the JSON body first. The full reference with copy-paste examples in PHP, Python, Node.js and cURL is in the OTP API overview and the API docs it links to.
The order lifecycle, step by step
A one-time verification goes through the same stages every time.
1. Discover what is available
Call the actions that list countries and services, and use getPrice to check the price for a service and country. Service and country IDs come from these calls, so do not hard-code guesses. A getBalance call at startup is a cheap sanity check that your key works.
2. Order a number
Call getNumber with the service ID, the country ID and the server type. The response gives you an order ID and the phone number. Store the order ID. Every later call needs it.
3. Trigger the SMS
Enter the number in the app or system you are testing and make it send the code. This step is yours, not the API's.
4. Wait for the code
You have two options. Poll getStatus (or getStatusV2, which returns the code and the full message text in a structured form) until the status changes from waiting to received. Or use the webhook push option described in the docs, so the platform notifies you instead of you asking repeatedly.
5. Close the order
Use setStatus to finish an order after a code arrives, or to cancel it before any code arrives. Cancelling before a code returns the amount to your balance. Once a code has arrived, the order counts as complete and cannot be refunded.
Polling without getting throttled
Polling is simple, which is why most first integrations use it. It is also where most first integrations misbehave. A few rules:
- Wait a few seconds between status checks. The homepage example uses three seconds, which is a sensible starting point.
- Set a hard timeout. If no code arrives within your window, stop polling and cancel.
- Never run an endless loop. A bug that polls forever on hundreds of orders hurts you and the platform.
- Back off when you see errors rather than retrying instantly.
We wrote a deeper piece on this: OTP API rate limits and polling. If you prefer push, the webhook option removes polling entirely.
Error handling that actually helps
Good error handling is the difference between an integration that runs quietly for months and one that pages you at 3 a.m. Map the error responses from the docs into clear cases in your code:
| Situation | What your code should do |
|---|---|
| Bad or missing API key | Stop and alert. Do not retry. |
| Insufficient balance | Stop ordering, alert a human, top up. |
| No numbers for this service and country | Try a backup country or server, or wait. |
| Upstream or temporary error | Retry a limited number of times with a delay. |
| Order not found | Log it. Usually a stored ID problem in your code. |
Clear messages from the platform tell you whether a number is out of stock, your balance is low or a server is busy, so log them as they come back. They make debugging much faster.
Currency and prices
Prices and balances on the SMS Feel API are in PKR by default. You can add an optional currency parameter, for example USD, to get amounts converted for display. Your wallet is still charged, refunded and held in PKR. There is a getCurrencies action that lists the supported codes. If you resell numbers, this lets you show prices in your customers' currency without doing your own conversion.
Prices depend on country, service and number type and change with supply, so always read the live price before ordering instead of caching it for days. The pricing page explains the pay-per-order model. There is no subscription: you top up a balance and each order is charged when you place it.
One pattern that works well for resellers: fetch prices for your most popular services every few minutes, keep them in a short cache, and add your margin on top when you display them. That keeps your store fast without showing stale prices for long. If a live price comes back higher than your cached one at order time, show the new price to the customer before charging rather than absorbing the difference silently.
Guardrails for your balance
The fastest way to lose money on any SMS verification API is a bug in a loop. Build these in from day one:
- Spending cap. Track how much your code has spent today and stop at a limit.
- Retry limit. A maximum number of orders per task or per user.
- Auto-cancel. Cancel any order that times out, so unused orders are refunded.
- Secret key handling. Keep the API key in server-side config, never in front-end code or a public repository.
- Test on your own systems. Use verification numbers only on apps and accounts you own or are authorised to test, and never put real customer data into test environments.
For a working code sample with these ideas in place, see OTP API integration in Python and PHP.
Resellers, bots and automated testing
Many SMS Feel API users are resellers who connect a Telegram bot or a small store, set their own margin and let customers order through them. Others are QA teams who run automated sign-up tests across countries every night. Both use the same flow above. Resellers should read the API user and reseller section of the terms before going live. QA teams may find SMS OTP API for automated testing useful for structuring test runs.
FAQ
Where do I get an API key?
Create a free account and generate the key in your dashboard.
Which languages are supported?
Any language that can make HTTP GET requests. The docs include PHP, Python, Node.js and cURL examples.
How do I know when the code arrives?
Poll the status action with a delay, or use the webhook push option so you are notified.
Can I cancel an order?
Yes, before a code arrives. The amount returns to your balance. After a code arrives, the order is complete.
Does the API cover rentals and email?
Yes. Rentals and temporary email have their own endpoints and use the same key.
What currency are prices in?
PKR by default, with an optional currency parameter for converted display amounts.
Can I test the API without spending much?
Yes. Start with a small balance, call the information actions like balance, countries and prices, then place a single real order. Cancel it if you do not need the code, as long as no code has arrived yet.