import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error, cursor } = await rewrite.messages.list({
limit: 25,
status: 'DELIVERED',
});
if (error) throw error;{
"ok": true,
"data": [
{
"id": "748395130237498412",
"createdAt": "2026-03-20T14:22:31.562Z",
"contact": "Fernanda",
"contactId": "748395130237498515",
"to": "+5511999999999",
"from": null,
"type": "SMS",
"tags": {
"flow": "login",
"origin": "checkout"
},
"status": "DELIVERED",
"country": "br",
"content": "Rewrite: seu codigo e 478201",
"encoding": "GSM7",
"templateId": null,
"deliveredAt": "2026-03-20T14:22:39.914Z",
"scheduledAt": null,
"sandbox": false
},
{
"id": "748395130237498413",
"createdAt": "2026-03-20T14:22:31.562Z",
"contact": "Fernanda",
"contactId": "748395130237498515",
"to": "+5511888888888",
"from": null,
"type": "SMS",
"tags": {
"flow": "login",
"origin": "checkout"
},
"status": "SENT",
"country": "br",
"content": "Rewrite: seu codigo e 478201",
"encoding": "GSM7",
"templateId": null,
"deliveredAt": null,
"scheduledAt": null,
"sandbox": false
}
],
"count": 2,
"cursor": {
"persist": true,
"after": "748395130237498414"
}
}List messages
List accepted messages for the current project. Results are returned in reverse chronological order with a top-level cursor for pagination.
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error, cursor } = await rewrite.messages.list({
limit: 25,
status: 'DELIVERED',
});
if (error) throw error;{
"ok": true,
"data": [
{
"id": "748395130237498412",
"createdAt": "2026-03-20T14:22:31.562Z",
"contact": "Fernanda",
"contactId": "748395130237498515",
"to": "+5511999999999",
"from": null,
"type": "SMS",
"tags": {
"flow": "login",
"origin": "checkout"
},
"status": "DELIVERED",
"country": "br",
"content": "Rewrite: seu codigo e 478201",
"encoding": "GSM7",
"templateId": null,
"deliveredAt": "2026-03-20T14:22:39.914Z",
"scheduledAt": null,
"sandbox": false
},
{
"id": "748395130237498413",
"createdAt": "2026-03-20T14:22:31.562Z",
"contact": "Fernanda",
"contactId": "748395130237498515",
"to": "+5511888888888",
"from": null,
"type": "SMS",
"tags": {
"flow": "login",
"origin": "checkout"
},
"status": "SENT",
"country": "br",
"content": "Rewrite: seu codigo e 478201",
"encoding": "GSM7",
"templateId": null,
"deliveredAt": null,
"scheduledAt": null,
"sandbox": false
}
],
"count": 2,
"cursor": {
"persist": true,
"after": "748395130237498414"
}
}Authorizations
Send your API key as Authorization: Bearer rw_....
Required scope: message:read.
Query Parameters
Cursor for forward pagination. Send exactly one of after or before when paginating.
"748395130237498412"
Cursor for backward pagination. Send exactly one of after or before when paginating.
"748395130237498412"
Page size. Backend cursor schemas validate this between 2 and the route-specific maximum.
2 <= x <= 100Filter by message status.
SENT, QUEUED, FAILED, CANCELED, RECEIVED, SCHEDULED, DELIVERED Lowercase ISO 3166-1 alpha-2 country code inferred from the destination number.
"br"
Filter by message encoding.
GSM7, UCS2 Filter by whether the message has scheduledAt set.
When true, include a top-level count field with the total matching records.
Response
Successful response
Show child attributes
Show child attributes
[ { "id": "748395130237498412", "createdAt": "2026-03-20T14:22:31.562Z", "contact": "Fernanda", "contactId": "748395130237498515", "to": "+5511999999999", "from": null, "type": "SMS", "tags": { "flow": "login", "origin": "checkout" }, "status": "DELIVERED", "country": "br", "content": "Rewrite: seu codigo e 478201", "encoding": "GSM7", "templateId": null, "deliveredAt": "2026-03-20T14:22:39.914Z", "scheduledAt": null, "sandbox": false }, { "id": "748395130237498413", "createdAt": "2026-03-20T14:22:31.562Z", "contact": "Fernanda", "contactId": "748395130237498515", "to": "+5511888888888", "from": null, "type": "SMS", "tags": { "flow": "login", "origin": "checkout" }, "status": "SENT", "country": "br", "content": "Rewrite: seu codigo e 478201", "encoding": "GSM7", "templateId": null, "deliveredAt": null, "scheduledAt": null, "sandbox": false } ]
Show child attributes
Show child attributes
Only returned when withCounts=true is provided on the request.
2