Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error, cursor } = await rewrite.segments.contacts(
'748395130237498560',
{ limit: 50 },
);
if (error) throw error;{
"ok": true,
"data": [
{
"id": "748395130237498515",
"createdAt": "2026-03-20T14:22:31.562Z",
"name": "Fernanda",
"phone": "+5511999999999",
"country": "br",
"channel": "SMS",
"preferredLanguages": [
"br",
"us"
],
"tags": {
"flow": "checkout",
"origin": "import"
},
"sandbox": false,
"updatedAt": "2026-03-20T14:22:31.562Z"
}
],
"cursor": {
"persist": false
}
}Segments
List contacts in a segment
List contacts currently attached to one segment. Results are paginated with a top-level cursor.
GET
/
segments
/
{id}
/
contacts
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error, cursor } = await rewrite.segments.contacts(
'748395130237498560',
{ limit: 50 },
);
if (error) throw error;{
"ok": true,
"data": [
{
"id": "748395130237498515",
"createdAt": "2026-03-20T14:22:31.562Z",
"name": "Fernanda",
"phone": "+5511999999999",
"country": "br",
"channel": "SMS",
"preferredLanguages": [
"br",
"us"
],
"tags": {
"flow": "checkout",
"origin": "import"
},
"sandbox": false,
"updatedAt": "2026-03-20T14:22:31.562Z"
}
],
"cursor": {
"persist": false
}
}Authorizations
Send your API key as Authorization: Bearer rw_....
Required scope: project:read.
Path Parameters
Segment identifier returned by Rewrite.
Example:
"748395130237498412"
Query Parameters
Cursor for forward pagination. Send exactly one of after or before when paginating.
Example:
"748395130237498412"
Cursor for backward pagination. Send exactly one of after or before when paginating.
Example:
"748395130237498412"
Page size. Backend cursor schemas validate this between 2 and the route-specific maximum.
Required range:
2 <= x <= 100