Send an SMS
POST/v1/messagesKey · send
Send an SMS (scope send).
Authentication
API key: Authorization: Bearer sl_live_… with the send scope. The dashboard session works too.
An API key always acts in its own workspace. With a dashboard session, pass ?workspaceId= to choose the workspace (default: your first).
Parameters
| Name | In | Description |
|---|---|---|
Idempotency-Key | header | string — Same as the body field. The same key within 24 h returns the original message (200). |
Request body
application/json, required.
| Field | Description |
|---|---|
torequired | string · pattern ^\+[1-9]\d{6,14}$ E.164 |
bodyrequired | string · 1–1600 characters |
from | From |
idempotencyKey | string · 1–255 characters |
channel | "sms" | "imessage" | "sms_or_imessage" · default "sms"imessage and sms_or_imessage need an iPhone connected through Simline for Mac (400 if from names a device that can't; auto picks one that can). sms_or_imessage sends by SMS first and uses iMessage only if the SMS fails; on an Android phone it is plain SMS. |
{ "to": "+12125550142", "body": "Hi Maya, your order #1042 is ready for pickup.", "idempotencyKey": "order-1042-ready"}Response
200 — Idempotent replay: the original message
202 — Queued and handed to the phone's session
| Field | Description |
|---|---|
idrequired | string · pattern ^msg_[A-Za-z0-9]+$ |
directionrequired | "outbound" | "inbound" |
statusrequired | "queued" | "dispatched" | "accepted" | "sent" | "delivered" | "failed" | "received" |
finalStatusrequired | boolean True once status will not change: delivered, failed, received, or sent from a device without delivery reports (an iPhone through Simline for Mac). Stop polling or waiting for webhooks when it is true. |
channelrequired | "sms" | "imessage" | "sms_or_imessage" Outbound: the channel asked for (narrowed to what the device can do). Inbound: what the text arrived as. |
contactrequired | string The other party: E.164, or an alphanumeric sender for inbound. |
bodyrequired | string |
deviceId | string | null |
simSlot | integer | null |
parts | integer | null |
attemptrequired | integer |
errorCode | string | null |
idempotencyKey | string | null |
apiKeyId | string | null |
userId | string | null |
agentId | string | null |
createdAtrequired | string · date-time |
updatedAtrequired | string · date-time |
sentAt | string | null · date-time |
deliveredAt | string | null · date-time |
readAt | string | null · date-time |
{ "id": "msg_4e03f88dc3ae3e703ee205e19b5ad9c7", "direction": "outbound", "status": "queued", "finalStatus": false, "channel": "sms", "contact": "+12125550142", "body": "Hi Maya, your order #1042 is ready for pickup.", "deviceId": "dev_8fK2mQ4xR7sT1bV6hN3cYw", "simSlot": 0, "parts": 1, "attempt": 1, "errorCode": "errorCode", "idempotencyKey": "order-1042-ready", "apiKeyId": "apiKeyId", "userId": "userId", "agentId": "agentId", "createdAt": "2026-11-28T09:13:57.390Z", "updatedAt": "2026-11-28T09:13:57.390Z", "sentAt": "2026-11-28T09:13:57.390Z", "deliveredAt": "2026-11-28T09:13:57.390Z", "readAt": "2026-11-28T09:13:57.390Z"}Errors
Errors are JSON: {"error": "<code>", "message": "<a sentence>"}. Branch on error, show message. Every code is explained in Errors.
| Status | error | When |
|---|---|---|
| 400 | bad_request | Invalid body or sender |
| 401 | unauthorized | Missing or invalid API key / session |
| 402 | plan_limit_texts | This month's texts on the workspace's plan are used up (plan_limit_texts) |
| 403 | forbiddenworkspace_suspendedsending_paused_review | API key lacks the required scope (forbidden), the workspace is suspended (workspace_suspended), or new texts are paused pending review (sending_paused_review; replies to contacts who texted first still go out). Both carry supportEmail. |
| 409 | no_devicedevice_update_requiredcontact_opted_out | No phone can send (no_device), from names a device whose app must be updated first (device_update_required), or the contact texted STOP and opted out (contact_opted_out; they opt back in by texting START) |
| 429 | usage_limitramp_limit | Daily send limit reached (usage_limit), or a new workspace's daily ramp (ramp_limit, with limit, used, liftsAt, nextLimit, nextStepAt, graduatesAt and Retry-After; replies to contacts who texted first are never refused by it) |
| 500 | internal | Internal error |
| 503 | dispatch_failed | The phone's session could not take the message (dispatch_failed) |
Examples
Set SIMLINE_API_KEY to your key first. Node examples use the built-in fetch (Node 18+, run as an ES module); Python uses requests.
curl -X POST "https://api.simline.dev/v1/messages" \ -H "Authorization: Bearer $SIMLINE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"to":"+12125550142","body":"Hi Maya, your order #1042 is ready for pickup.","idempotencyKey":"order-1042-ready"}'const res = await fetch("https://api.simline.dev/v1/messages", { method: "POST", headers: { Authorization: `Bearer ${process.env.SIMLINE_API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ "to": "+12125550142", "body": "Hi Maya, your order #1042 is ready for pickup.", "idempotencyKey": "order-1042-ready" })})if (!res.ok) { const err = await res.json() throw new Error(`${res.status} ${err.error}: ${err.message}`)}console.log(await res.json())import os
import requests
r = requests.post( "https://api.simline.dev/v1/messages", headers={"Authorization": f"Bearer {os.environ['SIMLINE_API_KEY']}"}, json={ "to": "+12125550142", "body": "Hi Maya, your order #1042 is ready for pickup.", "idempotencyKey": "order-1042-ready", }, timeout=15,)if not r.ok: err = r.json() raise RuntimeError(f"{r.status_code} {err['error']}: {err['message']}")print(r.json())