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 200+ Countries PHP  ·  Python  ·  cURL
https://otpget.com/stubs/handler_api.php
Authentication

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

?api_key=YOUR_API_KEY
SMS OTP API — Endpoints

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

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

Check your account balance in PKR by entering this URL in your browser.

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

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

https://otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getCountries&type=1
PHP
cURL
Python
$apiKey = 'YOUR_KEY';
$url = 'https://otpget.com/stubs/handler_api.php?api_key=' . $apiKey . '&action=getCountries&type=1';
echo file_get_contents($url);
curl "https://otpget.com/stubs/handler_api.php?api_key=YOUR_KEY&action=getCountries&type=1"
import requests
url = "https://otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_KEY", "action": "getCountries", "type": "1"}
print(requests.get(url, params=params).text)
JSON RESPONSE
{
  "1": [{"id": "1", "name": "Russia"}, ...],
  "2": [{"id": "1", "name": "USA"}, ...],
  ...
}
3. Get Services

Get available services for a specific country and provider.

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

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

https://otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=getNumber&service=tg&country=1&type=1
ParameterTypeDescription
servicestringe.g., 'tg', 'wa'
countryintCountry ID from list
typeintProvider (1-4)
PHP
cURL
Python
$apiKey = 'YOUR_KEY';
$url = 'https://otpget.com/stubs/handler_api.php?api_key=' . $apiKey . '&action=getNumber&service=tg&country=1&type=1';
echo file_get_contents($url);
curl "https://otpget.com/stubs/handler_api.php?api_key=YOUR_KEY&action=getNumber&service=tg&country=1&type=1"
import requests
url = "https://otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_KEY", "action": "getNumber", "service": "tg", "country": "1", "type": "1"}
print(requests.get(url, params=params).text)
SUCCESS ACCESS_NUMBER:$order_id:$phone
5. Get Activation Status

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

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

Cancel an activation for a refund or complete a successful one.

https://otpget.com/stubs/handler_api.php?api_key=YOUR_API_KEY&action=setStatus&id=YOUR_ORDER_ID&status=8
PHP
cURL
Python
$apiKey = 'YOUR_KEY';
$url = 'https://otpget.com/stubs/handler_api.php?api_key=' . $apiKey . '&action=setStatus&id=YOUR_ORDER_ID&status=8';
echo file_get_contents($url);
curl "https://otpget.com/stubs/handler_api.php?api_key=YOUR_KEY&action=setStatus&id=YOUR_ORDER_ID&status=8"
import requests
url = "https://otpget.com/stubs/handler_api.php"
params = {"api_key": "YOUR_KEY", "action": "setStatus", "id": "YOUR_ORDER_ID", "status": "8"}
print(requests.get(url, params=params).text)
Status CodeMeaning
3Request another SMS (Retry)
6Complete Activation (Success)
8Cancel and Refund (Only if no SMS received)
Rental Number API — All Endpoints

Base URL: https://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://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://otpget.com/stubs/rental-handler.php?api_key=YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=getRentalCountries&provider=2"
import requests
r = requests.get("https://otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_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://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://otpget.com/stubs/rental-handler.php?api_key=YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=getRentalPricing&country_code=ca&provider=2"
import requests
r = requests.get("https://otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_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 number of available numbers and minimum rental duration.

https://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://otpget.com/stubs/rental-handler.php?api_key=YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=getAvailableRentals&country_code=ca&provider=2"
import requests
r = requests.get("https://otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_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://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://otpget.com/stubs/rental-handler.php?api_key=YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=rentNumber&country_code=ca&provider=2&duration_hours=720"
import requests
r = requests.get("https://otpget.com/stubs/rental-handler.php", params={
  "api_key":"YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getMyRentals
PHP
cURL
Python
$url = 'https://otpget.com/stubs/rental-handler.php?api_key=YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=getMyRentals"
import requests
r = requests.get("https://otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_API_KEY&action=getRentalSMS&order_id=YOUR_ORDER_ID
ParameterRequiredDescription
order_idRequiredThe order_id from rentNumber or getMyRentals
PHP
cURL
Python
$url = 'https://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=getRentalSMS&order_id=YOUR_ORDER_ID';
$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://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=getRentalSMS&order_id=YOUR_ORDER_ID"
import requests
r = requests.get("https://otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_KEY","action":"getRentalSMS","order_id":"YOUR_ORDER_ID"})
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://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://otpget.com/stubs/rental-handler.php?api_key=YOUR_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://otpget.com/stubs/rental-handler.php?api_key=YOUR_KEY&action=renewRental&rental_id=5&duration_hours=720"
import requests
r = requests.get("https://otpget.com/stubs/rental-handler.php", params={"api_key":"YOUR_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":"Rental renewed successfully",
  "rental_id":27,
  "duration_hours":720,
  "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://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://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
PHP
cURL
Python
$apiKey = 'YOUR_KEY';
$url = 'https://otpget.com/stubs/email_handler.php?api_key=' . $apiKey . '&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://otpget.com/stubs/email_handler.php?api_key=YOUR_KEY&action=getEmailServices&domain=gmail.com"
import requests
url = "https://otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_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://otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=buyEmail&service_id=ig&domain=gmail.com
ParameterTypeDescription
service_idstringRequired. Service code from getEmailServices e.g. ig, tg, fb
domainstringOptional. Email domain. Default: gmail.com
PHP
cURL
Python
$apiKey = 'YOUR_KEY';
$url = 'https://otpget.com/stubs/email_handler.php?api_key=' . $apiKey . '&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://otpget.com/stubs/email_handler.php?api_key=YOUR_KEY&action=buyEmail&service_id=ig&domain=gmail.com"
import requests
url = "https://otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_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": "500",
  "message": "Insufficient balance. Need: 120.00"
}
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://otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=getEmailCode&email_id=YOUR_EMAIL_ID
ParameterTypeDescription
email_idstringRequired. The email_id returned from buyEmail
PHP
cURL
Python
$apiKey = 'YOUR_KEY';
$emailId = 'YOUR_EMAIL_ID';
$url = 'https://otpget.com/stubs/email_handler.php?api_key=' . $apiKey . '&action=getEmailCode&email_id=' . $emailId;

// 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://otpget.com/stubs/email_handler.php?api_key=YOUR_KEY&action=getEmailCode&email_id=YOUR_EMAIL_ID"
import requests, time
url = "https://otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_KEY", "action": "getEmailCode", "email_id": "YOUR_EMAIL_ID"}

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)  |  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://otpget.com/stubs/email_handler.php?api_key=YOUR_API_KEY&action=cancelEmail&email_id=YOUR_EMAIL_ID
ParameterTypeDescription
email_idstringRequired. The email_id returned from buyEmail
PHP
cURL
Python
$apiKey = 'YOUR_KEY';
$url = 'https://otpget.com/stubs/email_handler.php?api_key=' . $apiKey . '&action=cancelEmail&email_id=YOUR_EMAIL_ID';
$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://otpget.com/stubs/email_handler.php?api_key=YOUR_KEY&action=cancelEmail&email_id=YOUR_EMAIL_ID"
import requests
url = "https://otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_KEY", "action": "cancelEmail", "email_id": "YOUR_EMAIL_ID"}
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://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
$apiKey = 'YOUR_KEY';
$url = 'https://otpget.com/stubs/email_handler.php?api_key=' . $apiKey . '&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://otpget.com/stubs/email_handler.php?api_key=YOUR_KEY&action=getEmailHistory&page=1"
import requests
url = "https://otpget.com/stubs/email_handler.php"
params = {"api_key": "YOUR_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, waiting for OTP or in use
receivedOTP code was received — code field contains it
cancelledManually cancelled via cancelEmail
Email OTP API — Endpoints

Base URL: https://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 or 4
NO_BALANCEInsufficient wallet balance to buy number
NO_ACTIVATIONOrder ID not found or does not belong to you
NO_NUMBERSProvider has no stock for this service/country
STATUS_CANCELActivation already cancelled (on setStatus call)
STATUS_WAIT_CODESMS not received yet — keep polling getStatus
STATUS_OK:CODESMS received — code is after the colon
ERROR_PRICE_CHANGEProvider price increased above your balance — number auto-cancelled
ERROR_PROVIDER_1..4Upstream provider returned unexpected response
Rental Number API  /stubs/rental-handler.php
statusmessageWhen it happens
401BAD_KEYInvalid API key
403ACCOUNT_BLOCKEDAccount suspended
500country_code and provider requiredMissing required params on getRentalPricing / getAvailableRentals
404No pricing available for this countryNo pricing exists for the given country_code + provider on rentNumber
500NO_BALANCEInsufficient balance to rent number
500Server 1/2 is currently disabledProvider disabled by admin
500Server 1/2 Error: …Upstream rental provider error — message has detail
500Active rental not foundInvalid rental_id on renewRental
500No pricing for this renewal durationDuration not available for that country/provider
500Rental not found or access deniedWrong order_id on getRentalSMS
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
409Code already received — cannot cancelOTP was received; use complete flow instead
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