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

write

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

Parameters: change_contact_segments
NameTypeDescription
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
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"]}'
Python
result = client.call("mautic", "change_contact_segments", {"contact_ids":[1042,1388,1410],"add":["newsletter"]})
Node.js
const result = await cotlet.call('mautic', 'change_contact_segments', {"contact_ids":[1042,1388,1410],"add":["newsletter"]});
CLI
cotlet call mautic change_contact_segments --data '{"contact_ids":[1042,1388,1410],"add":["newsletter"]}'

Example response

JSON

{
  "updated": 3,
  "added": [
    "newsletter"
  ],
  "removed": []
}

Sign in once. Your agent does the rest.

Sign up and add the apps you need. Free 7-day trial with 2,000 credits, no card needed.