SMS Verification API
Buy numbers and read SMS codes with plain HTTP GET or POST requests. Answers use the text format of common SMS activation tools, private number calls answer in JSON.
Getting started
- Address
- https://snscodes.com/stubs/handler_api.php
- Authentication
- api_key parameter. Create the key on the API page of your account; it is shown once.
- Rate limit
- 300 requests per minute per key
- Money
- Prices and credit in US dollars, taken from the same credit as the website.
curl "https://snscodes.com/stubs/handler_api.php?api_key=$KEY&action=getNumber&service=telegram&country=us" # ACCESS_NUMBER:N-7KQ2M9XWD4:14155550123 curl "https://snscodes.com/stubs/handler_api.php?api_key=$KEY&action=getStatus&id=N-7KQ2M9XWD4" # STATUS_OK:482913
import time, requests
BASE = "https://snscodes.com/stubs/handler_api.php"
KEY = "YOUR_KEY"
r = requests.get(BASE, params={"api_key": KEY, "action": "getNumber", "service": "telegram", "country": "us"}).text
_, num_id, phone = r.split(":")
print("number", phone)
while True:
s = requests.get(BASE, params={"api_key": KEY, "action": "getStatus", "id": num_id}).text
if s.startswith("STATUS_OK"):
print("code", s.split(":")[1]); break
if s == "STATUS_CANCEL":
break
time.sleep(5)const BASE = "https://snscodes.com/stubs/handler_api.php";
const KEY = process.env.SNSCODES_KEY;
const call = async (q) => (await fetch(BASE + "?" + new URLSearchParams({ api_key: KEY, ...q }))).text();
const [, id, phone] = (await call({ action: "getNumber", service: "telegram", country: "us" })).split(":");
console.log("number", phone);
for (;;) {
const s = await call({ action: "getStatus", id });
if (s.startsWith("STATUS_OK")) { console.log("code", s.split(":")[1]); break; }
if (s === "STATUS_CANCEL") break;
await new Promise((r) => setTimeout(r, 5000));
}Get credit action=getBalance
Returns your account credit in US dollars.
ACCESS_BALANCE:42.50
BAD_KEYThe key is missing or wrong.
Code prices action=getPrices
Prices per code by country and service. Both filters are optional.
| Parameter | Required | Description |
|---|---|---|
| service | no | Service code, for example telegram |
| country | no | us, gb or au |
{"us":{"telegram":{"cost":3,"count":100}}}Buy a code number action=getNumber
Buys one number for one app. The price is taken from your credit at once and returned if no code arrives in 20 minutes.
| Parameter | Required | Description |
|---|---|---|
| service | yes | Service code from getPrices |
| country | yes | us, gb or au |
ACCESS_NUMBER:N-7KQ2M9XWD4:14155550123
BAD_SERVICEUnknown service code.BAD_COUNTRYThe service is not sold for this country.NO_BALANCENot enough credit. Nothing is charged.NO_NUMBERSNo number available right now. Nothing is charged.NO_ACTIVATIONSYou already have 20 open code numbers.
Read the code action=getStatus
Poll every 5 to 10 seconds until the code arrives.
| Parameter | Required | Description |
|---|---|---|
| id | yes | The id from getNumber |
STATUS_OK:482913
STATUS_WAIT_CODENo SMS yet.STATUS_WAIT_RETRY:482913Waiting for another code; the last one is shown.STATUS_CANCELCanceled or refunded.NO_ACTIVATIONUnknown id.
Cancel, retry or finish action=setStatus
status=8 cancels a number without a code (full refund), status=3 asks for another code on the same number, status=6 finishes it.
| Parameter | Required | Description |
|---|---|---|
| id | yes | The id from getNumber |
| status | yes | 8, 3 or 6 |
ACCESS_CANCEL
EARLY_CANCEL_DENIEDA code has already arrived; finish instead of cancel.ACCESS_RETRY_GETWaiting for another code.ACCESS_ACTIVATIONFinished.
Private number prices action=getRentPrices
Price for the whole period by country and period. Returns JSON.
| Parameter | Required | Description |
|---|---|---|
| country | no | Two-letter country code |
{"us":{"sixMonths":35.99,"twelveMonths":59.99}}Buy a private number action=getRentNumber
Buys a private number for a period. Returns JSON.
| Parameter | Required | Description |
|---|---|---|
| country | yes | Two-letter country code |
| period | yes | oneMonth, threeMonths, sixMonths, twelveMonths, twoYears or threeYears |
{"status":"success","id":"N-3HV8QZ2K5M","phone":"14155550123","until":"2027-05-02T10:00:00.000Z"}BAD_PERIODThe period is not sold for this country.NO_BALANCENot enough credit.
Read private number SMS action=getRentStatus
All SMS received by the private number so far. Returns JSON.
| Parameter | Required | Description |
|---|---|---|
| id | yes | The id from getRentNumber |
{"status":"success","state":"active","messages":[{"code":"482913","text":"Your code is 482913","from":"Telegram","at":"..."}]}Cancel a private number action=setRentStatus
status=2 cancels a private number for a full refund while no SMS arrived and it is less than 20 minutes old.
| Parameter | Required | Description |
|---|---|---|
| id | yes | The id from getRentNumber |
| status | yes | 2 |
{"status":"success"}EARLY_CANCEL_DENIEDAn SMS arrived or 20 minutes passed.