Automating SMS Verification With an API (Developer Guide)
Buy numbers, poll for codes and handle refunds programmatically with the REST API or the SMS-Activate compatible endpoint.
Updated: · 2 min read
If you run QA pipelines or manage many test accounts, buying numbers by hand does not scale. The API lets you do everything the dashboard does: check prices, buy a number, read the code and cancel for a refund.
Get your API key
Log in, open Account settings and copy your API key. Keep it secret: it can spend your balance. You can regenerate it at any time.
The basic flow
GET /api/v1/prices?service=telegram: list countries with price, stock and success rate.POST /api/v1/buywithserviceandcountry_id(from the prices list): returns an order ID and the number.GET /api/v1/status?id=…every 5 seconds untilstatusisreceived.POST /api/v1/finishwhen done, or/api/v1/cancelfor a refund if you no longer need it.
Example in Python
import time, requests
BASE = "https://YOUR-DOMAIN/api/v1"
H = {"Authorization": "Bearer YOUR_API_KEY"}
o = requests.post(f"{BASE}/buy", headers=H, data={"service": "telegram", "country_id": 16}).json()
print("Number:", o["order"]["number"])
for _ in range(60):
s = requests.get(f"{BASE}/status", headers=H, params={"id": o["order"]["id"]}).json()
if s["order"]["status"] == "received":
print("Code:", s["order"]["code"]); break
time.sleep(5)
else:
requests.post(f"{BASE}/cancel", headers=H, data={"id": o["order"]["id"]})
Already using SMS-Activate style scripts?
Point your existing tool to /stubs/handler_api.php with your API key. getBalance, getNumber, getStatus, setStatus and getPrices are supported, so most tools work by changing only the base URL.
Good practice
- Poll every 5 seconds, not faster.
- Always cancel orders you do not need. Refunds are instant.
- Sort by
success_rate, not only by price. - Respect the concurrent order limit; a
limiterror means you have too many waiting numbers.
Full reference with every parameter and error code: API documentation.
More guides
How to Set Up a Second WhatsApp Account
Separate work and personal chats: options for a second WhatsApp account on one phone, and how to verify it with a virtual number.
How to Protect Your Phone Number Online
Your phone number is a key to your accounts. Practical steps to limit spam, SIM-swap risk and data leaks.
Verification SMS Not Received? 9 Fixes That Work
Why verification codes sometimes do not arrive on virtual numbers and what to do, from choosing a country to retrying the right way.