update_segment
Change a segment. Give only what changes: name, match, lists (list names, or all_contacts: true for every contact) or rules; everything left out is kept from the current definition. Rules are replaced as a set, so to change one rule pass all of them (get_segment shows the current rules). The preview shows the full result; it needs confirm: true to apply. Each rule has a filter_type: contact_details (built-in field: email_status, verification_status, contact_rating, email_domain, mailbox_provider, signup_source; mailbox_provider and signup_source take operator was or was_not), contact_property (a built-in contact field such as country, city, state or job_title, with property_type text|number|date; Mailercloud does not yet accept custom fields here, so a segment on a custom field is built in Mailercloud under Audience > Segments), tag (operator is_tagged|is_not_tagged, filter_by any_of|all_of, value = tag IDs), or activity (category + activity + filter_by). Operators ending in is_known/is_unknown take no value; any_of takes an array; between/date_between take {from,to}; in_the_last_days takes 1-200 days. For campaign activity, filter_by is one of for, between, any_of_the_last_five, all_of_the_last_five, any_of_last_seven_day, any_of_last_one_month, any_of_last_three_month; for an exact number of days use category subscriber_opened or subscriber_clicked (with match all). The API does not let a rule target one specific campaign. Example 1, contacts who opened any campaign in the last month: {"filter_type":"activity","category":"campaign","activity":"opened","filter_by":"any_of_last_one_month"}; for exactly 30 days: {"filter_type":"activity","category":"subscriber_opened","filter_by":"in_the_last_days","value":30}. Example 2, country is India: {"filter_type":"contact_property","field":"country","property_type":"text","operator":"equal_to","value":"India"}. Set dry_run: true to preview.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | New segment name; leave out to keep the current one | |
| lists | No | New list NAMES the segment evaluates; leave out to keep the current lists | |
| match | No | all or any; leave out to keep the current one | |
| rules | No | The complete new rule set, replacing every current rule; leave out to keep the current rules (get_segment shows them) | |
| confirm | No | Must be true to replace the segment. Leave it out first to get a preview, show it to the user, and ask them to confirm | |
| dry_run | No | Validate the rules and show the request without changing anything | |
| segment_id | Yes | Segment ID (as returned by create_segment) | |
| all_contacts | No | Set true to evaluate all contacts instead of specific lists |