API Documentation

Integrate SpotSMS into your application. All API endpoints return JSON.

Base URL

https://spotsms.com/api-data.php

Authentication

Include your API key as a query parameter in all requests:

?apikey=YOUR_API_KEY

Get your API key from the Settings.

1. List Services

Returns all available services with pricing.

GET /api-data.php?action=services&apikey=YOUR_API_KEY

Response:

{
  "code": 200,
  "data": [
    {
      "id": "0003",
      "name": "Microsoft",
      "price": "0.0882",
      "operators": [{"pid": "0003", "price": "0.0882"}]
    }
  ]
}

2. List Countries

Returns available countries for a service.

GET /api-data.php?action=countries&pid=SERVICE_ID&apikey=YOUR_API_KEY

Response:

{
  "code": 200,
  "data": [
    {
      "code": "us",
      "name": "United States",
      "count": 150,
      "flag": "https://flagcdn.com/w80/us.png"
    }
  ]
}

3. Get Number

Purchase a virtual number for a specific service and country.

GET /api-data.php?action=getNumber&pid=SERVICE_ID&cuy=COUNTRY_CODE&num=1&apikey=YOUR_API_KEY

Response:

{
  "code": 200,
  "data": "+12025551234",
  "rsId": "activation_id_here",
  "pidUsed": "0003"
}

4. Get SMS Code

Poll for the received SMS code on the purchased number.

GET /api-data.php?action=getMsg&pn=PHONE_NUMBER&pid=SERVICE_ID&rsid=ACTIVATION_ID&apikey=YOUR_API_KEY

Response (SMS received):

{
  "code": 200,
  "data": "123456"
}

Response (waiting):

{
  "code": 404,
  "msg": "No SMS yet"
}

5. Cancel Number

Cancel an active number and get a refund (if within time limit).

GET /api-data.php?action=cancelRsActivation&rsid=ACTIVATION_ID&apikey=YOUR_API_KEY

6. Check Balance

Returns your current account balance.

GET /api-data.php?action=balance&apikey=YOUR_API_KEY

Response:

{
  "code": 200,
  "balance": "49.95"
}

Response Codes

200 Success
401 Invalid or missing API key
402 Insufficient balance
404 Resource not found / No SMS yet
500 Server error

Full Example (cURL)

# 1. Get a number for WhatsApp in Turkey
curl "https://spotsms.com/api-data.php?action=getNumber&pid=0948&cuy=tr&num=1&apikey=YOUR_KEY"

# 2. Poll for SMS (repeat every 10 seconds)
curl "https://spotsms.com/api-data.php?action=getMsg&pn=%2B905551234567&pid=0948&rsid=ACT_ID&apikey=YOUR_KEY"

# 3. Cancel if not needed
curl "https://spotsms.com/api-data.php?action=cancelRsActivation&rsid=ACT_ID&apikey=YOUR_KEY"

Python Example

import requests, time

API = "https://spotsms.com/api-data.php"
KEY = "YOUR_API_KEY"

# Get a number
r = requests.get(f"{API}?action=getNumber&pid=0948&cuy=tr&num=1&apikey={KEY}")
data = r.json()
phone = data["data"]
rsid  = data.get("rsId", "")

print(f"Number: {phone}")

# Poll for SMS
for _ in range(12):
    r = requests.get(f"{API}?action=getMsg&pn={phone}&pid=0948&rsid={rsid}&apikey={KEY}")
    sms = r.json()
    if sms["code"] == 200:
        print(f"SMS Code: {sms['data']}")
        break
    time.sleep(10)