API Reference
Add Contact to Segment
POST /contacts/:id/segments/:segment_id — add an existing contact to a segment.
POST
/contacts/:id/segments/:segment_idAdd an existing contact to a segment. The contact is identified in the path by either its ID or its email address.
Either id or email must be provided.
Path parameters
idstringoptionalThe Contact ID.
emailstringoptionalThe Contact Email.
segment_idstringrequiredThe Segment ID.
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr('mb_xxxxxxxxx');
const { data, error } = await mb.contacts.addToSegment('e169aa45-1ecf-4183-9955-b1499d5701d3', '78261eea-8f8b-4381-83c6-79fa7120f1cf');
console.log({ data, error });Response
{
"id": "78261eea-8f8b-4381-83c6-79fa7120f1cf"
}