Skip to content
Get Started
API v2

Messages

Query, filter, and manage messages

The messages API provides endpoints to list, retrieve, and delete messages from your account.

GET /api/v2/messages

Retrieve messages with filtering and pagination.

ParameterTypeDefaultDescription
limitinteger100Results per page (1-100)
offsetinteger0Pagination offset
order_bystringcreatedAtSort field
order_directionstringdescasc or desc
statusstring—Filter by status
servicestring—iMessage, SMS, or RCS
is_outboundboolean—true or false
message_typestring—message or group
from_numberstring—Sender phone
to_numberstring—Recipient phone
numberstring—Either party’s phone
group_idstring—Filter by group
sendblue_numberstring—Your Sendblue number
created_at_gtestring—Created after (ISO 8601)
created_at_ltestring—Created before (ISO 8601)
sent_at_gtestring—Sent after (ISO 8601)
sent_at_ltestring—Sent before (ISO 8601)
Terminal window
curl "https://api.sendblue.com/api/v2/messages?service=iMessage&is_outbound=true&limit=50" \
-H "sb-api-key-id: YOUR_API_KEY" \
-H "sb-api-secret-key: YOUR_API_SECRET"
{
"status": "OK",
"data": [
{
"message_handle": "5a17319e-cbcf-443e-897e-d8b0c04b1b09",
"accountEmail": "user@example.com",
"content": "Hello",
"from_number": "+15551234567",
"to_number": "+19998887777",
"number": "+19998887777",
"status": "DELIVERED",
"service": "iMessage",
"is_outbound": true,
"date_sent": "2025-01-15T10:30:00.000Z",
"date_updated": "2025-01-15T10:30:05.000Z",
"media_url": "",
"was_downgraded": false,
"message_type": "message",
"group_id": "",
"group_display_name": "",
"send_style": ""
}
],
"pagination": {
"limit": 100,
"offset": 0,
"total": 1
}
}
GET /api/v2/messages/:message_id

Retrieve a single message by ID.

Terminal window
curl "https://api.sendblue.com/api/v2/messages/5a17319e-cbcf-443e-897e-d8b0c04b1b09" \
-H "sb-api-key-id: YOUR_API_KEY" \
-H "sb-api-secret-key: YOUR_API_SECRET"
DELETE /api/message/:message_handle

Remove a message from the Sendblue database.

Note: This is a soft delete. It removes the message from Sendblue’s database only. It does not unsend or recall the message from the recipient’s device.

Terminal window
curl -X DELETE "https://api.sendblue.com/api/message/5a17319e-cbcf-443e-897e-d8b0c04b1b09" \
-H "sb-api-key-id: YOUR_API_KEY" \
-H "sb-api-secret-key: YOUR_API_SECRET"
{
"status": "OK",
"message": "Message deleted"
}
StatusDescription
QUEUEDMessage queued for sending
PENDINGMessage being processed
SENTMessage sent to carrier
DELIVEREDMessage delivered to recipient
ERRORDelivery failed
DECLINEDMessage rejected by system
RECEIVEDInbound message received
ACCEPTEDMessage accepted for processing
SUCCESSMessage processed successfully
REGISTEREDMessage registered in system
FieldTypeDescription
message_handlestringUnique message ID
contentstringMessage text
from_numberstringSender phone (E.164)
to_numberstringRecipient phone (E.164)
statusstringCurrent status
servicestringiMessage, SMS, or RCS
is_outboundbooleanTrue if sent, false if received
date_sentstringSend timestamp (ISO 8601)
date_updatedstringLast update (ISO 8601)
media_urlstringCDN URL for attachments
was_downgradedbooleanTrue if fell back to SMS
message_typestringmessage or group
group_idstringGroup identifier
participantsarrayPhone numbers in conversation
send_stylestringiMessage effect used
app_cardobjectApp Card data sent or received with the message. See App Cards.
opted_outbooleanRecipient opted out
sendblue_numberstringYour Sendblue number
numberstringContact phone number
accountEmailstringAccount email
group_display_namestringDisplay name for group chats
error_codeintegerError code if failed
error_messagestringThe rule’s key when a rule declined the message (same as error_key), otherwise an error description
error_keystringStable key of the rule that declined the message, null otherwise. Branch on this field
error_reasonstringHuman-readable text for display, do not parse
error_detailstringAdditional error context
reply_toobjectImmediate parent of an inline reply, with message_handle and optional server-reported part metadata
thread_originatorobjectThread root, with message_handle and optional opaque Apple part descriptor