SMS verification API for virtual numbers
Automate numbers, codes, cancellations and rentals from your own code with a REST API and a single API key. Prices and refund rules match the website exactly.
The SNSTokens API is a REST API that lets developers create virtual numbers, read SMS verification codes, cancel orders and manage rentals from their own software.
Get a numberEndpoints
| Method | Path |
|---|---|
| GET | /api/v1/balanceYour credit in US dollars. |
| GET | /api/v1/servicesEvery app slug with its name, number of countries and lowest price. |
| GET | /api/v1/prices?service=telegram&country=usPrices of one app, for one country or all of them. |
| POST | /api/v1/numbersGet a one-time number. JSON body: service, country. |
| GET | /api/v1/numbers/{id}Status of a number and every SMS it received, with the code. |
| POST | /api/v1/numbers/{id}/cancelCancel before the first code; the full price goes back to credit. |
| POST | /api/v1/rentalsRent a number. JSON body: country, days (3, 14 or 30). |
| GET | /api/v1/rentals/{id}A rental with every SMS it received. |
Example
curl -X POST https://snstokens.com/api/v1/numbers \
-H "Authorization: Bearer $SNSTOKENS_KEY" \
-H "Content-Type: application/json" \
-d '{"service":"telegram","country":"gb"}'
{"ok":true,"number":{"id":"N7KQ2M9XP4T6WD","type":"one_time","service":"telegram",
"country":"gb","number":"+447700900123","price":"0.1670","status":"waiting",
"expires_at":"2026-11-22T10:20:00.000Z","sms":[]}}
curl https://snstokens.com/api/v1/numbers/N7KQ2M9XP4T6WD \
-H "Authorization: Bearer $SNSTOKENS_KEY"The number and ID above are examples. Get your API key in the console under API.
What you can automate
The SNSTokens API gives your code the same actions you have on the website. You can check your balance, list apps, read prices, create one-time numbers, read the codes that arrive, cancel numbers you no longer need and start rentals.
This suits QA teams that test sign-up flows in other countries, developers who build tools for their own accounts, and agencies that verify accounts for work at scale. The API covers 1,000 apps and websites in 162 countries, with prices from $0.0018 per number.
Base URL
All requests go to the base URL https://snstokens.com/api/v1. Requests and responses use JSON, and every endpoint below is a path under that base URL.
Authentication with the API key
You create an API key in the SNSTokens console. Send it with every request in the header Authorization: Bearer <API key>.
Treat the API key like a password for your account balance. Keep it on your server, out of public repositories and out of browser code. If a key is exposed, create a new key in the console and replace the old key in your setup.
The API key is separate from your account key. One account key is your login for the website and the console, and the API key is what your software uses to call the API.
Endpoints
The API has a small set of endpoints that together cover the full flow.
GET /balancereturns your current account credit in US dollars. Check it before a batch of orders so your code knows whether to top up first.GET /servicesreturns the list of apps and websites you can order numbers for, each with its slug. Use the slug as the service value in other requests.GET /prices?service=<slug>&country=<code>returns the price for an app in a country. You can use it to compare countries before you create a number.POST /numberscreates a one-time number. Send theserviceand thecountry, and the response includes the number and its id. The price is taken from your credit.GET /numbers/{id}returns the status of a number and any codes that have arrived. This is the endpoint you poll while you wait.POST /numbers/{id}/cancelcancels a one-time number before the first code arrives. The full price goes back to your credit.POST /rentalsstarts a rental. Send thecountryand the number ofdays(3, 14 or 30), and the price is taken from your credit.GET /rentals/{id}returns the status of a rental and the messages it has received.
The usual flow
A typical one-time verification runs in a short loop. Your code calls POST /numbers with the service and the country, receives a number and an id, and enters that number in the app you are verifying.
Next, your code calls GET /numbers/{id} every few seconds. While the status is Waiting for SMS, it keeps waiting. When the status changes to Code received, the response contains the code, and your code reads it and finishes the verification.
If your code decides it no longer needs the number, for example because the app rejected it, it calls POST /numbers/{id}/cancel before any code arrives. The full price goes back to your credit and the status changes to Cancelled.
Our guide on how to automate SMS verification with an API walks through this loop with practical advice.
Statuses
Every one-time number returned by the API has a status that matches the website:
- Waiting for SMS: the number is open and no code has arrived yet.
- Code received: at least 1 code has arrived and the number is paid for.
- Refunded: no code arrived within 20 minutes and the full price went back to your credit.
- Cancelled: you cancelled the number before the first code and the full price went back to your credit.
Rentals have 2 statuses: Active while the rental period runs, and Ended after its end date.
Refunds through the API
The API uses the same refund rules as the website. If no code arrives within 20 minutes, the number changes to Refunded and the full price goes back to your credit automatically, with no extra call from your side.
Cancelling with POST /numbers/{id}/cancel before the first code arrives also returns the full price. Once a code has arrived, the number is paid for, and further codes from the same app during the 20 minutes are included at no extra cost and appear in GET /numbers/{id}. The refund policy lists every rule.
Rate limit
Each API key can send 60 requests per minute. If you go past that, the API answers with the error code rate_limited, and your code should wait a moment before it tries again.
Polling GET /numbers/{id} every few seconds keeps you well inside the limit even with several numbers open. If you run many numbers at once, spread your polling over time rather than checking all of them in the same second.
Errors
Errors come back as JSON with an error code, so your code can react to each case directly:
bad_key: the API key is missing or not valid. Check the Authorization header.low_balance: your credit is too low for the order. Add credit and try again.not_found: the number or rental id does not exist on your account.code_received: the number already has a code, so it cannot be cancelled.bad_service: the service slug is not in the list fromGET /services.bad_country: the country code is not available for that request.rate_limited: the key sent more than 60 requests in a minute.network_error: a temporary issue on the network side. Wait a moment and retry the request.
Rentals through the API
To keep a number for several days, call POST /rentals with the country and 3, 14 or 30 days. Rentals are available in 12 countries, with prices from $1.98 for 3 days.
Then call GET /rentals/{id} whenever you want to read new messages. A rental receives SMS from any app during its period, stays Active until its end date and then changes to Ended. It is a fixed-period fee, so there is no refund once it has started. See rent a number for the full details.
Good practices
A few habits keep an integration reliable and your credit well used.
- Check prices with
GET /pricesbefore ordering, and pick the country that fits your price and your app. - Check
GET /balancebefore a batch, so orders do not fail withlow_balancehalfway through. - Poll every few seconds, not in a tight loop, and stop polling once the status is Code received, Refunded or Cancelled.
- Cancel numbers you will not use as soon as you know, so the price goes back to your credit right away.
- Store the id of every number and rental, so you can read its status later and match it to your own records.
- Handle every error code, and retry
network_errorandrate_limitedafter a short wait. - Keep your API key on the server side and replace it in the console if it is ever exposed.
Prices and credit
Orders through the API use the same prices as the price list, per number and in US dollars, and the same account credit as the website. You add credit with cryptocurrency through PayGate checkout, with 23 payment options and top-ups from $40 to $5,000.