Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.segments.update(
'748395130237498560',
{
description: 'Customers that must always receive high-priority messaging.',
color: '#2563EB',
},
);
if (error) throw error;{
"ok": true,
"data": null
}Segments
Update a segment
Update the name, description or color of an existing segment.
PATCH
/
segments
/
{id}
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.segments.update(
'748395130237498560',
{
description: 'Customers that must always receive high-priority messaging.',
color: '#2563EB',
},
);
if (error) throw error;{
"ok": true,
"data": null
}Authorizations
Send your API key as Authorization: Bearer rw_....
Required scope: project:write.
Path Parameters
Segment identifier returned by Rewrite.
Example:
"748395130237498412"
Body
application/json
Updated segment name.
Required string length:
1 - 80Example:
"priority-customers"
Updated description.
Required string length:
1 - 280Example:
"Customers that must always receive high-priority messaging."
Updated hexadecimal accent color.
Pattern:
^#[0-9A-Fa-f]{6}$Example:
"#2563EB"