Skip to main content
A segment is a filter saved on a list. Build it in the interface (Segments) or here, in JSON.

Create a segment

“VIP customers, or those who opened the back-to-school campaign, and active in the last 60 days”:
The 201 answer carries the segment and subscribers_count, how many people it names at that moment. Members are worked out again at every send: a segment is never frozen.

The shape

  • A group: { "operator": "and" | "or", "rules": [ … ] }.
  • A rule: { "type", "operator", "value", "key" }.
  • A group may hold rules and groups, two levels deep at most.
  • 50 rules in all, at most.
Only subscribers of the list whose status is subscribed are counted.

The rules

Fields of the record

type: email, first_name, last_name.

Tags

type: tags. value is an array of tag names or ids from the list. An unknown tag is refused.

Language

type: language. operator: equals or not_equals. value: a code such as fr or pt-BR.

Attributes

type: attribute, with key the name of the attribute (letters, digits, _, ., -).

Subscription date

type: subscribed_at.

Activity

Other lists

type: list. operator: subscribed_to or not_subscribed_to. value: the id of another list of the team.

Read, change, delete

In the answers, tags come back as names and the other references as ids, just as you sent them.

Errors

An invalid rule answers 422 with the exact path: