Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.segments.attachContact(
'748395130237498560',
{ contactId: '748395130237498515' },
);
if (error) throw error;{
"ok": true,
"data": null
}Segments
Attach one contact to a segment
Attach a single existing contact to one segment.
POST
/
segments
/
{id}
/
contacts
Node.js
import { Rewrite } from '@rewritetoday/sdk';
const rewrite = new Rewrite(process.env.REWRITE_API_KEY!);
const { error } = await rewrite.segments.attachContact(
'748395130237498560',
{ contactId: '748395130237498515' },
);
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
Contact identifier that should be attached to the segment.
Example:
"748395130237498515"