Developer Documentation

OTPX API

Integrate SMS verification into your applications with our simple REST API. Get virtual phone numbers and receive OTPs programmatically.

Instant Delivery

OTPs delivered within seconds

150+ Countries

Numbers from worldwide locations

500+ Services

WhatsApp, Telegram, Instagram & more

99.9% Uptime

Enterprise-grade reliability

Quick Start

Get your first OTP in 4 simple steps

1

Get API Key

Sign up and copy your key

2

Check Balance

Verify sufficient funds

3

Get Number

Purchase a virtual number

4

Receive OTP

Poll for incoming SMS

Base URL

https://otpx.org/api/stubs/handler_api.php

Code Examples

Ready-to-use examples in popular languages

cURL
curl "https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getNumber&service=wa&country=22&operator=any"
Python
import requests

API_KEY = "YOUR_API_KEY"
BASE_URL = "https://otpx.org/api/stubs/handler_api.php"

# Get a number for WhatsApp
response = requests.get(BASE_URL, params={
    "api_key": API_KEY,
    "action": "getNumber",
    "service": "wa",
    "country": "22",
    "operator": "any"
})

print(response.text)  # ACCESS_NUMBER:12345:919876543210
JavaScript
const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://otpx.org/api/stubs/handler_api.php";

// Get a number for WhatsApp
const params = new URLSearchParams({
  api_key: API_KEY,
  action: "getNumber",
  service: "wa",
  country: "22",
  operator: "any"
});

const response = await fetch(`${BASE_URL}?${params}`);
const data = await response.text();

console.log(data);  // ACCESS_NUMBER:12345:919876543210
PHP
<?php
$api_key = "YOUR_API_KEY";
$base_url = "https://otpx.org/api/stubs/handler_api.php";

// Get a number for WhatsApp
$params = http_build_query([
    "api_key" => $api_key,
    "action" => "getNumber",
    "service" => "wa",
    "country" => "22",
    "operator" => "any"
]);

$response = file_get_contents("$base_url?$params");
echo $response;  // ACCESS_NUMBER:12345:919876543210

API Endpoints

Complete reference for all available endpoints

GET

Get Balance

Check your current account balance before making purchases

Parameters

NameTypeRequiredDescription
actionstringgetBalance
api_keystringYour API Key

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getBalance

// Response:
ACCESS_BALANCE:150.50
GET

Get Number

Purchase a virtual phone number for SMS verification

Parameters

NameTypeRequiredDescription
actionstringgetNumber
api_keystringYour API Key
servicestringService code (e.g., wa for WhatsApp)
countrynumberCountry code (e.g., 22 for India)
maxPricenumberMaximum price you will pay — providers above it are skipped
providerIdsstringOnly buy from these providers (server IDs), comma-separated, e.g. 1,2,3
operatorstringOne specific server ID, or "any" (default) to pick the cheapest available

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getNumber&service=wa&country=22&maxPrice=30&providerIds=15,16

// Response:
ACCESS_NUMBER:12345:919876543210
GET

Get Status

Check SMS status and retrieve received OTP code

Parameters

NameTypeRequiredDescription
actionstringgetStatus
api_keystringYour API Key
idnumberActivation ID from getNumber

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getStatus&id=12345

// Response:
STATUS_OK:123456
GET

Set Status

Update activation status - cancel, complete, or request new SMS

Parameters

NameTypeRequiredDescription
actionstringsetStatus
api_keystringYour API Key
idnumberActivation ID
statusnumberStatus code: 3 (request new SMS) or 8 (cancel)

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=setStatus&id=12345&status=8

// Response:
ACCESS_CANCEL
GET

Services List

List every active service with its code and name

Parameters

NameTypeRequiredDescription
actionstringgetServicesList
api_keystringYour API Key

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getServicesList

// Response:
{
  "status": "success",
  "services": [
    {
      "code": "wa",
      "name": "WhatsApp"
    },
    {
      "code": "tg",
      "name": "Telegram"
    }
  ]
}
GET

Countries

List active countries — use the key as the country code in getNumber / getPrices

Parameters

NameTypeRequiredDescription
actionstringgetCountries
api_keystringYour API Key

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getCountries

// Response:
{
  "22": {
    "id": 22,
    "eng": "India"
  },
  "6": {
    "id": 6,
    "eng": "Indonesia"
  }
}
GET

Get Prices

Your current price and available numbers per country and service. Both filters are optional.

Parameters

NameTypeRequiredDescription
actionstringgetPrices
api_keystringYour API Key
servicestringService code (optional — default: all services)
countrystringCountry code (optional — default: all countries)

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getPrices&service=wa&country=22

// Response:
{
  "22": {
    "wa": {
      "cost": 8.8,
      "count": 1250
    }
  }
}
GET

Get Prices V2

Every price tier for a service in a country, with the numbers available at each price. Filters are optional.

Parameters

NameTypeRequiredDescription
actionstringgetPricesV2
api_keystringYour API Key
servicestringService code (optional — default: all services)
countrystringCountry code (optional — default: all countries)

Example

GET https://otpx.org/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getPricesV2&service=wa&country=22

// Response:
{
  "22": {
    "wa": {
      "8.80": 1250,
      "27.50": 300,
      "29.61": 0
    }
  }
}

Error Codes

Handle errors gracefully in your integration

CodeSeverityDescription
BAD_KEYerrorInvalid or missing API key
BAD_ACTIONerrorUnknown action parameter
BAD_SERVICEwarningInvalid service code
BAD_COUNTRYwarningInvalid country code
NO_BALANCEerrorInsufficient account balance
NO_NUMBERSwarningNo numbers available for this service
WRONG_MAX_PRICE:$minwarningNo provider at or below maxPrice — $min is the lowest current price
NO_ACTIVATIONerrorInvalid activation ID
ACCOUNT_BANcriticalAccount has been banned

Reference Data

Countries, services, and operators available via API

150+

Countries

Available country codes

500+

Services

Supported platforms

50+

Operators

Network operators

View complete reference data in the Interactive API Docs after logging in.

Ready to Get Started?

Create your free account and get your API key in seconds. No credit card required.

Starting from just ₹2 per OTP. Pay only for what you use.