Updated

SMS API reference

Send SMS from your own backend with the Smailor API: one message to one number,
from free text or an approved template, with delivery status, the monthly quota
and the international credit readable at any time. This page covers every SMS
endpoint, the answers they give, the errors to handle and the limits Smailor
applies.

The rest of the API (email, addresses, domains, Focus) is described in the
REST API reference. Authentication works the same way.

Before you start

You need:

  • the Telecom add-on, active, on a plan that includes SMS through the API
    (otherwise every send answers 403 api_not_included);
  • an API key created in Settings, API & MCP, with only the SMS scopes it needs
    (see below);
  • a phone number you own for the first test;
  • for numbers outside France: international SMS turned on and some credit in the
    SMS wallet.

Numbers are always written in E.164 form: a +, the country code, then the
number without its leading zero. +33612345678 is a French mobile.

Keep the key on your server. Anyone who holds a key with sms:send can spend
your quota and your credit, and send text that carries your name.

Base URL and authentication

Environment Base URL
Production https://smailor.com

Send the key on every request:

Authorization: Bearer YOUR_API_KEY

X-API-Key: YOUR_API_KEY works too, for intermediaries that strip
Authorization. Every answer is JSON.

Scopes

Grant the narrowest set that works. A key that only reads delivery status cannot
be turned into a key that sends if it leaks.

Scope Grants
sms:send POST /api/v1/sms/send, POST /api/v1/sms/estimate, POST /api/v1/sms/templates, POST /api/v1/sms/destination-requests
sms:read GET /api/v1/sms/messages, GET /api/v1/sms/messages/{id}, GET /api/v1/sms/templates, GET /api/v1/sms/destination-requests
sms:usage:read GET /api/v1/sms/usage
sms:wallet:read GET /api/v1/sms/balance
sms:senders:read GET /api/v1/sms/senders
sms:senders:write POST /api/v1/sms/senders
sms:campaigns:read GET /api/v1/sms/campaigns, GET /api/v1/sms/campaigns/{id}
sms:campaigns:write POST /api/v1/sms/campaigns

A key created before scopes existed never holds an SMS scope: SMS must be granted
explicitly. A key limited to some addresses or groups cannot hold an SMS scope
either, and answers 403 outside_key_limit on every SMS endpoint.

A missing scope answers 403 insufficient_scope and names what was needed:

{
  "error": "insufficient_scope",
  "message": "This API key is missing the \"sms:send\" scope.",
  "requiredScope": "sms:send",
  "grantedScopes": ["sms:read"]
}

What a send goes through

Every SMS passes the same checks, in this order. A refusal at any step costs no
quota and no credit.

key and scope
  |
body and Idempotency-Key
  |
SMS open on Smailor and on your account
  |
same Idempotency-Key seen before? --> 200 with the stored message, nothing sent twice
  |
Telecom active, API included, account certified if required
  |
destination open, international on, daily cap per foreign country
  |
sender name, template, opt-out list
  |
segments, STOP mention, quota or credit
  |
content check (the one every Smailor email passes)
  |
per-minute and per-day limits, quota or credit reserved
  |
202 queued --> sent --> delivered or failed

Send an SMS

POST /api/v1/sms/send, scope sms:send.

Headers

Header Required Notes
Authorization yes Bearer YOUR_API_KEY
Content-Type yes application/json
Idempotency-Key yes 1 to 255 printable ASCII characters, no spaces. Use one per message, for example your order id plus the purpose

JSON body

Send either message or templateId, never both.

Field Type Notes
to string E.164 number, up to 16 characters
message string Free text, up to 2000 characters before segmenting
templateId string An approved template of your account, instead of message
variables object Values for every blank of the template. Only with templateId
senderId string A verified sender name. Without it, your default verified sender is used, or the shared number
contactId string Attach the SMS to a contact of your directory
conversationId string Attach the SMS to a conversation of your inbox
category string transactional (default). marketing answers 403 marketing_unavailable for now
replyEnabled boolean Send from the shared number so the recipient can answer. Answers 400 replies_unavailable where replies are not open yet, and cannot be combined with senderId

Any other field is refused with 400 invalid_body.

Example

curl -X POST 'https://smailor.com/api/v1/sms/send' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: order-1042-shipped' \
  -d '{"to":"+33612345678","message":"Your order 1042 has shipped. Tracking: https://acme.example/t/1042"}'

Success response

202 Accepted when the SMS is queued. It normally leaves within a minute.

{
  "id": "5b1c2f0e-8a77-4c2e-9d1a-3f6e2a9b7c41",
  "direction": "outbound",
  "category": "transactional",
  "to": "+33612345678",
  "from": null,
  "message": "Your order 1042 has shipped. Tracking: https://acme.example/t/1042",
  "status": "queued",
  "segments": 1,
  "billing": "quota",
  "quotaSegments": 1,
  "cost": null,
  "conversationId": null,
  "contactId": null,
  "inReplyTo": null,
  "errorCode": null,
  "scheduledFor": null,
  "createdAt": "2026-11-27T10:00:00.000Z",
  "sentAt": null,
  "deliveredAt": null,
  "failedAt": null,
  "receivedAt": null
}

200 OK with the same shape means the Idempotency-Key was already used for
this exact request: you get the stored message, and nothing is sent a second
time. The same key with a different body answers 409 idempotency_conflict.

Retrying safely

Retry a timeout or a 5xx with the same Idempotency-Key and the same
body. Never generate a new key for a retry: that is how a customer receives the
same SMS twice. 4xx answers other than 429 will not change on retry.

The message object

Returned by send, by GET /api/v1/sms/messages/{id} and in lists.

Field Notes
id The SMS id. Keep it to follow the delivery
direction outbound, or inbound for a reply you received
category transactional or marketing
to The number the SMS went to
from The sending number on an inbound SMS, null on outbound
message The exact text sent, STOP mention included
status See below
segments Parts the text was split into
billing quota (France, counted in segments) or wallet (abroad, debited in cents)
quotaSegments Segments taken from the monthly quota, 0 on the wallet
cost { "amountCents", "currency": "EUR" } on the wallet, null on the quota
conversationId, contactId What the SMS is attached to, or null
inReplyTo On an inbound SMS, the id of the outbound SMS it answers
errorCode Why delivery failed, on failed
scheduledFor When a held SMS will leave, or null
createdAt, sentAt, deliveredAt, failedAt, receivedAt ISO 8601 times, null until they happen
Status Meaning
queued Accepted and waiting to leave
sending Handed to the carrier, no answer yet
sent The carrier accepted it
delivered The phone received it
failed It will not be delivered; see errorCode. Quota or credit comes back only when the SMS never left. Once the carrier took it, it is counted, delivered or not
received An SMS someone sent you
cancelled Stopped before it left

Estimate before sending

POST /api/v1/sms/estimate, scope sms:send. Same body as send, no
Idempotency-Key. Nothing is sent or reserved.

{
  "to": "+33612345678",
  "category": "transactional",
  "finalMessage": "Your order 1042 has shipped. Tracking: https://acme.example/t/1042",
  "stopMentionAdded": false,
  "encoding": "gsm7",
  "characters": 66,
  "units": 66,
  "segments": 1,
  "sender": null,
  "replyEnabled": false,
  "billing": "quota",
  "quota": { "limitSegments": 500, "remainingBefore": 412, "remainingAfter": 411 },
  "cost": null,
  "scheduledFor": null,
  "warnings": []
}
  • finalMessage is the text the phone will show. To a French number sent from
    a custom sender name, Smailor adds the opt-out line STOP au 36180 and counts
    it; stopMentionAdded says so.
  • encoding is gsm7 (160 characters in one segment, 153 per part beyond) or
    ucs2 as soon as one character is outside the GSM alphabet, an emoji for
    example (70 characters, then 67 per part). An SMS has at most 8 parts.
  • On the wallet, cost gives amountCents, balanceBeforeCents and
    balanceAfterCents instead of quota.
  • warnings lists what is worth fixing before sending, each with a code and a
    message: link_shortener, unicode_carrier_support, stop_mention_added,
    scheduled_quiet_hours, sender_shared_number.

The estimate runs every check of a send except the content check, the
per-minute and per-day limits and the reservation. A 200 estimate is not a
promise that the send will be accepted.

List and follow messages

GET /api/v1/sms/messages, scope sms:read. Newest first.

Query Notes
limit 1 to 100, default 50
cursor nextCursor of the previous page
status One status from the table above
conversationId Only the SMS of one conversation
{ "messages": [ { "id": "...", "status": "delivered" } ], "nextCursor": "MjAyNi0x..." }

nextCursor is null on the last page. GET /api/v1/sms/messages/{id}
returns one message, or 404 not_found.

For delivery updates as they happen, prefer the webhooks below to polling.

Templates

A template is fixed text with blanks, for example
Hello {{first_name}}, your appointment is confirmed for {{date}} at {{time}}.
Campaigns are always sent from one, and a template keeps a link or a code out
of free text your system builds.

The blanks are a fixed list, each with a type:

Blank Accepts
first_name, last_name, company Text up to 40 characters, no link
date, time, order_id, reference Letters, digits, -, _, /
amount An amount
code 4 to 10 letters or digits, for sign-in codes
url An https link on a domain verified on your account

Most of a template must be fixed text.

POST /api/v1/sms/templates, scope sms:send, body { "name", "body" }
(name up to 60 characters, body up to 1000). It answers 201 with:

{
  "id": "0d6f...",
  "name": "Appointment confirmed",
  "body": "Hello {{first_name}}, your appointment is confirmed for {{date}} at {{time}}.",
  "variables": ["first_name", "date", "time"],
  "status": "approved",
  "reason": null,
  "createdAt": "2026-11-27T10:00:00.000Z"
}

status is approved when Smailor's content check finds nothing, pending
while Smailor reads it, rejected with the reason in reason. An account keeps
at most 50 live templates (429 too_many_templates).

GET /api/v1/sms/templates, scope sms:read, lists them. To send from one:

{ "to": "+33612345678", "templateId": "0d6f...", "variables": { "first_name": "Marie", "date": "02/12", "time": "14:30" } }

Every blank must be filled. The rendered text is checked again at send time,
because the values are only known then.

Sender names

GET /api/v1/sms/senders, scope sms:senders:read:

{ "senders": [ { "id": "...", "name": "ACME", "type": "alphanumeric", "status": "verified", "isDefault": true, "createdAt": "..." } ] }

POST /api/v1/sms/senders, scope sms:senders:write, body
{ "name": "ACME", "type": "alphanumeric" }. A name is 3 to 11 letters, digits
or spaces, starts with a letter and has no accent. It answers 202 with status
pending: Smailor registers it with the carrier before it can be used. At most
5 names wait at a time (429 too_many_pending_senders).

A sender name cannot receive answers. Abroad, a custom name is used only where
the country allows it; elsewhere the SMS leaves from the shared number and the
estimate carries the sender_shared_number warning.

Quota and credit

GET /api/v1/sms/usage, scope sms:usage:read:

{
  "telecom": {
    "status": "active",
    "active": true,
    "periodStart": "2026-11-01T00:00:00.000Z",
    "periodEnd": "2026-12-01T00:00:00.000Z",
    "cancelAtPeriodEnd": false,
    "internationalEnabled": true
  },
  "quota": { "unit": "segment", "limit": 500, "used": 87, "reserved": 1, "remaining": 412 }
}

reserved counts SMS queued but not yet confirmed by the carrier.

GET /api/v1/sms/balance, scope sms:wallet:read, gives the international
credit in euro cents:

{ "currency": "EUR", "availableCents": 1840, "reservedCents": 9, "totalPurchasedCents": 2500, "totalConsumedCents": 651 }

French numbers use the monthly quota. Other countries are debited from the
wallet at the price of their route.

Countries

SMS reach the countries opened on Smailor; the SMS page of the dashboard lists
them. A number elsewhere answers 403 destination_unavailable.

POST /api/v1/sms/destination-requests, scope sms:send, asks Smailor to open
one:

{ "country": "DE", "useCase": "Delivery notices for our German customers", "monthlyVolume": 300 }

country is an ISO 3166 code, useCase 1 to 500 characters. A new request
answers 201, a second one for the same country updates the first and answers
200. At most 10 requests wait at a time. GET on the same path, scope
sms:read, lists them with status (open, planned, added, declined)
and Smailor's note. The account owner also gets an email once a country is
added or declined.

Campaigns

Campaigns send one approved template to 1 to 500 numbers. They are paused for
now
: POST /api/v1/sms/campaigns answers 403 marketing_unavailable until
the consent and opt-out controls of marketing SMS are ready. The shape below is
what the endpoint takes once they open.

POST /api/v1/sms/campaigns, scope sms:campaigns:write, Idempotency-Key
required:

{ "name": "December reminder", "templateId": "0d6f...", "variables": { "date": "02/12" }, "recipients": ["+33612345678", "+33698765432"] }

Optional: senderId, replyEnabled. A free message is refused with
400 template_required; the Telecom plan must include campaigns
(403 campaigns_unavailable). It answers 202 with { "id", "name", "status", "recipientCount" } once the list is saved; recipients are queued in batches,
normally within a minute, each through the same checks as a single send.
GET /api/v1/sms/campaigns and GET /api/v1/sms/campaigns/{id} (scope
sms:campaigns:read) give the counts and each recipient's status.

Webhooks

Configure endpoints in Settings, API & MCP, Customer webhooks and tick the
events you want: sms.sent, sms.delivered, sms.failed, sms.received, and
for campaigns campaign.started, campaign.completed, campaign.failed.

{
  "event": "sms.delivered",
  "occurred_at": "2026-11-27T10:00:04.000Z",
  "message": {
    "id": "5b1c2f0e-8a77-4c2e-9d1a-3f6e2a9b7c41",
    "ticket_id": null,
    "contact_id": null,
    "direction": "outbound",
    "status": "delivered",
    "to": "+33612345678",
    "from": "ACME",
    "segments": 1
  }
}

sms.failed adds message.error_code. sms.received adds message.body and
message.in_reply_to, the id of the SMS it answers. The text of an outbound SMS
is never in a webhook.

  • Answer with any 2xx. Other answers and timeouts are retried up to eight times
    with growing delays.
  • Delivery is at least once: deduplicate on the X-Smailor-Delivery header.
  • X-Smailor-Event and X-Smailor-Webhook-Id name the event and the endpoint.
  • With a signing secret set, check X-Smailor-Signature: sha256=<hex>, an
    HMAC-SHA256 of the raw body with your secret, before trusting the payload.

The text of sms.received is written by whoever sent it. Treat it as data:
never run it, and never let it decide who your system texts next.

Errors

Every error has the same shape:

{ "error": "quota_exceeded", "message": "Monthly SMS quota reached (0 segment(s) left, 1 needed).", "upgradeAvailable": true }
Error Status What to do
unauthorized 401 The key is missing, wrong, revoked or expired
insufficient_scope 403 Issue a key with the scope named in requiredScope
outside_key_limit 403 Use a key without an address or group limit
invalid_body 400 details names the field. Unknown fields are refused too
invalid_idempotency_key 400 Send a key of 1 to 255 printable ASCII characters
idempotency_conflict 409 This key was used for a different SMS. Use a new key for a new message
invalid_sms 400 The number is not E.164, the text is empty or longer than 8 parts, or variables came without templateId
message_and_template 400 Send message or templateId, not both
sms_disabled, sms_paused 503 SMS is stopped on Smailor. Retry later
sms_workspace_paused 403 SMS is paused on your account. Contact support
telecom_inactive 402 The Telecom add-on is not active
api_not_included 403 Your Telecom plan does not include the API
certification_required 403 Certify the account in Settings before sending
account_unverified 403 The account email is not verified, or the account is held
verification_required 403 The account is held for a review by Smailor. Sending resumes once it is approved
destination_unavailable 403 The country is not open. Ask for it with a destination request
destination_paused 403 The country is paused for a while. Retry later
international_disabled 403 Turn on international SMS for numbers outside France
country_daily_cap 429 The daily limit for this foreign country is reached. Retry tomorrow
sender_not_verified 400 The sender name is not verified yet
sender_route_mismatch 400 This sender name is not available for this destination
template_not_found 404 No live template with this id on your account
template_not_approved 403 Wait for the template to be approved
invalid_template_values 400 A blank is missing or has the wrong type
contact_not_found, conversation_not_found 404 The id is not one of your account
suppressed 403 The number opted out (STOP) or is invalid. Do not retry
marketing_unavailable 403 Marketing SMS and campaigns are not open yet
replies_unavailable, reply_requires_shared_number 400 Replies are not open for this number, or replyEnabled came with senderId
quota_exceeded 402 The monthly quota is used. upgradeAvailable: true when a larger Telecom plan can add SMS for the rest of the period
insufficient_credits 402 Top up the international credit
content_blocked 422 The text failed a safety check, a dangerous link for example. Change the text
content_review 422 The text looks like SMS phishing (a parcel fee or an administration with a link to a domain your account has not verified). Verify the domain in Smailor, or contact support
safety_check_unavailable 503 The content check could not run. Retry with the same Idempotency-Key
rate_limited 429 More than the per-minute limit of your account. Slow down
daily_limit_reached 429 The daily limit of your account is reached. Contact support to raise it
invalid_cursor, invalid_status 400 Use the nextCursor you were given and a status from the list
not_found 404 No SMS or campaign with this id on your account

A refused SMS never uses quota or credit.

Limits

Limit Default
SMS per minute, per account 100
SMS per day, per account 2000
SMS per day to one foreign country, per account 200
Parts in one SMS 8
Recipients in one campaign 500
Live templates 50
Sender names waiting for review 5

Support can raise the account limits for a real need.

Keeping it safe

SMS costs money per message and reaches a phone at once, so a mistake or a leak
shows quickly.

  • One key per system, least scopes. A backend that sends order notices needs
    sms:send and maybe sms:read. A dashboard that shows the quota needs
    sms:usage:read only.
  • Keep the key server-side. Never in a browser, a mobile app or a public
    repository. Rotate it at once in Settings if it may have leaked.
  • Never let a stranger choose the number freely. A public form that texts any
    number it is given is the usual target of SMS pumping: someone sends thousands
    of SMS to premium numbers they are paid for. Send only to numbers your system
    verified, add your own rate limit per user and per IP, and keep international
    SMS off unless you need it.
  • Prefer templates for anything a user can influence. The values are typed
    and a link must be on your verified domain, so a user cannot turn your SMS
    into a phishing message.
  • Use your own domain in links, never a public shortener: carriers block them.
  • Treat received SMS as data. Their text is written by whoever sent it.

Try it without sending: the playground

Settings, API & MCP, Playground answers POST /v1/sms/send and
POST /v1/sms/estimate like the real API, from the base URL
https://smailor.com/api/playground, and sends nothing: no SMS, no quota, no
credit, no count. Each request appears in a live log with every check it went
through.

curl -X POST 'https://smailor.com/api/playground/v1/sms/send' \
  -H 'Authorization: Bearer sk_play_YOUR_PLAYGROUND_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: test-1' \
  -d '{"to":"+33612345678","message":"Hello from the playground"}'
  • The playground key works there only. A real key works too, with its scopes
    and limit; nothing is sent with it either.
  • The content check, the per-minute and per-day limits and delivery are not run;
    the log says so. A 202 there is the answer the real endpoint gives up to
    that point, not a delivery promise.
  • With the playground key, the estimate leaves out the wallet balance and the
    remaining quota, because that key is often pasted into front-end code. A real
    key with sms:send sees them.

SMS through an AI assistant

An assistant connected over MCP can read the quota, list SMS,
estimate and send one SMS at a time, with a key that holds the SMS scopes. Each
send shows the exact text first and waits for your yes, and an assistant sends
at most 5 SMS per hour and 20 per day. A key that can also work on mail is never
offered the send tool. The details are in the MCP guide.

All guides

Found an issue on this page?