Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.segments.attachContacts(
'748395130237498560',
{ ids: ['748395130237498515', '748395130237498516'] },
);
if (error) throw error;{
"ok": true,
"data": null
}Segments
Attach contacts to a segment in bulk
Attach between 2 and 100 existing contacts to one segment.
POST
/
segments
/
{id}
/
contacts
/
attach
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.segments.attachContacts(
'748395130237498560',
{ ids: ['748395130237498515', '748395130237498516'] },
);
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
Required array length:
2 - 100 elements