Get numbers and codes from your code
Buy virtual numbers for 200+ services and fetch SMS codes automatically with the GhostSIM REST API. Same prices and balance as the panel, no extra fees.
https://ghostsim.app/api/v1
Create a key
Create up to 3 keys under Account › Developer API. A key is shown only once.
Buy a number
Call POST /numbers with a service and country code; the price comes off your balance and the number arrives at once.
Read the code
Poll GET /numbers/{id} every few seconds; when sms_code is set, your code is there. No SMS means a refund.
Authentication
Send your API key as a Bearer token with every request. The key belongs to your account: your panel balance and prices apply.
Authorization: Bearer YOUR_API_KEY
Accept: application/json
- HTTPS only
- Keep the key on your server, not in a browser or app
- Leaked? Revoke it and create a new one
- No extra fee: same price as the panel
Endpoints
Every answer is JSON; lists and records come in the "data" field.
/balance
/services
/services/{service}/countries
/numbers
/numbers/{id}
/numbers
/numbers/{id}/finish
/numbers/{id}/cancel
/numbers/{id}/another
/numbers/{id}/retry
serviceservice code (from /services)countrycountry code (from /services/{service}/countries)Idempotency-Key: …optional; resending with the same key never charges twice
If time runs out without an SMS the order becomes expired and the price returns to your balance automatically.
Code example
# 1) Check the balance
curl https://ghostsim.app/api/v1/balance \
-H "Authorization: Bearer $GHOSTSIM_KEY" -H "Accept: application/json"
# 2) Buy a number
curl -X POST https://ghostsim.app/api/v1/numbers \
-H "Authorization: Bearer $GHOSTSIM_KEY" -H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"service":"wa","country":"6"}'
# 3) Poll until the code arrives
curl https://ghostsim.app/api/v1/numbers/12345 \
-H "Authorization: Bearer $GHOSTSIM_KEY" -H "Accept: application/json"
import os, time, requests
API = "https://ghostsim.app/api/v1"
H = {"Authorization": "Bearer " + os.environ["GHOSTSIM_KEY"], "Accept": "application/json"}
# Buy a number
num = requests.post(API + "/numbers", json={"service": "wa", "country": "6"}, headers=H).json()["data"]
print(num["phone_number"])
# Poll until the code arrives
while True:
a = requests.get(f"{API}/numbers/{num['id']}", headers=H).json()["data"]
if a["sms_code"] or a["status"] in ("cancelled", "expired"):
break
time.sleep(5)
print(a["sms_code"])
# Close the order
requests.post(f"{API}/numbers/{num['id']}/finish", headers=H)
const API = 'https://ghostsim.app/api/v1';
const H = { Authorization: `Bearer ${process.env.GHOSTSIM_KEY}`, Accept: 'application/json', 'Content-Type': 'application/json' };
// Buy a number
const { data: num } = await (await fetch(`${API}/numbers`, { method: 'POST', headers: H, body: JSON.stringify({ service: 'wa', country: '6' }) })).json();
console.log(num.phone_number);
// Poll until the code arrives
let a;
do {
await new Promise((r) => setTimeout(r, 5000));
({ data: a } = await (await fetch(`${API}/numbers/${num.id}`, { headers: H })).json());
} while (!a.sms_code && !['cancelled', 'expired'].includes(a.status));
console.log(a.sms_code);
Errors
API_KEY_REQUIREDINSUFFICIENT_CREDITSLOW_DELIVERYTOO_MANY_ACTIVEToo Many AttemptsUPSTREAM_UNAVAILABLERate limits
- All requests300/min
- Purchases30/min
- Cancel / finish / another SMS60/min
Polling every 3-5 seconds is plenty. Need higher limits? Write to support.
Get an API key