Skip to main content
POST
/
api
/
messages
curl -X POST https://api.example.com/api/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+15551234567",
    "body": "Hello from the messaging API!",
    "from": "+15559876543"
  }'
{
  "sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "status": "queued"
}

Authentication

This endpoint requires API key authentication. Include your API key in the Authorization header.
Authorization: Bearer YOUR_API_KEY

Request Body

to
string
required
The destination phone number in E.164 format (e.g., +15551234567)
body
string
required
The text content of the message to send
from
string
The sender phone number. If not provided, the default messaging service number will be used

Response

sid
string
The unique identifier for the sent message from the provider
status
string
The current status of the message (e.g., “queued”, “sent”, “delivered”)
{
  "sid": "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "status": "queued"
}

Error Responses

error
string
The error code indicating what went wrong
detail
string
Additional details about the error

Error Codes

  • missing_params (400) - Required parameters are missing from the request
  • provider_not_configured (400) - The workspace doesn’t have a messaging provider configured
  • send_failed (500) - Message sending failed due to an internal error
curl -X POST https://api.example.com/api/messages \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+15551234567",
    "body": "Hello from the messaging API!",
    "from": "+15559876543"
  }'