TM
OTPGet
Developer Portal v1.0

OTPGet API Docs –
SMS OTP, Rental & Email

Buy virtual phone numbers for OTP verification, rent long-term SMS numbers across 200+ countries, and get temporary Gmail addresses — all via one simple REST API.

SMS OTP API Virtual Number Rental Temp Email OTP 50+ Countries PHP  ·  Python  ·  cURL
https://www.otpget.com/stubs/handler_api.php
Authentication

All requests must include your API Key in the query string.

?api_key=YOUR_API_KEY
Response Formats — Know Before You Code

The three APIs use different response formats. Make sure your code handles each correctly.

SMS OTP API
handler_api.php PLAIN TEXT
ACCESS_BALANCE:500.00
ACCESS_NUMBER:abc123:9230012345
STATUS_OK:847293
STATUS_WAIT_CODE
BAD_KEY

Most actions: plain text. Exception: getCountries + getServices return JSON. Use strpos() / explode(":") for plain text.

Rental API
rental-handler.php JSON
{
  "status": "200",
  "message": "...",
  ... data fields
}

Check status === "200" for success. Errors have a message field.

Email OTP API
email_handler.php JSON
{
  "status": "200",
  "message": "...",
  ... data fields
}

Check status === "200" for success. 202 = waiting. 300 = cancelled.

SMS OTP API — Endpoints

Base URL: https://www.otpget.com/stubs/handler_api.php

#ActionKey ParamsDescription
1getBalanceGet wallet balance
2getCountriestypeList countries by provider (1–5)
3getServicescountry, typeList services for a country
4getNumberservice, country, typeBuy a virtual number for OTP
5getStatusidPoll for received SMS code
6setStatusid, statusComplete (3 or 6 — needs OTP) or cancel & refund (8 — after 2 min, no OTP)
1. Get Balance

Check your account balance in PKR. Returns plain text: ACCESS_BALANCE:500.00

https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getBalance
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getBalance';
echo file_get_contents($url);
curl "https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getBalance"
import requests
url = "https://www.otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_API_KEY", "action": "getBalance"}
print(requests.get(url, params=params).text)
PLAIN TEXT RESPONSE
ACCESS_BALANCE:500.00
2. Get Countries

List all available countries. You can filter by provider type (1, 2, 3, 4, or 5).

https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getCountries&type=1
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getCountries&type=1';
echo file_get_contents($url);
curl "https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getCountries&type=1"
import requests
url = "https://www.otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_API_KEY", "action": "getCountries", "type": "1"}
print(requests.get(url, params=params).text)
JSON RESPONSE
{
  "1": [
    {"id": "33", "name": "Canada"},
    {"id": "15", "name": "England"},
    {"id": "21", "name": "India"},
    {"id": "6", "name": "Indonesia"},
    {"id": "61", "name": "Pakistan"},
    {"id": "5", "name": "Philippines"},
    {"id": "12", "name": "USA"},
    {"id": "10", "name": "Vietnam"},
    ... 30+ more countries
  ],
  "2": [ ... Provider 2 countries ... ],
  "3": [ ... Provider 3 countries ... ],
  "4": [ ... Provider 4 countries ... ]
}
3. Get Services

Get available services for a specific country and provider.

https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getServices&country=61&type=1
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getServices&country=61&type=1';
echo file_get_contents($url);
curl "https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getServices&country=61&type=1"
import requests
url = "https://www.otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_API_KEY", "action": "getServices", "country": "61", "type": "1"}
print(requests.get(url, params=params).text)
JSON RESPONSE
{
  "101": "Telegram - 45 PKR",
  "102": "WhatsApp - 60 PKR",
  "103": "Instagram - 55 PKR"
}
4. Request Number

Order a new phone number to receive SMS. This will deduct PKR from your balance.

https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getNumber&service=101&country=61&type=1
ParameterTypeDescription
servicestringNumeric DB ID from getServices e.g. 101, 102
countryintCountry ID from getCountries — e.g. 61 (Pakistan), 12 (USA), 21 (India)
typeintProvider (1–5)
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getNumber&service=101&country=61&type=1';
echo file_get_contents($url);
curl "https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getNumber&service=101&country=61&type=1"
import requests
url = "https://www.otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_API_KEY", "action": "getNumber", "service": "101", "country": "61", "type": "1"}
print(requests.get(url, params=params).text)
PLAIN TEXT — SUCCESS ACCESS_NUMBER:order_id:phone_number
5. Get Activation Status

Check if an SMS has been received for an order ID.

https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getStatus&id=abc123xyz
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getStatus&id=abc123xyz';
echo file_get_contents($url);
curl "https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getStatus&id=abc123xyz"
import requests
url = "https://www.otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_API_KEY", "action": "getStatus", "id": "abc123xyz"}
print(requests.get(url, params=params).text)
WAITING STATUS_WAIT_CODE
RECEIVED STATUS_OK:$code
6. Set Activation Status

Complete a successful activation (status 3 or 6 — OTP must already be received), or cancel for a refund (status 8 — only after 2 minutes, no OTP received).

https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=setStatus&id=abc123xyz&status=8
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=setStatus&id=abc123xyz&status=8';
echo file_get_contents($url);
curl "https://www.otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=setStatus&id=abc123xyz&status=8"
import requests
url = "https://www.otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_API_KEY", "action": "setStatus", "id": "abc123xyz", "status": "8"}
print(requests.get(url, params=params).text)
Status CodeMeaning
3Complete Activation (Success — OTP must already be received)
6Complete Activation (Success — OTP must already be received)
8Cancel and Refund — only allowed after 2 minutes from purchase, and only if no SMS received yet
COMPLETE (3 or 6)
ACCESS_FINISH
CANCEL & REFUND (8)
ACCESS_READY

Balance refunded

BLOCKED
EARLY_CANCEL_DENIED
NO_SMS_RECEIVED
STATUS_ALREADY_CHANGED
Rental Number API — All Endpoints

Base URL: https://www.otpget.com/stubs/rental-handler.php

#ActionRequired ParamsDescription
1getRentalCountries (optional: provider)List all countries available for rental
2getRentalPricingcountry_code, providerGet pricing tiers for a country
3getAvailableRentalscountry_code, providerLive stock availability check
4rentNumbercountry_code, provider, duration_hoursBuy a rental number
5getMyRentalsList all your rentals
6getRentalSMSorder_idFetch SMS messages on a rented number
7renewRentalrental_id, duration_hoursExtend rental period
Provider values:  provider=1 = Server 1  |  provider=2 = Server 2
duration_hours values: 12 = 12 Hours  ·  24 = 1 Day  ·  168 = 1 Week  ·  720 = 1 Month  ·  4320 = 6 Months  ·  8640 = 12 Months
1. Get Rental Countries

List all countries available for rental. Filter by provider or omit to get all servers.

https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalCountries&provider=2
ParameterRequiredDescription
providerOptional1 = Server 1  |  2 = Server 2. Omit to get both.
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalCountries&provider=2';
$data = json_decode(file_get_contents($url), true);
foreach($data['countries'] as $c) {
  echo $c['name'] . ' (' . $c['country_code'] . ')' . PHP_EOL;
}
curl "https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalCountries&provider=2"
import requests
r = requests.get("https://www.otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_API_KEY","action":"getRentalCountries","provider":"2"})
for c in r.json()['countries']:
  print(c['name'], c['country_code'])
JSON RESPONSE
{"status":"200","countries":[
  {"id":"1","provider":"2","name":"Canada","country_code":"ca"},
  {"id":"2","provider":"2","name":"UNITED KINGDOM","country_code":"gb"},
  {"id":"6","provider":"2","name":"United States of America","country_code":"us"}
]}
2. Get Rental Pricing

Get all available pricing tiers for a country. Use duration_hours from this response when buying or renewing.

https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalPricing&country_code=ca&provider=2
ParameterRequiredDescription
country_codeRequiredCountry code from getRentalCountries e.g. ca, us
providerRequired1 = Server 1  |  2 = Server 2
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalPricing&country_code=ca&provider=2';
$data = json_decode(file_get_contents($url), true);
foreach($data['pricing'] as $p) {
  echo $p['duration_hours'] . 'h — ' . $p['price'] . ' PKR' . PHP_EOL;
}
curl "https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalPricing&country_code=ca&provider=2"
import requests
r = requests.get("https://www.otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_API_KEY","action":"getRentalPricing","country_code":"ca","provider":"2"})
for p in r.json()['pricing']:
  print(p['duration_hours']+'h —', p['price'], 'PKR')
JSON RESPONSE
{"status":"200","pricing":[
  {"id":"1","duration_hours":"720","duration_preset":"oneMonth","price":"840.00","country_name":"Canada"},
  {"id":"2","duration_hours":"4320","duration_preset":"sixMonths","price":"5040.00","country_name":"Canada"},
  {"id":"3","duration_hours":"8640","duration_preset":"twelveMonths","price":"10080.00","country_name":"Canada"}
]}
3. Check Availability

Check live stock availability for a country before buying. Returns available numbers. Note: Server 2 includes a min_month field — minimum required rental duration in months.

https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getAvailableRentals&country_code=ca&provider=2
ParameterRequiredDescription
country_codeRequirede.g. ca, us, gb
providerRequired1 = Server 1  |  2 = Server 2
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getAvailableRentals&country_code=ca&provider=2';
$data = json_decode(file_get_contents($url), true);
foreach($data['available'] as $a) {
  echo $a['area_title'] . ': ' . $a['available'] . ' numbers available' . PHP_EOL;
}
curl "https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getAvailableRentals&country_code=ca&provider=2"
import requests
r = requests.get("https://www.otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_API_KEY","action":"getAvailableRentals","country_code":"ca","provider":"2"})
for a in r.json()['available']:
  print(a['area_title'], a['available'], 'available')
JSON RESPONSE
{"status":"200","country_code":"ca","provider":"2","available":[
  {"area_code":"ca","area_title":"Canada","unit_price":200,"available":3338,"min_month":1}
]}
4. Rent a Number

Purchase a phone number for rental. All three parameters are required. Check getRentalPricing first to confirm valid duration_hours values for your country.

https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=rentNumber&country_code=ca&provider=2&duration_hours=720
ParameterRequiredDescription
country_codeRequiredCountry code e.g. ca, us, gb
providerRequired1 = Server 1  |  2 = Server 2
duration_hoursRequiredRental duration: 12, 24, 168, 720, 4320, 8640
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=rentNumber&country_code=ca&provider=2&duration_hours=720';
$data = json_decode(file_get_contents($url), true);
if($data['status'] == '200') {
  echo 'Phone: ' . $data['phone'] . PHP_EOL;
  echo 'Order ID: ' . $data['order_id'] . PHP_EOL;
  echo 'Expires: ' . $data['expires'] . PHP_EOL;
  echo 'Balance: ' . $data['new_balance'] . ' PKR' . PHP_EOL;
}
curl "https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=rentNumber&country_code=ca&provider=2&duration_hours=720"
import requests
r = requests.get("https://www.otpget.com/stubs/rental-handler.php", params={
  "api_key":"YOUR_API_KEY","action":"rentNumber",
  "country_code":"ca","provider":"2","duration_hours":"720"
})
d = r.json()
if d['status'] == '200':
  print('Phone:', d['phone'], '| Expires:', d['expires'])
SUCCESS RESPONSE
{"status":"200","message":"Number rented successfully",
  "phone":"3434337545","order_id":"2673093356180000583",
  "server":"Server 2","duration_hours":720,
  "price_paid":"840.00","new_balance":"4220.00",
  "expires":"2026-04-09 21:55:55"}
Tip: Save order_id to fetch SMS later. Save id from getMyRentals to renew.
5. Get My Rentals

List all your rented numbers — active and expired. Use order_id to fetch SMS. Use id to renew.

https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getMyRentals
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getMyRentals';
$data = json_decode(file_get_contents($url), true);
foreach($data['rentals'] as $r) {
  echo $r['phone_number'] . ' | ' . $r['status'] . ' | expires: ' . $r['expiry_time'] . PHP_EOL;
  // use $r['id'] for renewRental
  // use $r['order_id'] for getRentalSMS
}
curl "https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getMyRentals"
import requests
r = requests.get("https://www.otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_API_KEY","action":"getMyRentals"})
for rental in r.json()['rentals']:
  print(rental['phone_number'], rental['status'], rental['expiry_time'])
JSON RESPONSE
{"status":"200","total":5,"rentals":[{
  "id":"27",
  "server":"Server 2",
  "phone_number":"3434337545",
  "order_id":"2673093356180000583",
  "status":"active",
  "country_code":"ca",
  "country_name":"Canada",
  "duration_hours":"720",
  "price_paid":"840.00",
  "expiry_time":"2026-04-09 21:55:55"
}]}
6. Get Rental SMS

Fetch all SMS messages received on a rented number. Use order_id from rentNumber or getMyRentals.

https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalSMS&order_id=2673093356180000583
ParameterRequiredDescription
order_idRequiredThe order_id from rentNumber or getMyRentals
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalSMS&order_id=2673093356180000583';
$data = json_decode(file_get_contents($url), true);
foreach($data['messages'] as $msg) {
  echo 'From: ' . $msg['from'] . PHP_EOL;
  echo 'Code: ' . $msg['code'] . PHP_EOL;
  echo 'Text: ' . $msg['text'] . PHP_EOL;
}
curl "https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalSMS&order_id=2673093356180000583"
import requests
r = requests.get("https://www.otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_API_KEY","action":"getRentalSMS","order_id":"2673093356180000583"})
for msg in r.json()['messages']:
  print('Code:', msg['code'], '| Text:', msg['text'])
JSON RESPONSE
{"status":"200","phone_number":"5812822291","order_id":"2673088748180000583","total":1,"messages":[{
  "from":"Server 2",
  "text":"<#> Your WhatsApp Business code 740-279",
  "code":""
  "timestamp":"2026-03-09T20:57:32Z"
}]}
7. Renew Rental

Extend the rental period on an active number. Use id from getMyRentals as rental_id. The new expiry is calculated from the current expiry time (not today).

https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=renewRental&rental_id=5&duration_hours=720
ParameterRequiredDescription
rental_idRequiredThe id field from getMyRentals
duration_hoursRequiredExtension duration: 12, 24, 168, 720, 4320, 8640
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=renewRental&rental_id=5&duration_hours=720';
$data = json_decode(file_get_contents($url), true);
if($data['status'] == '200') {
  echo 'New expiry: ' . $data['new_expiry'] . PHP_EOL;
  echo 'New balance: ' . $data['new_balance'] . ' PKR' . PHP_EOL;
}
curl "https://www.otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=renewRental&rental_id=5&duration_hours=720"
import requests
r = requests.get("https://www.otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_API_KEY","action":"renewRental","rental_id":"5","duration_hours":"720"})
d = r.json()
if d['status'] == '200':
  print('New expiry:', d['new_expiry'], '| Balance:', d['new_balance'])
SUCCESS RESPONSE
{"status":"200","message":"Renewed successfully",
  "rental_id":27,
  "phone_number":"3434337545",
  "duration_hours":720,
  "price_paid":"840.00",
  "new_balance":"3440.00","new_expiry":"2026-05-09 21:55:55"}
Email Services
Temporary Gmail / Email OTP API

Buy temporary email addresses from services like Gmail, Telegram, Instagram and 60+ others. All email endpoints use the same base URL below.

https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=ACTION_NAME
13. Get Email Services

Returns all available email services with their names, prices (in your account currency), and current stock count. Optionally filter by domain.

https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailServices&domain=gmail.com
ParameterTypeDescription
domainstringOptional. Email domain to filter. Default: gmail.com
Options: gmail.com · mailnestpro.com · hihinail.com · flytempbox.com · mailburstx.com (contact admin for full list)
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailServices&domain=gmail.com';
$response = file_get_contents($url);
$data = json_decode($response, true);
foreach($data['services'] as $svc) {
  echo $svc['service_name'] . ' — ' . $svc['price'] . ' (stock: ' . $svc['count'] . ')' . PHP_EOL;
}
curl "https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailServices&domain=gmail.com"
import requests
url = "https://www.otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_API_KEY", "action": "getEmailServices", "domain": "gmail.com"}
data = requests.get(url, params=params).json()
for svc in data['services']:
  print(svc['service_name'], '-', svc['price'])
JSON RESPONSE
{
  "status": "200",
  "count": 65,
  "services": [
    {"service_code": "ig", "service_name": "Instagram", "price": 120.00, "count": 48},
    {"service_code": "tg", "service_name": "Telegram", "price": 95.00, "count": 120},
    {"service_code": "fb", "service_name": "Facebook", "price": 110.00, "count": 60},
    ...
  ]
}
14. Buy Email

Purchase a temporary email address for a specific service. The price is deducted from your wallet. Returns the email_id and the actual email address to use.

https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=buyEmail&service_id=ig&domain=gmail.com
ParameterTypeDescription
service_idstringRequired. The service_code field from getEmailServices e.g. ig, tg, fb
domainstringOptional. Email domain. Default: gmail.com
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=buyEmail&service_id=ig&domain=gmail.com';
$data = json_decode(file_get_contents($url), true);
if($data['status'] == '200') {
  echo 'Email: ' . $data['email'] . PHP_EOL;
  echo 'Email ID: ' . $data['email_id'] . PHP_EOL;
  echo 'Price: ' . $data['price'] . ' | New Balance: ' . $data['balance'];
}
curl "https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=buyEmail&service_id=ig&domain=gmail.com"
import requests
url = "https://www.otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_API_KEY", "action": "buyEmail", "service_id": "ig", "domain": "gmail.com"}
data = requests.get(url, params=params).json()
if data['status'] == '200':
  print('Email:', data['email'])
  print('Email ID:', data['email_id'])
SUCCESS RESPONSE
{
  "status": "200",
  "message": "Email activated successfully",
  "email_id": "7291834",
  "email": "temp.abc123@gmail.com",
  "service": "Instagram",
  "domain": "gmail.com",
  "price": 120.00,
  "balance": 4880.00
}
ERROR RESPONSE
{
  "status": "402",
  "message": "Insufficient balance. Need: 120.00 — Have: 80.50"
}
15. Get Email Code (OTP)

Poll this endpoint after buying an email to retrieve the verification code / OTP that arrives in the inbox. Call every 5–10 seconds until a code is received.

https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailCode&email_id=7291834
ParameterTypeDescription
email_idstringRequired. The email_id returned from buyEmail
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailCode&email_id=7291834';

// Poll every 5 seconds for up to 2 minutes
for($i = 0; $i < 24; $i++) {
  $data = json_decode(file_get_contents($url), true);
  if($data['status'] == '200' && !empty($data['messages'])) {
    echo 'OTP: ' . $data['messages'][0]['code'];
    break;
  }
  sleep(5);
}
curl "https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailCode&email_id=7291834"
import requests, time
url = "https://www.otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_API_KEY", "action": "getEmailCode", "email_id": "7291834"}

for _ in range(24): # poll for 2 minutes
  data = requests.get(url, params=params).json()
  if data['status'] == '200' and data.get('messages'):
    print('OTP:', data['messages'][0]['code'])
    break
  time.sleep(5)
SUCCESS RESPONSE (Code Received)
{
  "status": "200",
  "email_id": "7291834",
  "messages": [
    {
      "email": "temp.abc123@gmail.com",
      "subject": "Verification Code",
      "body": "Your verification code is 847293",
      "code": "847293"
    }
  ]
}
Status codes:  200 Code received  |  202 Still waiting — keep polling every 5–10s  |  300 Cancelled
16. Cancel Email

Cancel an email activation. Behavior depends on whether an OTP was already received:

SituationResult
OTP already received Order marked complete — OTP code returned. No refund (job was done).
Still waiting for OTP Activation cancelled on provider + full refund to your wallet.
Already cancelled Returns success (safe to call multiple times).
https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=cancelEmail&email_id=7291834
ParameterTypeDescription
email_idstringRequired. The email_id returned from buyEmail
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=cancelEmail&email_id=7291834';
$data = json_decode(file_get_contents($url), true);
if ($data['status'] == '200') {
  echo $data['message'] . PHP_EOL;
  if (isset($data['code'])) echo 'OTP Code: ' . $data['code'] . PHP_EOL;
  if (isset($data['refunded'])) echo 'Refunded: ' . $data['refunded'] . PHP_EOL;
  if (isset($data['balance'])) echo 'New Balance: ' . $data['balance'] . PHP_EOL;
}
curl "https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=cancelEmail&email_id=7291834"
import requests
url = "https://www.otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_API_KEY", "action": "cancelEmail", "email_id": "7291834"}
data = requests.get(url, params=params).json()
print(data['message'])
if 'code' in data: print('OTP Code:', data['code'])
if 'refunded' in data: print('Refunded:', data['refunded'], '| Balance:', data['balance'])
OTP ALREADY RECEIVED
{
  "status": "200",
  "message": "Order completed - OTP was already received",
  "code": "847293",
  "email": "temp.abc@gmail.com"
}
CANCELLED + REFUNDED
{
  "status": "200",
  "message": "Cancelled and refunded",
  "refunded": 120.00,
  "balance": 5120.00
}
17. Get Email History

Retrieve your past email purchases with their status, service used, domain, price and timestamp. Supports pagination.

https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailHistory&page=1
ParameterTypeDescription
pageintOptional. Page number for pagination. Default: 1. Returns 20 records per page.
PHP
cURL
Python
$url = 'https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailHistory&page=1';
$data = json_decode(file_get_contents($url), true);
echo 'Total orders: ' . $data['total'] . PHP_EOL;
foreach($data['history'] as $h) {
  echo $h['email_address'] . ' | ' . $h['service_id'] . ' | ' . $h['status'] . PHP_EOL;
}
curl "https://www.otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailHistory&page=1"
import requests
url = "https://www.otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_API_KEY", "action": "getEmailHistory", "page": "1"}
data = requests.get(url, params=params).json()
print('Total:', data['total'])
for h in data['history']:
  print(h['email_address'], '|', h['service_id'], '|', h['status'])
JSON RESPONSE
{
  "status": "200",
  "total": 42,
  "page": 1,
  "history": [
    {
      "email_id": "7291834",
      "email_address": "temp.abc123@gmail.com",
      "service_id": "ig",
      "service_name": "Instagram",
      "domain": "gmail.com",
      "status": "active",
      "code": "",
      "price": 120.00,
      "created_at": "2026-03-09 14:22:00"
    }
  ]
}
Status ValueMeaning
activeEmail is active, still waiting for OTP
receivedOTP code was received — code field contains it
cancelledManually cancelled via cancelEmail
Email OTP API — Endpoints

Base URL: https://www.otpget.com/stubs/email_handler.php

#ActionKey ParamsDescription
13getEmailServicesdomainList services + prices + stock
14buyEmailservice_id, domainBuy temp email — returns email_id
15getEmailCodeemail_idPoll for OTP (200=got it, 202=waiting, 300=cancelled)
16cancelEmailemail_idCancel & refund if no OTP yet; complete if OTP received
17getEmailHistorypagePaginated purchase history
getBalanceWallet balance (works on both APIs)

Error Codes

All three APIs (SMS OTP, Rental, Email) return consistent JSON error responses. Use the status field to detect errors programmatically.

  {
    "status": "401",
    "message": "BAD_KEY"
  }
SMS OTP API  /stubs/handler_api.php
ResponseHTTPWhen it happens
BAD_KEYAPI key missing, invalid or belongs to blocked account
ACCOUNT_BLOCKEDYour account has been suspended by admin
BAD_ACTIONUnknown action parameter sent
BAD_SERVICEService code not found for given country/type
BAD_COUNTRYCountry ID not found or missing
BAD_TYPEProvider type must be 1, 2, 3, 4 or 5
BAD_IDOrder ID parameter missing on getStatus / setStatus
BAD_STATUSStatus value not 3, 6 or 8 on setStatus
NO_BALANCEInsufficient wallet balance to buy number
NO_ACTIVATIONOrder ID not found or does not belong to you
STATUS_WAIT_CODESMS not received yet — keep polling getStatus
STATUS_OK:CODESMS received — code is after the colon
STATUS_CANCELActivation was cancelled — no SMS available
STATUS_ALREADY_CHANGEDsetStatus already called before for this order — cannot change again
EARLY_CANCEL_DENIEDCancel attempted within first 2 minutes of purchase — wait and retry
NO_SMS_RECEIVEDTried to complete (status 3/6) but no OTP received yet
ERROR_PRICE_CHANGEProvider price increased above your balance — number auto-cancelled, no charge
NO_BALANCE_FOR_NEW_PRICE:XProvider quoted a higher price than your balance — number cancelled automatically
ERROR_PROVIDER_1..5Upstream provider returned unexpected response — raw provider response appended after colon
Rental Number API  /stubs/rental-handler.php
statusmessageWhen it happens
401Invalid API key.Invalid API key
401API key is required.Empty api_key param
403Account is blocked or inactive.Account suspended
400Action parameter is required.Missing action param
400Unknown action: …Unrecognized action value
400country_code is required. / provider is required.Missing required params on getRentalPricing / getAvailableRentals
400duration_hours is required.Missing duration_hours on rentNumber
400Server 2 only supports monthly durations…Server 2 only accepts 720, 4320, 8640 as duration
404No pricing found for country_code=… provider=… duration_hours=…No pricing exists for the given combination on rentNumber
404Rental not found or does not belong to you.Invalid rental_id on renewRental
404No pricing found for this duration.Duration not available for that country/provider on renewRental
404Order not found or access denied.Wrong order_id on getRentalSMS
402Insufficient balance.Wallet balance too low to rent or renew
503Server 1/2 is currently unavailable/disabled.Provider disabled by admin
502Server 1/2 error: …Upstream rental provider returned an error — message has detail
502Provider returned an empty phone number.Provider gave success response but no phone number — try again
500Database error: …DB transaction failed — balance was not deducted
Email OTP API  /stubs/email_handler.php
statusmessageWhen it happens
401BAD_KEYInvalid or missing API key
403ACCOUNT_BLOCKEDAccount suspended by admin
400BAD_ACTIONUnknown action value
400service_id is requiredMissing service_id on buyEmail
400email_id is requiredMissing email_id on getEmailCode / cancelEmail
402Insufficient balance. Need: X — Have: YBalance too low to buy email
404Service not available for this domainService/domain combo not offered by provider
404No stock available for this serviceProvider has 0 emails left for this service
404Email activation not foundWrong email_id or belongs to another user
500API connection errorCannot reach mail API
500No email available: …Api returned error on purchase
500Database error. Email cancelled.DB failed after API success — email auto-cancelled
503Email service not configuredAdmin has not set the mail API key
503Email service is currently disabledAdmin disabled email service temporarily
200Success on all actions
202Waiting for code...getEmailCode: OTP not arrived yet — keep polling
300Cancelled / Cancelled by providergetEmailCode / cancelEmail: activation was cancelled