Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error, cursor } = await rewrite.segments.list({
limit: 25,
});
if (error) throw error;{
"ok": true,
"data": [
{
"id": "748395130237498560",
"createdAt": "2026-03-20T14:22:31.562Z",
"name": "vip-customers",
"description": "Customers with priority transactional flows.",
"color": "#0EA5E9",
"contactsCount": 12,
"sandbox": false,
"updatedAt": "2026-03-20T14:22:31.562Z"
}
],
"cursor": {
"persist": false
}
}Segments
List segments
List segments stored in the current project. Results are paginated with a top-level cursor.
GET
/
segments
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { data, error, cursor } = await rewrite.segments.list({
limit: 25,
});
if (error) throw error;{
"ok": true,
"data": [
{
"id": "748395130237498560",
"createdAt": "2026-03-20T14:22:31.562Z",
"name": "vip-customers",
"description": "Customers with priority transactional flows.",
"color": "#0EA5E9",
"contactsCount": 12,
"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.
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