API Docs

Integrate virtual phone numbers and OTP verification into your own apps and scripts.

Jump to section

Base URL

https://otpdesk.com/api/handler_api.php

The whole API is one endpoint. You pick what it does with the action query parameter — for example ?action=getNumber. Every request is a plain GET (POST form bodies work too), and every response is JSON.

229Countries live
3925Services live
5Servers online

Your API Key

Log in or create a free account to get your personal API key. Everywhere the examples below show <your-api-key>, you'll paste the key from here.

Send it as a header — X-API-Key: <your-api-key> — or as ?api_key=..., or Authorization: Bearer <your-api-key>. Session login also works if you're calling the API from a browser you're already logged into.

curl "https://otpdesk.com/api/handler_api.php?action=getBalance" \
     -H "X-API-Key: <your-api-key>"

Keep your key server-side. Anyone holding it can spend your balance.

Response Format

Every action answers with the same envelope. On failure, data.error_code carries a stable machine-readable code from the error reference.

{
  "success": true,
  "message": "ok",
  "data": { ... }
}

{
  "success": false,
  "message": "No numbers available",
  "data": { "error_code": "NO_NUMBERS" }
}

Servers & Routing

Numbers are sourced from several independent upstream servers. Every one of them is addressed by a plain numeric server_id — the same numbering you see on the Numbers page in your dashboard.

IDName
1Server 1
2Server 2
3Server 3
4Server 4
5Server 5

Omit server_id and we auto-route your request across every server, cheapest first, and automatically fall back to the next one if a server is out of stock. Supply server_id and the request is locked to that single server — no fallback, so you get a clear error instead of a number from somewhere else.

This list is live. Call getServers at runtime rather than hardcoding IDs — servers can be added or retired.

Activation API

GETaction=getNumberBuy a number

Parameters

ParamRequiredDescription
servicerequiredService name, e.g. Telegram. See getServicesList.
countryrequiredCountry name, e.g. India. See getCountries.
server_idoptionalLock to one server (1, 2, 3, 4, 5). Omit to auto-route with fallback.
max_priceoptionalNever pay more than this. The purchase fails rather than overspending.

Example request

GET https://otpdesk.com/api/handler_api.php?action=getNumber&service=Telegram&country=India
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": {
    "id": 12345,
    "phone": "919000000000",
    "price": 12.50,
    "server_id": 1
  }
}

Keep the returned id — every other activation call takes it. Prices already include any discount on your account.

GETaction=getNumberV2Buy a number (richer response)

Parameters

ParamRequiredDescription
servicerequiredService name
countryrequiredCountry name
server_idoptionalLock to one server; omit to auto-route with fallback
max_priceoptionalPrice ceiling for this purchase

Example request

GET https://otpdesk.com/api/handler_api.php?action=getNumberV2&service=Telegram&country=India&server_id=1
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": {
    "activationId": 12345,
    "phoneNumber": "919000000000",
    "activationCost": 12.50,
    "activationTime": "2026-01-01 12:00:00",
    "countryName": "India",
    "serviceName": "Telegram",
    "server_id": 1,
    "canGetAnotherSms": true
  }
}

Same purchase behaviour as getNumber — only the response shape differs.

GETaction=getStatusPoll for the OTP

Parameters

ParamRequiredDescription
idrequiredThe activation id returned by getNumber

Example request

GET https://otpdesk.com/api/handler_api.php?action=getStatus&id=12345
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": {
    "status": "STATUS_OK",
    "code": "123456"
  }
}

Poll a few seconds apart, not in a tight loop — requests are rate-limited per account. While no code has arrived yet the status stays in its waiting state.

GETaction=getStatusV2Poll for the OTP (JSON detail)

Parameters

ParamRequiredDescription
idrequiredThe activation id

Example request

GET https://otpdesk.com/api/handler_api.php?action=getStatusV2&id=12345
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": {
    "code": "123456",
    "text": "Your Telegram code is 123456",
    "dateTime": "2026-01-01 12:00:31"
  }
}

Use this when you need the full SMS body or the delivery timestamp, not just the extracted code.

GETaction=setStatusCancel, finish, or ask for the next OTP

Parameters

ParamRequiredDescription
idrequiredThe activation id
statusrequiredSee the status table below

Status values

ValueMeaning
8Cancel the activation and refund your balance. Not possible once a code has already arrived.
6Mark the activation done. Closes it out; no refund.
3Request the next OTP on the same number.

Example request

GET https://otpdesk.com/api/handler_api.php?action=setStatus&id=12345&status=8
X-API-Key: <your-api-key>

Cancel anything you no longer need — an abandoned activation ties up stock and is only refunded if you cancel it.

GETaction=regetNumberAnother OTP on the same number

Parameters

ParamRequiredDescription
idrequiredAn activation that has already received at least one code

Example request

GET https://otpdesk.com/api/handler_api.php?action=regetNumber&id=12345
X-API-Key: <your-api-key>

After calling this, keep polling getStatus for the new code. Only available where the service supports multiple codes on one number; equivalent to setStatus with status=3.

Utility API

GETaction=getBalanceYour account balance

Takes no parameters.

Example request

GET https://otpdesk.com/api/handler_api.php?action=getBalance
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": { "balance": 250.00, "currency": "INR" }
}
GETaction=getServicesListAvailable services

3925 distinct services are currently available across all servers.

Parameters

ParamRequiredDescription
server_idoptionalOnly list what this one server offers. Omit for the merged catalog across all servers.
countryoptionalOnly services available in this country

Example request

GET https://otpdesk.com/api/handler_api.php?action=getServicesList&country=India
X-API-Key: <your-api-key>

Services offered by more than one server appear once, quoted at the best price available to you. Prices already reflect your account discount.

GETaction=getCountriesAvailable countries

229 distinct countries are currently available across all servers.

Parameters

ParamRequiredDescription
server_idoptionalOnly countries this one server covers. Omit for the merged list.

Example request

GET https://otpdesk.com/api/handler_api.php?action=getCountries
X-API-Key: <your-api-key>

The country names returned here are exactly what getNumber expects.

GETaction=getPricesPrices & stock

Parameters

ParamRequiredDescription
countryoptionalFilter to one country
serviceoptionalFilter to one service
server_idoptionalPrice on this one server only. Omit for the best price across all servers.

Example request

GET https://otpdesk.com/api/handler_api.php?action=getPrices&country=India&service=Telegram
X-API-Key: <your-api-key>

Quoted prices are what getNumber will actually deduct, discounts included. Narrow with country and service — the unfiltered catalog is large.

GETaction=getTopCountriesByServiceBest countries for a service

Parameters

ParamRequiredDescription
servicerequiredService name, e.g. Telegram
server_idoptionalRank one server only. Omit for all servers.
limitoptionalHow many countries (1–200, default 50)

Example request

GET https://otpdesk.com/api/handler_api.php?action=getTopCountriesByService&service=Telegram&limit=10
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": {
    "service": "Telegram",
    "countries": [
      { "rank": 1, "country": "India", "flag": "...", "count": 4210, "price": 0.35, "retail_price": 0.4, "server_id": 2 }
    ],
    "total": 1
  }
}

Ranked by recent successful deliveries, then numbers in stock, then price. count = numbers in stock, price = what getNumber charges you, retail_price = price before your discounts.

GETaction=getTopServicesByCountryMost popular services

Parameters

ParamRequiredDescription
countryoptionalOne country. Omit for the top services across all countries.
server_idoptionalRank one server only.
limitoptionalHow many services (1–200, default 50)

Example request

GET https://otpdesk.com/api/handler_api.php?action=getTopServicesByCountry&country=India&limit=10
X-API-Key: <your-api-key>

Same fields as getTopCountriesByService, with service and logo instead of country and flag.

GETaction=getServersDiscover valid server IDs

Takes no parameters.

Example request

GET https://otpdesk.com/api/handler_api.php?action=getServers
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": {
    "servers": [
      { "id": 1, "name": "Server 1" },      { "id": 2, "name": "Server 2" },      { "id": 3, "name": "Server 3" },      { "id": 4, "name": "Server 4" },      { "id": 5, "name": "Server 5" }    ]
  }
}

This is the authoritative source for server_id values. Fetch it at startup instead of hardcoding IDs.

GETaction=getOrdersYour order history

Parameters

ParamRequiredDescription
limitoptionalHow many orders to return. Default 50, maximum 200.
offsetoptionalHow many to skip, for paging. Default 0.

Example request

GET https://otpdesk.com/api/handler_api.php?action=getOrders&limit=50&offset=0
X-API-Key: <your-api-key>

Newest first. Each order carries the server_id it was fulfilled from.

Digital Store API

Buy digital products (subscriptions, gift cards, licence keys) from your own app with the same API key. Endpoint: https://otpdesk.com/api/digital.php. Prices are in your wallet currency and already include any digital-products coupon you have claimed. Same response envelope as above.

GETaction=productsProducts and your price

Takes no parameters.

Example request

GET https://otpdesk.com/api/digital.php?action=products
X-API-Key: <your-api-key>

Returns

{
  "success": true,
  "message": "ok",
  "data": {
    "currency": "USD",
    "products": [{
      "id": 12, "title": "Netflix 1 Month", "category": "Netflix",
      "price": "4.500000", "normal_price": "5.000000", "coupon_applied": true,
      "duration_days": 30, "warranty": "30 days", "description": null,
      "requires_email": false, "in_stock": true, "stock_label": "In stock: 8", "max_qty": 8
    }]
  }
}
POSTaction=buyPlace an order

Parameters

ParamRequiredDescription
product_idrequiredThe id from products.
quantityoptionalDefault 1, at most the product's max_qty.
request_tokenrequired32-64 lowercase hex characters, new for every order. Resending the same token returns the same order and never charges twice.
emailoptionalRequired when the product has requires_email: true.
quoteoptionalThe total you expect to pay (price × quantity). If the price changed, the order is refused with PRICE_CHANGED. Leave it out to accept the current price.

Example request

POST https://otpdesk.com/api/digital.php
X-API-Key: <your-api-key>
Content-Type: application/x-www-form-urlencoded

action=buy&product_id=12&quantity=1&quote=4.500000&request_token=9f2c4a1e7b3d4c5e8f6a0b1c2d3e4f5a

Returns

{
  "success": true,
  "message": "Order complete. Your codes are in My orders and were emailed to you.",
  "data": {
    "id": 345, "product_id": 12, "product_title": "Netflix 1 Month", "quantity": 1,
    "charge": "4.500000", "currency": "USD", "status": "Completed",
    "created_at": "2026-11-25 10:00:00", "message": "Order complete. ...",
    "codes": ["XXXX-XXXX-XXXX"]
  }
}

status is Completed (codes included), Failed (out of stock, wallet refunded) or Review required (being checked, you are never charged twice; poll order). On a network error or RETRY_SAME, resend with the same request_token.

GETaction=orderOne order and its codes

Parameters

ParamRequiredDescription
idrequiredThe order id returned by buy.

Example request

GET https://otpdesk.com/api/digital.php?action=order&id=345
X-API-Key: <your-api-key>

Same fields as buy. codes is filled only when the order is Completed.

GETaction=ordersYour last 100 orders

Takes no parameters. Newest first, each with its status and codes.

GET https://otpdesk.com/api/digital.php?action=orders
X-API-Key: <your-api-key>

Digital Store error codes: STORE_CLOSED, BAD_PRODUCT, PRICE_CHANGED, ORDER_REJECTED (the message says why), NO_ORDER, RETRY_SAME, plus BAD_KEY, NO_BALANCE and MISSING_PARAMS.

Error Codes

Failed requests return success: false and a stable data.error_code. Branch on the code, never on the human-readable message — that wording can change.

CodeHTTPMeaning
BAD_KEY 401 Invalid or missing API key.
NO_BALANCE 402 Insufficient balance. Please top up your account and try again.
NO_NUMBERS 409 No numbers available for this country and service right now. Please try again shortly.
BAD_SERVICE 404 Unknown service. Check the service name against getServicesList.
BAD_COUNTRY 404 Unknown country. Check the country name against getCountries.
BAD_SERVER 404 Unknown or unavailable server. Check the server id against getServers.
NO_ACTIVATION 404 Activation not found. It may have expired or it does not belong to this account.
ALREADY_FINISHED 409 This activation is already finished and can no longer be changed.
BAD_STATUS 422 Invalid status value for this activation.
BAD_ACTION 422 Unknown action. See the documentation for the list of supported actions.
MISSING_PARAMS 422 One or more required parameters are missing.
RATE_LIMIT 429 Too many requests. Please slow down and try again in a moment.

Good Practice

Requests are rate-limited per account. Poll getStatus a few seconds apart rather than in a tight loop, cancel activations you have abandoned with setStatus (status=8) so you get your money back, and read server_id from getServers at runtime so your integration keeps working when servers are added or retired.

Now on Google Play

Download the OTPDesk app.

Buy numbers, get your OTP codes as notifications and top up your wallet, right from your phone.

Get it on Google PlayFree · sign in with your existing account