Developers

SMS API, one key and JSON

Hook texting into your app, shop or booking tool. Requests go through the same row checks, price list and opt-out list as the web send screen, so API sends show up in the same send history and credit history.

20,000Numbers in one batch
120Calls per minute
JSONBoth directions
Laptop showing code on a desk by the window

Quick start

From key to first text

  1. 01Issue a key on the API page of your account. It begins with sn_.
  2. 02Attach it to each call as the header Authorization: Bearer <key>.
  3. 03Ask POST /api/v1/quote what a batch will cost, then hand the same batch to POST /api/v1/messages.

Base URL

https://smsnumber.online/api/v1

Endpoints

Endpoint index

CallPurpose
GET /api/v1/balanceHow much credit is left, as a USD string
GET /api/v1/countriesEvery destination with its per-SMS price, readable without a key
POST /api/v1/quoteDry run: cost, parts and the rows that would be dropped
POST /api/v1/messagesQueue a batch now, or for later through schedule_at
GET /api/v1/messagesYour latest batches, paged with limit and offset
GET /api/v1/messages/{id}One batch with its counts per destination
POST /api/v1/messages/{id}/cancelCall off a booked batch before it starts and get the credit back

Sending

Posting a batch

Pass the to field as a JSON array or as text with one number per line. Rows that start with + are read as international; for rows without it, pass a two-letter country code such as us or kr.

FieldWhat goes in
toThe batch: an array, or text with one number per line. At most 20,000 rows
textWhat recipients read. At most 10 parts per row
countryOptional. Two-letter country code for rows that lack +
schedule_atOptional. A zoned ISO timestamp such as 2026-⁠12-⁠01T09:00:00Z, or Unix seconds, between 5 minutes and 30 days out
client_refOptional. Your own label for the batch, 64 characters or fewer
Reply · 201201 Created
{
  "ok": true,
  "campaign": {
    "id": "K7Q2M9XD4TPA",
    "status": "sending",
    "recipients": 2,
    "parts": 1,
    "encoding": "GSM-7",
    "cost": "0.0112",
    "countries": [
      { "country": "US", "recipients": 1, "cost": "0.0044" },
      { "country": "GB", "recipients": 1, "cost": "0.0068" }
    ]
  },
  "rejected": [],
  "duplicates": 0,
  "opted_out": 0,
  "balance": "48.9888"
}
POST /api/v1/messages
curl -X POST https://smsnumber.online/api/v1/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["+14155550142", "+447400123456"],
    "text": "Your order #A2847 has shipped."
  }'
POST /api/v1/quote
curl -X POST https://smsnumber.online/api/v1/quote \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": ["+14155550142", "+819012345678"], "text": "Hello" }'
Reply · 200200 OK
{
  "ok": true,
  "recipients": 2,
  "parts": 1,
  "encoding": "GSM-7",
  "cost": "0.0131",
  "balance": "49.00",
  "countries": [
    { "country": "JP", "recipients": 1, "price": "0.0087", "cost": "0.0087" },
    { "country": "US", "recipients": 1, "price": "0.0044", "cost": "0.0044" }
  ],
  "rejected": [],
  "duplicates": 0,
  "opted_out": 0
}

Errors

Error codes

CodeHTTPWhen it happens
unauthorized401The key is absent or not recognized
rate_limited429This key made too many calls in the last minute
bad_request400The request body is not readable JSON
empty_text400text is blank
too_long400text needs more than 10 parts
no_numbers400Every row was dropped by the checks
too_many400The batch holds more than 20,000 rows
bad_time400schedule_at is outside the allowed window
low_balance402Credit does not cover the batch
unavailable503Sending is paused for now; no credit was used
not_found404No batch with that id on your account
not_scheduled409The batch has already started or was called off

Limits and house rules

  • Each key may make 120 calls per minute.
  • Money comes back as a USD string, for example "0.0047".
  • Batch ids are random 12-character codes rather than counters.
  • Row checks and the opt-out list behave exactly as on the web screen.
Get an API key