Outbound Messaging API

Send SMS / MMS

Send programmatic SMS and MMS messages, track delivery, and stay compliant.

Want an AI assistant such as Claude or ChatGPT to send texts for you? The CallNode MCP server sends them under the same rules as this API.

Send a message

POST/api/v1/messages
Sends an SMS or MMS from one of your messaging-enabled numbers. Returns 202 once the carrier accepts it. Delivery is then tracked via GET on the same id, or the optional status webhook.
Base URL & auth
Base URL is https://api.callnode.io. Requests are signed with the same X-Api-Key / X-Timestamp / X-Signature HMAC scheme as the Outbound Calls API — a single API key works for both. See Authentication.
Test Mode
Send with a cn_test_ key to build without sending real messages or being charged. Every compliance check still runs, and you receive a simulated, signed delivery webhook. See Test Mode.

Signing example

JavaScript
// Same HMAC scheme as the Outbound Calls API — one API key works for both.
const crypto = require('crypto');
const body = JSON.stringify(payload);                 // exact bytes you send
const ts   = Math.floor(Date.now() / 1000).toString();
const sig  = crypto.createHmac('sha256', apiSecret)
                   .update(ts + '\n' + body)
                   .digest('hex');
// Headers: X-Api-Key, X-Timestamp: ts, X-Signature: sig,
//          X-Idempotency-Key: <uuid>, Content-Type: application/json

Request body

FieldTypeRequiredDescription
tostring (E.164)RequiredRecipient. Plus sign followed by 7–15 digits.
fromstring (E.164)RequiredA messaging-enabled DID you own with an approved 10DLC campaign.
bodystringOptionalMessage text. Required unless media is provided. SMS segments are billed (160 GSM-7 / 70 Unicode chars each).
mediastring[]OptionalPresence makes the message an MMS. Each entry is either a public URL or the file itself as a base64 data URL (data:image/png;base64,…). JPG, PNG, GIF, WebP, MP4 and PDF; up to 5 MB each. CallNode stores a copy and delivers from its own URL, so a short-lived link or a file you cannot host (an image a model just generated) both work.
statusWebhookUrlstringOptionalWe POST message.delivered / message.failed events here. Must be a public http:// or https:// address: a loopback, private or internal address is refused with 400 blocked_destination and the message is not sent.
tcpaOverridebooleanOptionalBypass the 8a–9p quiet-hours check (audited). Use only for transactional / relationship messages.
metadataobjectOptionalOpaque JSON, echoed back on retrieval and status webhooks.

Example request body

JSON
{
  "to":               "+16135551234",
  "from":             "+15145550199",
  "body":             "Your demo is confirmed for Wednesday at 10am.",
  "media":            [],
  "statusWebhookUrl": "https://yourcrm.example.com/sms/events",
  "tcpaOverride":     false,
  "metadata":         { "leadId": "lead_abc123" }
}

Success response — 202 Accepted

JSON
{
  "id":        "cmpt5ec0w00022hb2etd67258",
  "status":    "sent",
  "cost":      0.01,
  "segments":  1,
  "idempotencyReplay": false
}

Reusing an X-Idempotency-Key returns the original message withidempotencyReplay: true and does not send or charge twice.

Get message status

GET/api/v1/messages/:id
JSON
{
  "id":           "cmpt5ec0w00022hb2etd67258",
  "status":       "delivered",
  "from":         "+15145550199",
  "to":           "+16135551234",
  "messageType":  "sms",
  "segments":     1,
  "cost":         0.01,
  "errorCode":    null,
  "errorMessage": null,
  "deliveredAt":  "2026-05-31T18:04:11.221Z",
  "createdAt":    "2026-05-31T18:04:08.004Z",
  "metadata":     { "leadId": "lead_abc123" }
}

Delivery states

StatusTerminalDescription
sentnoCarrier accepted the message; awaiting a delivery receipt.
deliveredyesCarrier confirmed delivery to the handset.
failedyesDelivery failed. See errorCode / errorMessage.

Status webhooks

Set statusWebhookUrl on a send and we POST a signed event to it when the message reaches a terminal state. Only delivered andfailed fire — sent is not terminal, so it does not trigger a callback. Your metadata is echoed back verbatim.

message.delivered

JSON
{
  "event":       "message.delivered",
  "id":          "cmpt5ec0w00022hb2etd67258",
  "messageId":   "1785606116131zibvh2ezw4jaut4q",
  "from":        "+15145550199",
  "to":          "+16135551234",
  "status":      "delivered",
  "timestamp":   "2026-05-31T18:04:11.221Z",
  "errorCode":   null,
  "deliveredAt": "2026-05-31T18:04:11.221Z",
  "metadata":    { "leadId": "lead_abc123" }
}

message.failed

JSON
{
  "event":       "message.failed",
  "id":          "cmpt5ec0w00022hb2etd67258",
  "messageId":   "1785606116131zibvh2ezw4jaut4q",
  "from":        "+15145550199",
  "to":          "+16135551234",
  "status":      "failed",
  "timestamp":   "2026-05-31T18:04:12.880Z",
  "errorCode":   "4406",
  "deliveredAt": null,
  "metadata":    { "leadId": "lead_abc123" }
}

messageId is the carrier's id; id is the CallNode id you received from the send and can use with GET /api/v1/messages/:id.

Delivery headers

HeaderValue / Purpose
Content-Typeapplication/json
X-TimestampUnix seconds at delivery time. Use this when verifying.
X-Signaturehex-encoded HMAC-SHA256(yourSecret, ts + "\n" + body), signed with the secret of the API key that sent the message.
X-Event-SourceAlways callnode-outbound. Use to disambiguate from other webhook sources sharing the URL.

Verify the signature

verifyStatusWebhook.jsJavaScript
// Verify before trusting the payload. Use the RAW body, not a re-serialised object.
const expected = crypto
  .createHmac('sha256', apiSecret)
  .update(req.headers['x-timestamp'] + '\n' + rawBody)
  .digest('hex');

const ok = crypto.timingSafeEqual(
  Buffer.from(req.headers['x-signature']),
  Buffer.from(expected)
);
if (!ok) return res.status(401).json({ error: 'bad signature' });
Use the raw body
Compute the signature over the exact bytes we sent — not over your framework's parsed JSON re-stringified. In Express, capture the raw body via express.json({ verify }) before the body is parsed.

Messages sent from the dashboard rather than the API arrive unsigned, because there is no API key to sign with. If your endpoint rejects unsigned requests, send via the API.

Compliance (enforced automatically)

You are the sender of record
Every send is gated server-side. These checks protect your 10DLC standing — they are not optional, and the relevant ones cannot be bypassed.

STOP / opt-out. When a recipient texts STOP (or UNSUBSCRIBE, CANCEL, END, QUIT) to your number, they are suppressed; further sends to them return 403 recipient_opted_out. START re-enables them. This cannot be overridden.

TCPA quiet hours. Messages are blocked with403 tcpa_window_violationoutside 8 AM–9 PM at the recipient's local time (NPA-NXX → IANA timezone, DST-aware). Set tcpaOverride: truefor permissible transactional messages. Numbers in your Phone Book (your own office, home or family lines, certified once in the dashboard) are not subject to the window; STOP and 10DLC still apply to them.

10DLC registration. The from number must be associated with an approved 10DLC campaign, or the send returns403 campaign_not_registered. This cannot be overridden.

HTTP response codes

StatusMeaning
200Idempotency replay. Original message returned.
202Accepted. Message handed to the carrier.
400Body malformed (missing to, or no body/media), or invalid_media: an inline file of an unsupported type or over 5 MB.
401Auth failed (invalid signature, clock skew, revoked key).
402Wallet balance below the message cost.
403from_not_owned, recipient_opted_out, tcpa_window_violation, or campaign_not_registered.
404Message not found.
429Rate limit exceeded.
502Carrier rejected the message.