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
statusstringFilter by status
servicestringiMessage, SMS, or RCS
is_outboundbooleantrue or false
message_typestringmessage or group
from_numberstringSender phone
to_numberstringRecipient phone
numberstringEither party’s phone
group_idstringFilter by group
sendblue_numberstringYour Sendblue number
created_at_gtestringCreated after (ISO 8601)
created_at_ltestringCreated before (ISO 8601)
sent_at_gtestringSent after (ISO 8601)
sent_at_ltestringSent before (ISO 8601)
Terminal window
curl "https://api.sendblue.co/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": "[email protected]",
"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.co/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.co/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
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_messagestringError description
error_reasonstringMachine-readable error
error_detailstringAdditional error context