Get started →
API reference

Messages API

Send and list SMS messages through Ruut Voice.

Message resource

{
  "sid": "SM…",
  "account_sid": "AC…",
  "to": "+2348000000001",
  "from": "+2348000000002",
  "body": "Your verification code is 1234",
  "status": "queued",
  "direction": "outbound-api",
  "num_segments": "1",
  "date_created": "…",
  "uri": "/2010-04-01/Accounts/AC…/Messages/SM…"
}

Status values

queuedsendingsentdelivered, or terminal failed.

Send a message

POST/2010-04-01/Accounts/{AccountSid}/Messages
ParameterTypeDescription
To requiredstringDestination number in E.164.
From requiredstringYour Ruut Voice number in E.164. Either From or MessagingServiceSid is required.
Body requiredstringMessage text (max 1600 chars).
MessagingServiceSid optionalstringA messaging service to use instead of From.
StatusCallback optionalstringURL to receive message status webhooks.
SmartEncoded optionalbooleanConvert to GSM encoding when possible.
ValidityPeriod optionalintegerSeconds the message is valid (1–14400).
SendAt optionalstringSchedule the message for a future time (with ScheduleType=fixed).
ScheduleType optionalstringSet to fixed when scheduling with SendAt.

Example

curlbash
curl -X POST "https://voice.ruut.chat/2010-04-01/Accounts/$RUUT_ACCOUNT_SID/Messages" \
  -u "$RUUT_ACCOUNT_SID:$RUUT_AUTH_TOKEN" \
  --data-urlencode "To=+2348000000001" \
  --data-urlencode "From=+2348000000002" \
  --data-urlencode "Body=Your verification code is 1234"

List messages

GET/2010-04-01/Accounts/{AccountSid}/Messages
ParameterTypeDescription
To optionalstringFilter by destination.
From optionalstringFilter by sender.
Page optionalinteger0-indexed page.
PageSize optionalintegerRecords per page (max 1000).

Fetch a message

GET/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}

Return a single message resource.

Update a message

POST/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}

Update a message — typically to record a delivery failure or a price for billing reconciliation.

ParameterTypeDescription
Status optionalstringDelivery status (e.g. sent, delivered, failed).
Price optionalstringCost of the message (for reconciliation).

Delete a message

DELETE/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}

Delete a message record. Use with care — the message is removed permanently.

Response — 204 No Content