Change contact segments
Adds contacts to segments and removes them from others, like the Change Segments batch action.
PATCH https://cotlet.dev/api/v1/mautic/contact-segments
Applies the Change Segments batch action to the contacts you list: they join the segments in add and leave the ones in remove. Only static segments take hand-picked members, because a dynamic segment is decided by its filters. It reaches nobody by itself, and one call with add and remove swapped undoes it, so it does not wait for your OK; a campaign that starts from the segment may email the new members.
Parameters
| Name | Type | Description |
|---|---|---|
| contact_ids array required | array | Contact IDs from list_contacts. |
| add array | array | Segment aliases to add the contacts to. |
| remove array | array | Segment aliases to remove the contacts from. |
Request
curl -X PATCH https://cotlet.dev/api/v1/mautic/contact-segments \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contact_ids":[1042,1388,1410],"add":["newsletter"]}' result = client.call("mautic", "change_contact_segments", {"contact_ids":[1042,1388,1410],"add":["newsletter"]}) const result = await cotlet.call('mautic', 'change_contact_segments', {"contact_ids":[1042,1388,1410],"add":["newsletter"]}); cotlet call mautic change_contact_segments --data '{"contact_ids":[1042,1388,1410],"add":["newsletter"]}' Example response
{
"updated": 3,
"added": [
"newsletter"
],
"removed": []
}