Send a text message▾
POST

Send a text message

Send free-form text inside an open 24-hour customer service window.

Free-form messages are only allowed while a customer service window is open — that is, within 24 hours of the contact's last inbound message. Outside it, use send a template message.

Check the window before you send

GET /v1/conversations/{wa_id} returns session_expires_at. If it is in the past, a free-form send returns 422 session_window_closed.
POST/v1/messages

Body parameters

tostringrequired

Recipient in E.164 format, e.g. +201005550123.

typeenumrequired

Set to text.

text

textobjectrequired

The message body.

bodystringrequired

Up to 4096 characters. Supports WhatsApp markdown.

preview_urlbooleandefault false

Render a link preview for the first URL in the body.

fromstring

Sending number. Defaults to the account's primary number.

reply_tostring

A wamid to quote-reply to.

curl -X POST https://api.sendport.tech/v1/messages \
  -H "Authorization: Bearer $SENDPORT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to":"+201005550123","type":"text","text":{"body":"Your table is ready."}}'

Responses

202Accepted
{
  "object": "message",
  "id": "msg_01JZQ3F8X2K7N4B6Y0R9M5TCWA",
  "wamid": "wamid.SEJnTTIwMTAwNTU1MDEyM0ZRSUFFUmdT",
  "conversation_id": "conv_01JZQ3F8X0QG7T2S4N8V1PZAKD",
  "from": "+15550100200",
  "to": "+201005550123",
  "direction": "outbound",
  "type": "text",
  "text": { "body": "Your table is ready." },
  "status": "accepted",
  "pricing": { "category": "utility", "billable": true, "amount": "0.0286", "currency": "USD" },
  "created_at": "2026-09-06T09:14:22.114Z"
}
422Session closed
{
  "error": {
    "type": "invalid_request_error",
    "code": "session_window_closed",
    "message": "The 24-hour customer service window for +201005550123 closed at 2026-09-05T18:02:11Z. Send an approved template instead.",
    "param": "type",
    "doc_url": "https://sendport.tech/docs/errors#session_window_closed",
    "request_id": "req_2c81ff40aa7d4e1b9c05"
  }
}
401Unauthorized
{
  "error": {
    "type": "authentication_error",
    "code": "missing_api_key",
    "message": "No API key provided.",
    "doc_url": "https://sendport.tech/docs/errors#missing_api_key",
    "request_id": "req_9f3c2a7b41de08c5b2e6"
  }
}
Try itsandbox