GhostSIM
REST · JSON · HTTPS

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.

Base URLhttps://ghostsim.app/api/v1
01

Create a key

Create up to 3 keys under Account › Developer API. A key is shown only once.

02

Buy a number

Call POST /numbers with a service and country code; the price comes off your balance and the number arrives at once.

03

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.

GET /balance
Balance (credits and USD)
GET /services
Services and starting prices
GET /services/{service}/countries
A service's countries, stock and prices
POST /numbers
Buy a number
GET /numbers/{id}
Order status and SMS code
GET /numbers
Recent orders
POST /numbers/{id}/finish
Got the code, close the order
POST /numbers/{id}/cancel
Cancel (refunded if no SMS came)
POST /numbers/{id}/another
Ask for another SMS on the same number
POST /numbers/{id}/retry
Try another number
POST /numbers body
  • serviceservice code (from /services)
  • countrycountry code (from /services/{service}/countries)
  • Idempotency-Key: …optional; resending with the same key never charges twice
Order statuses
waiting_sms sms_received completed cancelled expired

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

401
API_KEY_REQUIRED
Key missing, wrong or revoked
402
INSUFFICIENT_CREDITS
Not enough balance; see "required" and "have"
422
LOW_DELIVERY
No numbers in this country right now; retry after retry_after seconds
422
TOO_MANY_ACTIVE
Too many open orders at once
429
Too Many Attempts
Rate limit hit; wait for the Retry-After header
503
UPSTREAM_UNAVAILABLE
Temporary problem; try again shortly

Rate 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