create_segment
Create an audience segment: a saved, dynamic filter over contacts. match all|any combines the rules; lists (by NAME) narrows the base, omitted = all contacts. 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"}. Rules are validated before any API call; set dry_run: true to preview.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Segment name, 1-100 characters, unique | |
| lists | No | List NAMES to evaluate (max 150). Omit to evaluate all contacts | |
| match | Yes | all = every rule must match; any = one rule is enough | |
| rules | Yes | At least one rule | |
| dry_run | No | Validate the rules and show the request without creating anything |