SMSKodySMSKody

API Documentation

Integrate SMSKody into your application to rent USA phone numbers and receive SMS verification codes programmatically. Compatible with the SMS-Activate protocol — if your software already supports it, just change the base URL and API key.

Quick Start — 3 Steps
1. Get your API key from Settings
2. Call getNumber with a service code to rent a number
3. Poll getStatus every 3-5 seconds until the SMS arrives
🤖 AI Integration Prompt

Running a website or service and want to offer SMS verification numbers to your own users? Copy this prompt into Claude Code, Codex, or any AI coding agent, add your API key, and it will wire up number rental + SMS code retrieval into your existing project — without touching your design or any unrelated code.

I want you to integrate the SMSKody SMS-verification-number API into this project so my users can rent a temporary phone number and receive an SMS verification code.

Context:
- SMSKody rents temporary phone numbers and delivers SMS verification codes via a REST API compatible with the SMS-Activate protocol.
- Base URL: https://smskody.com/api/ext
- Auth: send header "Authorization: Bearer <API_KEY>" on every request. Store the key as an environment variable (e.g. SMSKODY_API_KEY) — never hardcode it.
- Full reference docs: https://smskody.com/api-docs

Endpoints you'll need:
- GET ?action=getBalance -> "ACCESS_BALANCE:10.50"
- GET ?action=getServicesList -> JSON array of {code, name}
- GET ?action=getPrices -> JSON {country: {service: {cost, count}}}
- GET ?action=getNumber&service=<code> -> "ACCESS_NUMBER:<activationId>:<phoneNumber>" (errors: NO_BALANCE, NO_NUMBERS, BAD_SERVICE)
- GET ?action=getStatus&id=<activationId> -> "STATUS_WAIT_CODE" (keep polling every 3-5s) | "STATUS_OK:<code>" (SMS received) | "STATUS_CANCEL" | "NO_ACTIVATION"
- GET ?action=setStatus&id=<activationId>&status=8 -> cancel & refund | status=6 -> mark complete
- Add &format=json to any request to get JSON instead of the text protocol above, e.g. getNumber -> {"status":"ACCESS_NUMBER","id":"8041315","phone":"12145550198"}
- Rate limit: max 60 requests/minute per key (response "RATE_LIMIT" if exceeded)

What I need you to do:
1. Add a small, self-contained integration (a service/module/client that fits this codebase's existing conventions and language) wrapping these calls: rent a number, poll for the SMS code, and cancel/complete an activation.
2. Wire it into [DESCRIBE WHERE IN YOUR APP THIS SHOULD LIVE, e.g. "the signup flow", "a new /verify-number page", "the existing phone-verification step"] so it's actually usable.
3. Handle the documented response codes and edge cases (insufficient balance, no numbers available, expired/cancelled activation, rate limiting).
4. Do NOT touch any unrelated code, existing UI/design, styling, layout, or refactor anything outside what's needed for this integration. Keep the change minimal and additive — new files/functions only wherever possible.
5. Do NOT invent any payment/billing logic for the numbers themselves — assume the SMSKody balance is already funded; just call the API.
6. Briefly explain your integration approach before writing code, and ask me before doing anything outside the scope of this feature (like a DB migration) if one seems necessary.

My SMSKody API key: <PASTE YOUR API KEY HERE>
Authentication

Two methods are supported. Header-based auth is recommended as it keeps your key out of server logs and browser history.

Method 1 — Authorization Header (recommended)
Authorization: Bearer sk_your_api_key_here
Method 2 — Query Parameter
GET https://smskody.com/api/ext?api_key=sk_your_key&action=getBalance
Base URL
https://smskody.com/api/ext
Pricing

dynamic per service — starting from $0.05/SMS

Use getPrices to check current prices. Only charged when SMS is received. Auto-refund on cancel/expire.

Rate Limits
LimitValueResponse
API requests per key60 requests / minuteRATE_LIMIT

Polling getStatus every 3 seconds uses ~20 req/min — well within the limit. If you get RATE_LIMIT, wait and retry.

Full Integration Flow
# 1. Check balance
GET /api/ext?action=getBalance
→ ACCESS_BALANCE:10.50

# 2. Get available services and prices
GET /api/ext?action=getPrices
→ {"0": {"wa": {"cost": 0.05, "count": 219475}, ...}}

# 3. Rent a number for WhatsApp
GET /api/ext?action=getNumber&service=wa
→ ACCESS_NUMBER:8041315:12145550198

# 4. Use +12145550198 on WhatsApp to request SMS code

# 5. Poll for the SMS (every 3-5 seconds)
GET /api/ext?action=getStatus&id=8041315
→ STATUS_WAIT_CODE          (keep polling)
→ STATUS_OK:482731          (SMS received!)

# 6. Done! Optionally mark as complete
GET /api/ext?action=setStatus&id=8041315&status=6
→ ACCESS_ACTIVATION

# If SMS never arrives, cancel for refund:
GET /api/ext?action=setStatus&id=8041315&status=8
→ ACCESS_CANCEL

Endpoints

getBalance

Returns the current account balance in USD.

Example
GET https://smskody.com/api/ext?action=getBalance
Responses
ACCESS_BALANCE:10.50Current balance
BAD_KEYInvalid API key
getServicesList

Returns a JSON array of all available services with code and name.

Example
GET https://smskody.com/api/ext?action=getServicesList
Responses
[{"code":"wa","name":"Whatsapp"}, ...]JSON array of services
getPrices

Returns prices and available number counts for all services, grouped by country.

Parameters
countryCountry ID (optional, only 0 = USA)
Example
GET https://smskody.com/api/ext?action=getPrices
Responses
{"0":{"wa":{"cost":0.05,"count":219475},...}}JSON object: country → service → {cost, count}
getCountries

Returns available countries. Currently only USA.

Example
GET https://smskody.com/api/ext?action=getCountries
Responses
{"0":{"id":0,"name":"USA"}}JSON object of countries
getNumber

Rent a phone number for a specific service. Balance is deducted at the service price (check getPrices). Number is typically active for around 5 minutes.

Parameters
service*Service code (e.g. wa, go, fb, ig, lf, ds, tw)
countryCountry ID (default: 0 = USA)
Example
GET https://smskody.com/api/ext?action=getNumber&service=wa
Responses
ACCESS_NUMBER:8041315:12145550198Success — {activationId}:{phoneNumber}
NO_BALANCEInsufficient balance
NO_NUMBERSNo numbers available for this service
BAD_SERVICEUnknown service code
getStatus

Check the status of an activation. Poll this every 3-5 seconds to wait for the SMS code.

Parameters
id*Activation ID from getNumber response
Example
GET https://smskody.com/api/ext?action=getStatus&id=8041315
Responses
STATUS_WAIT_CODEStill waiting for SMS — keep polling
STATUS_OK:482731SMS received — code after the colon
STATUS_CANCELActivation was cancelled or expired
NO_ACTIVATIONActivation ID not found
setStatus

Change the status of an activation. Use status=8 to cancel (get refund), or status=6 to mark complete.

Parameters
id*Activation ID
status*8 = cancel & refund, 6 = mark complete
Example
GET https://smskody.com/api/ext?action=setStatus&id=8041315&status=8
Responses
ACCESS_CANCELCancelled — balance refunded
ACCESS_ACTIVATIONMarked as complete
BAD_STATUSInvalid status value or wrong state
NO_ACTIVATIONActivation ID not found

Webhooks (Optional)

SMS Webhook

Instead of polling, you can set a webhook URL in Settings. When an SMS arrives, we'll POST a JSON payload to your URL:

POST https://your-server.com/webhook
Content-Type: application/json

{
  "activationId": 8041315,
  "phone": "12145550198",
  "service": "wa",
  "smsCode": "482731",
  "smsText": "Your WhatsApp code is 482731",
  "status": "completed"
}

Code Examples

Python
import requests, time

API_KEY = "sk_your_key_here"
BASE = "https://smskody.com/api/ext"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

r = requests.get(BASE, params={"action": "getNumber", "service": "wa"}, headers=HEADERS)
parts = r.text.split(":")
activation_id, phone = parts[1], parts[2]
print(f"Use this number: +{phone}")

while True:
    r = requests.get(BASE, params={"action": "getStatus", "id": activation_id}, headers=HEADERS)
    if r.text.startswith("STATUS_OK:"):
        print(f"SMS code: {r.text.split(':')[1]}")
        break
    time.sleep(3)
Node.js
const API_KEY = "sk_your_key_here";
const BASE = "https://smskody.com/api/ext";

async function api(params) {
  const url = BASE + "?" + new URLSearchParams(params);
  const res = await fetch(url, { headers: { Authorization: "Bearer " + API_KEY } });
  return res.text();
}

const result = await api({ action: "getNumber", service: "wa" });
const [, activationId, phone] = result.split(":");
console.log("Use number: +" + phone);

while (true) {
  const status = await api({ action: "getStatus", id: activationId });
  if (status.startsWith("STATUS_OK:")) {
    console.log("Code:", status.split(":")[1]);
    break;
  }
  await new Promise(r => setTimeout(r, 3000));
}
cURL
curl -H "Authorization: Bearer sk_your_key" \
  "https://smskody.com/api/ext?action=getBalance"

curl -H "Authorization: Bearer sk_your_key" \
  "https://smskody.com/api/ext?action=getNumber&service=wa"

curl -H "Authorization: Bearer sk_your_key" \
  "https://smskody.com/api/ext?action=getStatus&id=8041315"

curl -H "Authorization: Bearer sk_your_key" \
  "https://smskody.com/api/ext?action=setStatus&id=8041315&status=8"

Error Codes Reference

CodeMeaningWhat to do
BAD_KEYInvalid or missing API keyCheck your key in Settings
BAD_ACTIONUnknown action parameterCheck the action name
BAD_SERVICEService code not foundUse getServicesList to see valid codes
BAD_STATUSInvalid status or wrong activation stateCheck activation state before changing status
NO_BALANCEInsufficient balanceTop up your account
NO_NUMBERSNo numbers available for this serviceTry again later or use a different service
NO_ACTIVATIONActivation ID not foundCheck the ID matches your account
RATE_LIMITToo many requestsWait 60 seconds, max 60 req/min
Interactive API Tester

Test all endpoints in your browser with our interactive tool.

Open API Tester
Need help integrating? Contact us on Telegram @smskodybot or email support@smskody.com