Compatible API Simple GET requests · Plain text responses
The compatible API lets you integrate VaraSMS virtual numbers into any platform using simple GET requests.
https://api.varasms.com/s1/Append
?api_key=YOUR_KEY to every request.Quick Start
Register at dashboard.varasms.com and copy your API key.
Send a simple GET request with your API key as a query parameter.
Responses are plain text strings. Use string functions to extract data.
$res = file_get_contents("https://api.varasms.com/s1/?action=getBalance&api_key=YOUR_KEY");
// Returns: "ACCESS_BALANCE:2347.22"
$balance = explode(":", $res)[1];Authentication
Pass your API key as a query parameter on every request. No headers needed.
?action=getBalance&api_key=YOUR_KEYResponse Strings
Get Balance
Returns your current wallet balance.
ACCESS_BALANCE:2347.22$res = file_get_contents("https://api.varasms.com/s1/?action=getBalance&api_key=YOUR_KEY");
$balance = explode(":", $res)[1]; // "2347.22"const res = await fetch("https://api.varasms.com/s1/?action=getBalance&api_key=YOUR_KEY").then(r=>r.text());
const balance = res.split(":")[1];import requests
res = requests.get("https://api.varasms.com/s1/?action=getBalance&api_key=YOUR_KEY").text
balance = res.split(":")[1]Get Countries
Returns all available countries. Use the numeric index as country parameter when buying.
{"0":{"name":"Russia","iso":"ru"},"1":{"name":"Ukraine","iso":"ua"},"2":{"name":"Nigeria","iso":"ng"}}Get Services
Returns available services for a country with prices and stock count.
| Param | Type | Description | |
|---|---|---|---|
| country | integer | required | Country index from getCountries |
{"vk":{"name":"VKontakte","cost":"150.00","count":832},"google":{"name":"Google","cost":"200.00","count":421}}Buy Number
Purchase a virtual number. Save the activation ID for checking OTP and setting status.
| Param | Type | Description | |
|---|---|---|---|
| service | string | required | Service code (e.g. vk, google, wa) |
| country | integer | required | Country index from getCountries |
ACCESS_NUMBER:12345678:79001234567
# ACCESS_NUMBER:ACTIVATION_ID:PHONENO_BALANCE # insufficient funds
NO_NUMBERS # no stock
BAD_KEY # invalid API key$res = file_get_contents("https://api.varasms.com/s1/?action=getNumber&api_key=YOUR_KEY&service=vk&country=0");
if (strpos($res, "ACCESS_NUMBER") === 0) {
[, $id, $phone] = explode(":", $res);
echo "Phone: +$phone | ID: $id\n";
}const res = await fetch("https://api.varasms.com/s1/?action=getNumber&api_key=YOUR_KEY&service=vk&country=0").then(r=>r.text());
if (res.startsWith("ACCESS_NUMBER")) {
const [, id, phone] = res.split(":");
console.log("Phone:", phone, "ID:", id);
}import requests
res = requests.get("https://api.varasms.com/s1/?action=getNumber&api_key=YOUR_KEY&service=vk&country=0").text
if res.startswith("ACCESS_NUMBER"):
_, act_id, phone = res.split(":")
print(f"Phone: +{phone} | ID: {act_id}")Check OTP
Poll every 5 seconds after buying. Stop when STATUS_OK or ACCESS_CANCEL is returned.
| Param | Type | Description | |
|---|---|---|---|
| id | string | required | Activation ID from getNumber |
STATUS_WAIT_CODE # waiting — keep polling every 5s
STATUS_OK:483920 # OTP received — code is 483920
ACCESS_CANCEL # number cancelled or expiredfor ($i = 0; $i < 20; $i++) {
sleep(5);
$res = file_get_contents("https://api.varasms.com/s1/?action=getStatus&api_key=YOUR_KEY&id=$id");
if (strpos($res, "STATUS_OK") === 0) { $otp = explode("STATUS_OK:", $res)[1]; echo "OTP: $otp\n"; break; }
if ($res === "ACCESS_CANCEL") { echo "Expired\n"; break; }
}const sleep = ms => new Promise(r => setTimeout(r, ms));
for (let i = 0; i < 20; i++) {
await sleep(5000);
const res = await fetch("https://api.varasms.com/s1/?action=getStatus&api_key=YOUR_KEY&id=" + id).then(r=>r.text());
if (res.startsWith("STATUS_OK")) { console.log("OTP:", res.split("STATUS_OK:")[1]); break; }
if (res === "ACCESS_CANCEL") { console.log("Expired"); break; }
}import requests, time
for _ in range(20):
time.sleep(5)
res = requests.get("https://api.varasms.com/s1/?action=getStatus&api_key=YOUR_KEY&id=" + act_id).text
if res.startswith("STATUS_OK"): print("OTP:", res.split("STATUS_OK:")[1]); break
if res == "ACCESS_CANCEL": print("Expired"); breakSet Status
Update the activation status.
| Param | Type | Description | |
|---|---|---|---|
| id | string | required | Activation ID |
| status | integer | required | 3 = request another SMS · 6 = confirm done · 8 = cancel & refund |
ACCESS_CANCEL # cancelled + refunded (status=8)
ACCESS_RETRY_GET # another SMS requested (status=3)
ACCESS_ACTIVATION # confirmed done (status=6)Full Flow Example
<?php
define("KEY", "YOUR_API_KEY");
define("BASE", "https://api.varasms.com/s1/");
function s1($p){ return file_get_contents(BASE."?".http_build_query(array_merge($p,["api_key"=>KEY]))); }
$buy = s1(["action"=>"getNumber","service"=>"vk","country"=>"0"]);
if (strpos($buy,"ACCESS_NUMBER") !== 0) die("Buy failed: $buy");
[,$id,$phone] = explode(":",$buy);
echo "Phone: +$phone\n";
$otp = null;
for($i=0;$i<20;$i++){
sleep(5);
$s = s1(["action"=>"getStatus","id"=>$id]);
if(strpos($s,"STATUS_OK")===0){ $otp=explode("STATUS_OK:",$s)[1]; echo "OTP: $otp\n"; break; }
if($s==="ACCESS_CANCEL"){ echo "Expired\n"; break; }
}
s1(["action"=>"setStatus","id"=>$id,"status"=>$otp?"6":"8"]);const KEY="YOUR_API_KEY", BASE="https://api.varasms.com/s1/";
const s1=p=>fetch(BASE+"?"+new URLSearchParams({...p,api_key:KEY})).then(r=>r.text());
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
(async()=>{
const buy=await s1({action:"getNumber",service:"vk",country:"0"});
if(!buy.startsWith("ACCESS_NUMBER")){console.error(buy);return;}
const[,id,phone]=buy.split(":");console.log("Phone:",phone);
let otp=null;
for(let i=0;i<20;i++){
await sleep(5000);
const s=await s1({action:"getStatus",id});
if(s.startsWith("STATUS_OK")){otp=s.split("STATUS_OK:")[1];console.log("OTP:",otp);break;}
if(s==="ACCESS_CANCEL"){console.log("Expired");break;}
}
await s1({action:"setStatus",id,status:otp?"6":"8"});
})();import requests, time
KEY="YOUR_API_KEY"; BASE="https://api.varasms.com/s1/"
def s1(p): return requests.get(BASE,params={**p,"api_key":KEY}).text
buy=s1({"action":"getNumber","service":"vk","country":"0"})
if not buy.startswith("ACCESS_NUMBER"): exit("Buy failed: "+buy)
_,act_id,phone=buy.split(":")
print(f"Phone: +{phone}")
otp=None
for _ in range(20):
time.sleep(5)
s=s1({"action":"getStatus","id":act_id})
if s.startswith("STATUS_OK"): otp=s.split("STATUS_OK:")[1]; print(f"OTP:{otp}"); break
if s=="ACCESS_CANCEL": print("Expired"); break
s1({"action":"setStatus","id":act_id,"status":"6" if otp else "8"})API 2.0 JSON REST API · Full order management · Auto-refund
Full-featured REST API with clean JSON responses, complete order lifecycle, auto-refund on cancel, operator selection and transaction history.
Quick Start
Register at dashboard.varasms.com. Same key works for Compatible API and API 2.0.
GET for data queries. POST for actions (buy, cancel, finish). Always include api_key.
All responses return {"status":"ok",...} or {"status":"error",...}
Authentication
Query Parameter
GET /v1/?action=balance&api_key=YOUR_KEYHTTP Header (recommended)
GET /v1/?action=balance
X-API-Key: YOUR_KEYStatus Codes
Get Balance
{"status":"ok","balance":4500.00,"total_deposited":10000.00,"total_otp":42,"currency":"NGN"}Transaction History
| Param | Type | Description | |
|---|---|---|---|
| limit | integer | optional | 1–100, default 20 |
| page | integer | optional | Page number, default 1 |
{"status":"ok","total":156,"page":1,"limit":20,"transactions":[{"amount":"-150.00","type":"API Number Purchase","txn_id":"API_ABC123","date":"2026-05-12 14:22:00","status":"1"}]}Get Countries
Use country_key when buying numbers.
{"status":"ok","count":153,"countries":[{"country_key":"usa","country_name":"United States","iso":"US","prefix":"+1"},{"country_key":"russia","country_name":"Russia","iso":"RU","prefix":"+7"}]}Get Services
| Param | Type | Description | |
|---|---|---|---|
| country | string | required | Country key from /countries |
{"status":"ok","country":"usa","count":388,"services":[{"service_code":"tinder","service_name":"Tinder","price":96.98,"currency":"NGN","available":3488},{"service_code":"whatsapp","service_name":"WhatsApp","price":86.40,"currency":"NGN","available":43200}]}Get Operators NEW
Returns all operators for a service sorted by success rate descending. Pass the operator to the buy endpoint for better results.
| Param | Type | Description | |
|---|---|---|---|
| country | string | required | Country key (e.g. usa) |
| service | string | required | Service code (e.g. tinder) |
{"status":"ok","country":"usa","service":"tinder","currency":"NGN","operators":[{"operator":"virtual63","price":108.00,"available":12488,"success_rate":66},{"operator":"virtual51","price":96.98,"available":3488,"success_rate":7}]}Buy Number
| Param | Type | Description | |
|---|---|---|---|
| country | string | required | Country key (e.g. usa) |
| service | string | required | Service code (e.g. tinder) |
| operator | string | optional | Operator from /operators. Omit to auto-select. |
{"status":"ok","order_id":"API_VS_12345678","phone":"+19709066149","service":"Tinder","operator":"virtual63","country":"usa","price":108.00,"currency":"NGN","expires":"2026-05-20T15:35:00Z","new_balance":1142.00}{"status":"error","message":"Insufficient balance. Required: ₦108.00, Available: ₦50.00."}$ch = curl_init("https://api.varasms.com/v1/?action=buy&api_key=YOUR_KEY");
curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>http_build_query(["country"=>"usa","service"=>"tinder","operator"=>"virtual63"]),CURLOPT_RETURNTRANSFER=>true]);
$r = json_decode(curl_exec($ch),true);
if ($r["status"]==="ok") echo "Phone: {$r['phone']} | Order: {$r['order_id']}\n";
else echo "Error: {$r['message']}\n";const r = await fetch("https://api.varasms.com/v1/?action=buy&api_key=YOUR_KEY",{
method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},
body:new URLSearchParams({country:"usa",service:"tinder",operator:"virtual63"})
}).then(r=>r.json());
if(r.status==="ok") console.log("Phone:",r.phone,"Order:",r.order_id);
else console.error("Error:",r.message);import requests
r=requests.post("https://api.varasms.com/v1/?action=buy&api_key=YOUR_KEY",data={"country":"usa","service":"tinder","operator":"virtual63"}).json()
if r["status"]=="ok": print(f"Phone:{r['phone']} | Order:{r['order_id']}")
else: print("Error:",r["message"])Check OTP
Poll every 5 seconds. When waiting is false the order has ended.
| Param | Type | Description | |
|---|---|---|---|
| order_id | string | required | order_id from the buy response |
{"status":"ok","sms_code":"","waiting":true}{"status":"ok","sms_code":"483920","sms_text":"Your code is 483920","waiting":false}for($i=0;$i<20;$i++){
sleep(5);
$r=json_decode(file_get_contents("https://api.varasms.com/v1/?action=check&api_key=YOUR_KEY&order_id=$order_id"),true);
if(!empty($r["sms_code"])){ echo "OTP:".$r["sms_code"]; break; }
if(!$r["waiting"]) break;
}const sleep=ms=>new Promise(r=>setTimeout(r,ms));
for(let i=0;i<20;i++){
await sleep(5000);
const r=await fetch("https://api.varasms.com/v1/?action=check&api_key=YOUR_KEY&order_id="+orderId).then(r=>r.json());
if(r.sms_code){console.log("OTP:",r.sms_code);break;}
if(!r.waiting) break;
}import requests,time
for _ in range(20):
time.sleep(5)
r=requests.get("https://api.varasms.com/v1/?action=check&api_key=YOUR_KEY&order_id="+order_id).json()
if r.get("sms_code"):print("OTP:",r["sms_code"]);break
if not r.get("waiting"):breakCancel & Refund
Cancels the order. Wallet auto-refunded if no OTP was received.
{"status":"ok","action":"cancel","refunded":true,"message":"Cancelled successfully. Wallet refunded."}Mark Done / Report Bad
finish — Mark complete after using the OTP. | ban — Report as invalid/not receiving SMS.
{"status":"ok","action":"finish","message":"Finished successfully."}{"status":"ok","action":"ban","message":"Banned successfully."}Full Flow Example
<?php
define("KEY","YOUR_API_KEY"); define("BASE","https://api.varasms.com/v1/");
function v1get($a,$p=[]){$p["action"]=$a;$p["api_key"]=KEY;return json_decode(file_get_contents(BASE."?".http_build_query($p)),true);}
function v1post($a,$p=[]){$ch=curl_init(BASE."?action=$a&api_key=".KEY);curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>http_build_query($p),CURLOPT_RETURNTRANSFER=>true]);$r=curl_exec($ch);curl_close($ch);return json_decode($r,true);}
$ops=v1get("operators",["country"=>"usa","service"=>"tinder"]);
$operator=$ops["operators"][0]["operator"];
$buy=v1post("buy",["country"=>"usa","service"=>"tinder","operator"=>$operator]);
if($buy["status"]!=="ok") die("Buy failed: ".$buy["message"]);
echo "Phone: {$buy['phone']}\n";
$otp=null;
for($i=0;$i<20;$i++){
sleep(5);
$chk=v1get("check",["order_id"=>$buy["order_id"]]);
if(!empty($chk["sms_code"])){$otp=$chk["sms_code"];echo "OTP:$otp\n";break;}
if(!$chk["waiting"]) break;
}
if($otp) v1post("finish",["order_id"=>$buy["order_id"]]);
else {$c=v1post("cancel",["order_id"=>$buy["order_id"]]);echo $c["refunded"]?"Refunded\n":"Cancelled\n";}const KEY="YOUR_API_KEY",BASE="https://api.varasms.com/v1/";
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
async function v1get(a,p={}){const u=new URL(BASE);Object.entries({...p,action:a,api_key:KEY}).forEach(([k,v])=>u.searchParams.set(k,v));return fetch(u).then(r=>r.json());}
async function v1post(a,p={}){return fetch(`${BASE}?action=${a}&api_key=${KEY}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(p)}).then(r=>r.json());}
(async()=>{
const ops=await v1get("operators",{country:"usa",service:"tinder"});
const operator=ops.operators[0].operator;
const buy=await v1post("buy",{country:"usa",service:"tinder",operator});
if(buy.status!=="ok"){console.error(buy.message);return;}
console.log("Phone:",buy.phone);
let otp=null;
for(let i=0;i<20;i++){
await sleep(5000);
const chk=await v1get("check",{order_id:buy.order_id});
if(chk.sms_code){otp=chk.sms_code;console.log("OTP:",otp);break;}
if(!chk.waiting) break;
}
if(otp) await v1post("finish",{order_id:buy.order_id});
else{const c=await v1post("cancel",{order_id:buy.order_id});console.log(c.refunded?"Refunded":"Cancelled");}
})();import requests,time
KEY="YOUR_API_KEY";BASE="https://api.varasms.com/v1/"
def v1get(a,p=None):return requests.get(BASE,params={**(p or{}),"action":a,"api_key":KEY}).json()
def v1post(a,p=None):return requests.post(f"{BASE}?action={a}&api_key={KEY}",data=p or{}).json()
ops=v1get("operators",{"country":"usa","service":"tinder"})
operator=ops["operators"][0]["operator"]
buy=v1post("buy",{"country":"usa","service":"tinder","operator":operator})
if buy["status"]!="ok":exit("Buy failed:"+buy["message"])
print(f"Phone:{buy['phone']}")
otp=None
for _ in range(20):
time.sleep(5)
chk=v1get("check",{"order_id":buy["order_id"]})
if chk.get("sms_code"):otp=chk["sms_code"];print("OTP:",otp);break
if not chk.get("waiting"):break
if otp:v1post("finish",{"order_id":buy["order_id"]})
else:
c=v1post("cancel",{"order_id":buy["order_id"]})
print("Refunded" if c["refunded"] else "Cancelled")Rental API Long-term numbers · Full Number & Service Rental · Unlimited SMS
Rent real SIM numbers for days, weeks or months. Two types: Full Number (all services) or Service Rental (dedicated to one app).
• Full Number — receive SMS from any service
• Service Rental — dedicated to one specific app
Integration Flows
Full Number Rental
Service Rental
Authentication
GET /v2/?action=rental_countries&api_key=YOUR_KEYGET /v2/?action=rental_countries
X-API-Key: YOUR_KEYrental_countries
| Param | Type | Description | |
|---|---|---|---|
| type | string | optional | all (default) | full | service |
{"status":"ok","type":"full","countries":["Germany","UnitedKingdom","CzechRepublic"],"total":12}rental_durations
| Param | Type | Description | |
|---|---|---|---|
| country | string | required | Country name from rental_countries |
{"status":"ok","country":"Germany","plans":[{"product_id":97629,"duration":"1 month","price":55200.00,"currency":"NGN","available":999},{"product_id":97630,"duration":"1 week","price":14400.00,"currency":"NGN","available":999}],"note":"Pass product_id to rent_number."}rent_number
Rent a full number. Wallet is deducted. Save rental_id.
| Param | Type | Description | |
|---|---|---|---|
| product_id | integer | required | Product ID from rental_durations |
| auto_renew | integer | optional | Send 1 to auto-renew on expiry |
{"status":"ok","rental_id":87,"phone":"+447735327628","country":"Germany","type":"Full Number Rental","duration":"1 month","expires_at":"2026-06-20 15:00:00","price":55200.00,"currency":"NGN","new_balance":8800.00}$ch=curl_init("https://api.varasms.com/v2/?action=rent_number&api_key=YOUR_KEY");
curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>"product_id=97629",CURLOPT_RETURNTRANSFER=>true]);
$r=json_decode(curl_exec($ch),true);
if($r["status"]==="ok") echo "Phone:{$r['phone']} | Rental:{$r['rental_id']} | Expires:{$r['expires_at']}\n";
else echo "Error:{$r['message']}\n";const r=await fetch("https://api.varasms.com/v2/?action=rent_number&api_key=YOUR_KEY",{
method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},
body:new URLSearchParams({product_id:97629})
}).then(r=>r.json());
if(r.status==="ok") console.log("Phone:",r.phone,"Rental:",r.rental_id);import requests
r=requests.post("https://api.varasms.com/v2/?action=rent_number&api_key=YOUR_KEY",data={"product_id":97629}).json()
if r["status"]=="ok": print(f"Phone:{r['phone']} | Rental:{r['rental_id']}")rental_services
| Param | Type | Description | |
|---|---|---|---|
| country | string | required | Country name from rental_countries |
{"status":"ok","country":"Germany","services":["WhatsApp","Telegram","Google, Gmail, Youtube","Tinder"],"total":14}rental_service_plans
| Param | Type | Description | |
|---|---|---|---|
| country | string | required | Country name |
| service | string | required | Service name from rental_services |
{"status":"ok","country":"Germany","service":"WhatsApp","plans":[{"product_id":101,"duration":"1 day","price":960.00,"currency":"NGN","available":50},{"product_id":102,"duration":"7 days","price":5760.00,"currency":"NGN","available":50}]}rent_service
| Param | Type | Description | |
|---|---|---|---|
| product_id | integer | required | Product ID from rental_service_plans |
| auto_renew | integer | optional | Send 1 to auto-renew |
{"status":"ok","rental_id":88,"phone":"+49176123456","service":"WhatsApp","country":"Germany","type":"Service Rental","duration":"1 day","expires_at":"2026-05-21 15:00:00","price":960.00,"currency":"NGN","new_balance":7840.00}rental_status
Poll every 30 seconds. Returns all received SMS messages.
| Param | Type | Description | |
|---|---|---|---|
| rental_id | integer | required | rental_id from rent_number or rent_service |
{"status":"ok","rental_id":87,"phone":"+447735327628","status":"active","expires_at":"2026-06-20 15:00:00","sms_count":2,"sms":[{"sender":"Tinder","message":"Your code is 889051","received_at":"2026-05-20 10:34:00"},{"sender":"Google","message":"G-482910 is your code","received_at":"2026-05-20 11:02:00"}]}$seen=[];
while(true){
sleep(30);
$r=json_decode(file_get_contents("https://api.varasms.com/v2/?action=rental_status&rental_id=$rental_id&api_key=YOUR_KEY"),true);
if($r["status"]!=="active") break;
foreach($r["sms"] as $sms){
$key=$sms["received_at"].$sms["sender"];
if(!isset($seen[$key])){echo "From {$sms['sender']}: {$sms['message']}\n";$seen[$key]=true;}
}
}const sleep=ms=>new Promise(r=>setTimeout(r,ms));const seen=new Set();
while(true){
await sleep(30000);
const r=await fetch("https://api.varasms.com/v2/?action=rental_status&rental_id=87&api_key=YOUR_KEY").then(r=>r.json());
if(r.status!=="active") break;
for(const sms of r.sms){const k=sms.received_at+sms.sender;if(!seen.has(k)){console.log(`From ${sms.sender}:`,sms.message);seen.add(k);}}
}import requests,time
seen=set()
while True:
time.sleep(30)
r=requests.get("https://api.varasms.com/v2/",params={"action":"rental_status","rental_id":87,"api_key":"YOUR_KEY"}).json()
if r["status"]!="active": break
for sms in r["sms"]:
k=sms["received_at"]+sms["sender"]
if k not in seen: print(f"From {sms['sender']}: {sms['message']}"); seen.add(k)my_rentals
| Param | Type | Description | |
|---|---|---|---|
| status | string | optional | active | expired | cancelled | all |
| limit | integer | optional | 1–50, default 20 |
{"status":"ok","rentals":[{"rental_id":87,"phone":"+447735327628","country":"Germany","type":"RentalFull","status":"active","expires_at":"2026-06-20 15:00:00","price":55200.00,"currency":"NGN"}],"total":1}cancel_rental
| Param | Type | Description | |
|---|---|---|---|
| rental_id | integer | required | Rental ID |
{"status":"ok","rental_id":88,"status":"cancelled","note":"No refunds on rental cancellations."}Full Flow Example
<?php
define("KEY","YOUR_API_KEY");define("BASE","https://api.varasms.com/v2/");
function v2get($a,$p=[]){$p["action"]=$a;$p["api_key"]=KEY;return json_decode(file_get_contents(BASE."?".http_build_query($p)),true);}
function v2post($a,$p=[]){$ch=curl_init(BASE."?action=$a&api_key=".KEY);curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>http_build_query($p),CURLOPT_RETURNTRANSFER=>true]);$r=curl_exec($ch);curl_close($ch);return json_decode($r,true);}
$plans=v2get("rental_durations",["country"=>"Germany"]);
$plan=$plans["plans"][0];
$rent=v2post("rent_number",["product_id"=>$plan["product_id"]]);
if($rent["status"]!=="ok") die("Rent failed:".$rent["message"]);
$rental_id=$rent["rental_id"];
echo "Phone:{$rent['phone']} | Rental:$rental_id\n";
$seen=[];
for($i=0;$i<10;$i++){
sleep(30);
$s=v2get("rental_status",["rental_id"=>$rental_id]);
if($s["status"]!=="active") break;
foreach($s["sms"] as $sms){$key=$sms["received_at"].$sms["sender"];if(!isset($seen[$key])){echo "SMS from {$sms['sender']}:{$sms['message']}\n";$seen[$key]=true;}}
}const KEY="YOUR_API_KEY",BASE="https://api.varasms.com/v2/";
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
async function v2get(a,p={}){const u=new URL(BASE);Object.entries({...p,action:a,api_key:KEY}).forEach(([k,v])=>u.searchParams.set(k,v));return fetch(u).then(r=>r.json());}
async function v2post(a,p={}){return fetch(`${BASE}?action=${a}&api_key=${KEY}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(p)}).then(r=>r.json());}
(async()=>{
const plans=await v2get("rental_service_plans",{country:"Germany",service:"WhatsApp"});
const plan=plans.plans[0];
const rent=await v2post("rent_service",{product_id:plan.product_id});
if(rent.status!=="ok"){console.error(rent.message);return;}
console.log("Phone:",rent.phone,"Rental:",rent.rental_id);
const seen=new Set();
for(let i=0;i<20;i++){
await sleep(30000);
const s=await v2get("rental_status",{rental_id:rent.rental_id});
if(s.status!=="active") break;
for(const sms of s.sms){const k=sms.received_at+sms.sender;if(!seen.has(k)){console.log(`From ${sms.sender}:`,sms.message);seen.add(k);}}
}
})();import requests,time
KEY="YOUR_API_KEY";BASE="https://api.varasms.com/v2/"
def v2get(a,p=None):return requests.get(BASE,params={**(p or{}),"action":a,"api_key":KEY}).json()
def v2post(a,p=None):return requests.post(f"{BASE}?action={a}&api_key={KEY}",data=p or{}).json()
plans=v2get("rental_service_plans",{"country":"Germany","service":"WhatsApp"})
plan=plans["plans"][0]
rent=v2post("rent_service",{"product_id":plan["product_id"]})
if rent["status"]!="ok":exit("Rent failed:"+rent["message"])
rental_id=rent["rental_id"]
print(f"Phone:{rent['phone']} | Rental:{rental_id}")
seen=set()
for _ in range(20):
time.sleep(30)
s=v2get("rental_status",{"rental_id":rental_id})
if s["status"]!="active":break
for sms in s["sms"]:
k=sms["received_at"]+sms["sender"]
if k not in seen:print(f"From {sms['sender']}:{sms['message']}");seen.add(k)USA / Canada API Server 3 · Real US & CA numbers · JSON REST · Auto-refund
Buy real United States and Canada verification numbers for 200+ services. Clean JSON, full order lifecycle, automatic wallet refund when no OTP arrives. Same API key as the other APIs.
Quick Start
Register at dashboard.varasms.com. The same key works across all VaraSMS APIs.
Use country=usa or country=canada. List services, then buy.
Poll check every 5s. When waiting is false the order has ended.
Authentication
Query Parameter
GET /v3/?action=balance&api_key=YOUR_KEYHTTP Header (recommended)
GET /v3/?action=balance
X-API-Key: YOUR_KEYGet Balance
{"status":"ok","balance":4500.00,"total_deposited":10000.00,"total_otp":42,"currency":"NGN"}Get Countries
Server 3 supports two countries. Use country_key when buying.
{"status":"ok","count":2,"countries":[{"country_key":"usa","country_name":"United States","iso":"US","prefix":"+1"},{"country_key":"canada","country_name":"Canada","iso":"CA","prefix":"+1"}]}Get Services
Returns all available services with NGN price. Services are the same across US and CA.
{"status":"ok","count":214,"services":[{"service_code":"whatsapp","service_name":"WhatsApp","price":108.00,"currency":"NGN","available":9999},{"service_code":"google","service_name":"Google","price":96.50,"currency":"NGN","available":9999}]}Buy Number
Purchase a US or CA number. Save the order_id to check OTP and manage the order.
| Param | Type | Description | |
|---|---|---|---|
| country | string | required | usa or canada |
| service | string | required | Service code from /services (e.g. whatsapp, google) |
{"status":"ok","order_id":"TX_8f2a91c4","phone":"+19709066149","service":"WhatsApp","country":"usa","country_name":"United States","price":108.00,"currency":"NGN","expires":"2026-06-14T15:35:00","new_balance":1142.00}{"status":"error","message":"Insufficient balance. Required: ₦108.00, Available: ₦50.00."}$ch=curl_init("https://api.varasms.com/v3/?action=buy&api_key=YOUR_KEY");
curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>http_build_query(["country"=>"usa","service"=>"whatsapp"]),CURLOPT_RETURNTRANSFER=>true]);
$r=json_decode(curl_exec($ch),true);
if($r["status"]==="ok") echo "Phone:{$r['phone']} | Order:{$r['order_id']}\n";
else echo "Error:{$r['message']}\n";const r=await fetch("https://api.varasms.com/v3/?action=buy&api_key=YOUR_KEY",{
method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},
body:new URLSearchParams({country:"usa",service:"whatsapp"})
}).then(r=>r.json());
if(r.status==="ok") console.log("Phone:",r.phone,"Order:",r.order_id);
else console.error("Error:",r.message);import requests
r=requests.post("https://api.varasms.com/v3/?action=buy&api_key=YOUR_KEY",data={"country":"usa","service":"whatsapp"}).json()
if r["status"]=="ok": print(f"Phone:{r['phone']} | Order:{r['order_id']}")
else: print("Error:",r["message"])Check OTP
Poll every 5 seconds. When waiting is false the order has ended. If it timed out with no OTP, refunded will be true.
| Param | Type | Description | |
|---|---|---|---|
| order_id | string | required | order_id from the buy response |
{"status":"ok","order_status":"PENDING","sms_code":"","waiting":true}{"status":"ok","order_status":"RECEIVED","sms_code":"483920","sms_text":"Your code is 483920","waiting":false,"refunded":false}for($i=0;$i<24;$i++){
sleep(5);
$r=json_decode(file_get_contents("https://api.varasms.com/v3/?action=check&api_key=YOUR_KEY&order_id=$order_id"),true);
if(!empty($r["sms_code"])){ echo "OTP:".$r["sms_code"]; break; }
if(!$r["waiting"]) break;
}const sleep=ms=>new Promise(r=>setTimeout(r,ms));
for(let i=0;i<24;i++){
await sleep(5000);
const r=await fetch("https://api.varasms.com/v3/?action=check&api_key=YOUR_KEY&order_id="+orderId).then(r=>r.json());
if(r.sms_code){console.log("OTP:",r.sms_code);break;}
if(!r.waiting) break;
}import requests,time
for _ in range(24):
time.sleep(5)
r=requests.get("https://api.varasms.com/v3/?action=check&api_key=YOUR_KEY&order_id="+order_id).json()
if r.get("sms_code"):print("OTP:",r["sms_code"]);break
if not r.get("waiting"):breakGet Active Order
Returns your most recent in-progress order from the last 25 minutes — useful for resuming after a disconnect. Returns order: null if there is no active order. Poll check afterwards for the live OTP.
{"status":"ok","order":{"order_id":"TX_8f2a91c4","ext_order_id":"TX_8f2a91c4","phone":"+19709066149","service":"WhatsApp","service_code":"whatsapp","country":"usa","country_name":"United States","price":108.00,"currency":"NGN","sms_code":"","sms_text":"","expires":"2026-06-14T15:35:00","ttl_seconds":284,"waiting":true}}{"status":"ok","order":null}Cancel & Refund
Cancels the order. Wallet is automatically refunded if no OTP was received.
{"status":"ok","order_id":"TX_8f2a91c4","action":"cancel","refunded":true,"refund_amount":108.00,"message":"Cancelled successfully. Wallet refunded."}Mark Done / Report Bad
finish — Mark complete after using the OTP. | ban — Report as invalid or not receiving SMS.
{"status":"ok","action":"finish","message":"Finished successfully."}{"status":"ok","action":"ban","message":"Banned successfully."}Full Flow Example
<?php
define("KEY","YOUR_API_KEY"); define("BASE","https://api.varasms.com/v3/");
function v3get($a,$p=[]){$p["action"]=$a;$p["api_key"]=KEY;return json_decode(file_get_contents(BASE."?".http_build_query($p)),true);}
function v3post($a,$p=[]){$ch=curl_init(BASE."?action=$a&api_key=".KEY);curl_setopt_array($ch,[CURLOPT_POST=>true,CURLOPT_POSTFIELDS=>http_build_query($p),CURLOPT_RETURNTRANSFER=>true]);$r=curl_exec($ch);curl_close($ch);return json_decode($r,true);}
$bal=v3get("balance");
echo "Balance: NGN {$bal['balance']}\n";
$buy=v3post("buy",["country"=>"usa","service"=>"whatsapp"]);
if($buy["status"]!=="ok") die("Buy failed:".$buy["message"]);
$order=$buy["order_id"];
echo "Phone:{$buy['phone']} | Order:$order\n";
$otp=null;
for($i=0;$i<24;$i++){
sleep(5);
$chk=v3get("check",["order_id"=>$order]);
if(!empty($chk["sms_code"])){$otp=$chk["sms_code"];echo "OTP:$otp\n";break;}
if(!$chk["waiting"]) break;
}
if($otp) v3post("finish",["order_id"=>$order]);
else{$c=v3post("cancel",["order_id"=>$order]);echo $c["refunded"]?"Refunded\n":"Cancelled\n";}const KEY="YOUR_API_KEY",BASE="https://api.varasms.com/v3/";
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
async function v3get(a,p={}){const u=new URL(BASE);Object.entries({...p,action:a,api_key:KEY}).forEach(([k,v])=>u.searchParams.set(k,v));return fetch(u).then(r=>r.json());}
async function v3post(a,p={}){return fetch(`${BASE}?action=${a}&api_key=${KEY}`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(p)}).then(r=>r.json());}
(async()=>{
const buy=await v3post("buy",{country:"usa",service:"whatsapp"});
if(buy.status!=="ok"){console.error(buy.message);return;}
console.log("Phone:",buy.phone,"Order:",buy.order_id);
let otp=null;
for(let i=0;i<24;i++){
await sleep(5000);
const chk=await v3get("check",{order_id:buy.order_id});
if(chk.sms_code){otp=chk.sms_code;console.log("OTP:",otp);break;}
if(!chk.waiting) break;
}
if(otp) await v3post("finish",{order_id:buy.order_id});
else{const c=await v3post("cancel",{order_id:buy.order_id});console.log(c.refunded?"Refunded":"Cancelled");}
})();import requests,time
KEY="YOUR_API_KEY";BASE="https://api.varasms.com/v3/"
def v3get(a,p=None):return requests.get(BASE,params={**(p or{}),"action":a,"api_key":KEY}).json()
def v3post(a,p=None):return requests.post(f"{BASE}?action={a}&api_key={KEY}",data=p or{}).json()
buy=v3post("buy",{"country":"usa","service":"whatsapp"})
if buy["status"]!="ok":exit("Buy failed:"+buy["message"])
order_id=buy["order_id"]
print(f"Phone:{buy['phone']} | Order:{order_id}")
otp=None
for _ in range(24):
time.sleep(5)
chk=v3get("check",{"order_id":order_id})
if chk.get("sms_code"):otp=chk["sms_code"];print("OTP:",otp);break
if not chk.get("waiting"):break
if otp:v3post("finish",{"order_id":order_id})
else:
c=v3post("cancel",{"order_id":order_id})
print("Refunded" if c["refunded"] else "Cancelled")