Request shape
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
GET https://sim-aggregator.org/stubs/handler_api.php?action=<method>&api_key=<key>&<params>- GET only. Parameters go in the query string. There is no request body and no auth header.
- Errors live in the body. An unknown key answers
BAD_KEYwith HTTP 200 andtext/plain. Read the body first; treat a non-2xx status as a transport problem, not an API answer. - Two reply formats.
getPrices,getCountries,getServicesList,getCurrentActivationsListand a successfulgetNumberV2return JSON. Everything else, including every refusal, is a short string likeACCESS_BALANCE:12.50orNO_NUMBERS. - Split on the first colon only. In
STATUS_OK:<code>the code is everything after the first:. Keep it a string: a code like004821loses its zeros as an integer. - Numbers come without
+.447700900123is the full international number. Add the plus yourself if a form needs it. - Money is US dollars.
getNumberV2reportscurrency: 840, the ISO 4217 numeric code for USD. - Limits: 600 requests per minute per key, and once every 2 to 5 seconds per activation for status polling.
Summary
| action | What it does | Required | Optional | Success reply |
|---|---|---|---|---|
getPrices | price and stock per country and service | country, service | JSON | |
getCountries | country reference | JSON | ||
getServicesList | service reference | country | JSON | |
getBalance | account balance | ACCESS_BALANCE:<amount> | ||
getNumber | order a number | country, service | duration, maxPrice | ACCESS_NUMBER:<id>:<number> |
getNumberV2 | order, JSON reply | country, service | duration, maxPrice | JSON |
getStatus | state of one activation | id | STATUS_* | |
getCurrentActivationsList | open orders for this key | JSON array | ||
setStatus | another code, finish or cancel | id, status | ACCESS_* |
Every action also needs action and api_key.
Selling numbers to other people on top of these calls? Two pages put them together: a Telegram number bot with full code, and an OTP number panel with markup and price-list code.
getPrices
Price and stock for a country, a service, or both. Without filters you get the whole price list, which is large; ask for what you need.
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
?action=getPrices&api_key=KEY&country=16&service=tg// handler_api reference: https://otpwatch.com/handler-api
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
{ "16": { "tg": { "cost": 1.38, "count": 280 } } }cost is in USD per one-off activation, count is how many numbers are free. Possible refusals: BAD_COUNTRY, BAD_SERVICE, BAD_KEY. Use it before an order to set maxPrice; price control shows the pattern.
getCountries
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
?action=getCountries&api_key=KEY// handler_api reference: https://otpwatch.com/handler-api
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
{ "43": { "id": 43, "rus": "DE", "eng": "DE", "chn": "DE", "visible": 1, "retry": 1, "rent": 0, "multiService": 0 } }The rus, eng and chn fields currently carry the two-letter ISO code, not a country name. That makes them a handy join key: map ISO codes to numeric ids once at startup instead of hardcoding ids. Country ids has the lookup code.
getServicesList
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
?action=getServicesList&api_key=KEY&country=16// handler_api reference: https://otpwatch.com/handler-api
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
{ "status": "success", "services": [ { "code": "tg", "name": "Telegram" }, { "code": "wa", "name": "WhatsApp" } ] }With country, the list narrows to services actually sold there. Refusals: BAD_COUNTRY, BAD_KEY.
getBalance
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
?action=getBalance&api_key=KEY
ACCESS_BALANCE:12.50A string, not JSON: parse the part after the colon as a decimal. Each open order holds its price until it closes, so on big parallel runs budget with the balance minus the price of every order still open.
getNumber
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
?action=getNumber&api_key=KEY&country=16&service=tg&maxPrice=2
ACCESS_NUMBER:12345:447700900123| Parameter | Values |
|---|---|
country | numeric country id, for example 16 |
service | service code, for example tg |
duration | activation (default, one code), d1, d3, d7 to rent for 1, 3 or 7 days |
maxPrice | price ceiling in USD; the order will not be placed above it |
Keep the id: every later call needs it. Replies other than ACCESS_NUMBER:
| Reply | Meaning |
|---|---|
NO_BALANCE | the balance does not cover the order |
NO_NUMBERS | no free number for this pair right now (also the answer when a rental costs more than maxPrice) |
WRONG_MAX_PRICE:<price> | the price is above maxPrice; the tail is the lowest current price (one-off activations only) |
BAD_MAX_PRICE | maxPrice is not a number above zero |
BAD_COUNTRY, BAD_SERVICE | unknown id or code; BAD_SERVICE also means the service has no such rental duration |
BAD_DURATION | unknown duration value |
CHANNEL_LIMIT | the account has hit its limit of simultaneous orders |
BAD_KEY, ERROR_API | key rejected; unexpected server error |
getNumberV2
Same parameters, same refusals as plain strings. Only the success reply changes:
// handler_api reference: https://otpwatch.com/handler-api
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
{
"activationId": 12345,
"phoneNumber": "447700900123",
"activationCost": 1.38,
"currency": 840,
"countryCode": "16",
"canGetAnotherSms": "1",
"activationTime": "2026-11-24 12:00:00",
"activationOperator": "any"
}activationTime is UTC. Since refusals are not JSON, check whether the body starts with { before parsing.
getStatus
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
?action=getStatus&api_key=KEY&id=12345
STATUS_OK:481920| Reply | Meaning | Next move |
|---|---|---|
STATUS_WAIT_CODE | number issued, no SMS yet | poll again in 2 to 5 s |
STATUS_OK:<code> | code received | use it, then setStatus 6 or 3 |
STATUS_WAIT_RETRY:<code> | waiting for the next code; tail is the previous one | keep polling |
STATUS_CANCEL | activation closed (cancelled or finished) | stop polling |
NO_ACTIVATION | unknown or already closed id | stop polling |
getCurrentActivationsList
// handler_api reference: https://otpwatch.com/handler-api
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
[ { "numberid": 12345, "number": "447700900123", "status": 0 } ]A flat array of this key's open orders: status 0 means waiting for a code, 3 means a code arrived. Closed orders are not listed; no open orders gives []. Rented numbers stay in the list until the rental ends. It is the cheapest way to find orders a crashed process left behind.
setStatus
# handler_api reference: https://otpwatch.com/handler-api
# Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
?action=setStatus&api_key=KEY&id=12345&status=6
ACCESS_ACTIVATION| status | Effect | Success reply |
|---|---|---|
3 | ask for another code on the same number | ACCESS_RETRY_GET |
6 | finish: the code was accepted | ACCESS_ACTIVATION |
8 | cancel; the money returns to your balance | ACCESS_CANCEL |
Refusals: EARLY_CANCEL_DENIED (too early to cancel, repeat the request later; the docs give no time), BAD_STATUS (already closed, or a code was delivered so it cannot be cancelled), NO_ACTIVATION, BAD_KEY, ERROR_API.
One parser for every reply
Handle the string and JSON shapes in one place, so the rest of your code deals with values and named errors.
// handler_api reference: https://otpwatch.com/handler-api
// Building a bot that resells numbers to other people? Software program: https://otpwatch.com/partner
// Turns any handler_api.php body into { ok, value } or { ok: false, error, detail }.
export function parseReply(action, body) {
const text = body.trim();
const json = text.startsWith("{") || text.startsWith("[");
if (json) return { ok: true, value: JSON.parse(text) };
const [head, ...rest] = text.split(":");
const tail = rest.join(":");
switch (head) {
case "ACCESS_BALANCE": return { ok: true, value: Number(tail) };
case "ACCESS_NUMBER": { const [id, phone] = tail.split(":"); return { ok: true, value: { id, phone } }; }
case "STATUS_OK": return { ok: true, value: { state: "code", code: tail } };
case "STATUS_WAIT_CODE": return { ok: true, value: { state: "waiting" } };
case "STATUS_WAIT_RETRY": return { ok: true, value: { state: "waiting", previous: tail } };
case "STATUS_CANCEL": return { ok: true, value: { state: "closed" } };
case "ACCESS_ACTIVATION": case "ACCESS_CANCEL": case "ACCESS_RETRY_GET":
return { ok: true, value: head };
default: return { ok: false, error: head, detail: tail || null, action };
}
}What to do with each named error is on the error codes page.