OtpGet SMS API: A Complete Guide to Buying Virtual Numbers by API
If you run a reseller panel, a bot, a QA pipeline or an automation tool that needs phone verification, clicking through a website is not an option. You need an API. The OtpGet SMS API lets you do everything a normal user does on the website, from checking your balance to buying a number and reading the OTP, with simple HTTP requests.
One endpoint, a handful of actions
All temporary-number requests go to a single endpoint:
https://otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=ACTION_NAME
The action parameter decides what happens. The actions you will use most are:
- getBalance - your current wallet balance
- getServers - the list of servers you can buy from
- getCountries and getServices - what is available on a server
- getPrice - the price before you buy
- getNumber - buy a number
- getStatus - check whether the OTP has arrived
- setStatus - cancel for a refund or finish the order
The typical flow
- Call
getBalanceto make sure you can afford the purchase. - Pick a server, country and service, then call
getPrice. - Call
getNumber. You receive an order id and a phone number. - Enter that number on the target app and request the code.
- Poll
getStatuswith the order id until it returns the code, or receive it by webhook. - Call
setStatusto finish, or to cancel and get an automatic refund if no code arrived.
Plain text for the basics, JSON for lists
The balance, buy, status and set-status actions answer in a compact plain-text format that is easy to parse in any language, for example ACCESS_BALANCE:125.00, STATUS_WAIT_CODE or STATUS_OK:123456. The list actions (servers, countries, services) answer in JSON. If you already have code written for a similar number-API protocol, it will usually work after changing only the base URL and the key.
A quick example in Python
import requests
url = "https://otpget.com/stubs/handler_api.php"
key = "YOUR_API_KEY"
print(requests.get(url, params={"api_key": key, "action": "getBalance"}).text)
Errors are explicit
Every failure returns a readable code such as BAD_KEY, NO_BALANCE or NO_NUMBERS, so your code can react correctly instead of guessing. We cover each one in our error-handling guide.
Start building with OtpGet
Create a free account at otpget.com, copy your API key from the dashboard and open the API documentation. The docs include copy-paste examples in PHP, cURL and Python for every action. Our support team is available 24/7 if you get stuck.