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.in/api/stubs/handler_api.php

Code Examples

Ready-to-use examples in popular languages

cURL
curl "https://otpx.in/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.in/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.in/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.in/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.in/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)
operatorstringOperator code (e.g., any)

Example

GET https://otpx.in/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getNumber&service=wa&country=22&operator=any

// 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.in/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.in/api/stubs/handler_api.php?api_key=YOUR_API_KEY&action=setStatus&id=12345&status=8

// Response:
ACCESS_CANCEL

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
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.