Update a segmentMenu

Update a segment

PATCH/v1/segments/{id}

Requires an API key with the segments:write scope. About keys and scopes

Works with integration, agent and partner keys.

Safe to retry: a repeat sets the same values again. About idempotency

Replaces the segment's rules, renames it or changes its description. Changing rules changes who the segment matches from the next evaluation onward; campaigns already sent are unaffected. When an agent key changes the rules, everything that uses the segment, directly or through segments that name it, waits for a person again: scheduled campaigns are unscheduled, active journeys are paused, and each needs a human confirmation before it sends. While a campaign that uses it is still sending or deciding an A/B test, an agent key cannot change the rules (403 AGENT_KEY_REFUSED).

Path parameters

idstringrequired

The segment's id.

uuid

Header parameters

Kirora-Workspacestringoptional

Partner keys only: the child workspace to act in, by the external id the partner gave it. Without it, a partner key acts in its own workspace. Any other key that sends it is refused with 403, and an unknown workspace is 404.

pattern ^[A-Za-z0-9._:-]{1,128}$

Request body

namestringoptional

Unique within the workspace.

1–255 characters

descriptionstring | nulloptional

What the segment is for, up to 1,000 characters; null clears it.

1–1,000 characters

rulesobjectoptional

Replaces the whole rule tree.

Any of 2 shapes
Match all
1 child attribute
allobject[]required

Every rule or nested group must match.

at least 1 item · at most 20 items

Any of 10 shapes
Attribute
5 child attributes
type"attribute"required
fieldstringrequired

attributes.<key>, e.g. attributes.plan.

pattern ^attributes\.[\p{L}\p{N}\p{M}_.-]{1,64}$

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Contact field
5 child attributes
type"contact"required
fieldstringrequired

The contact column to test. Each takes these operators, and is refused with others: email: equals, notEquals, contains, startsWith, exists, notExists, in; firstName: equals, notEquals, contains, startsWith, exists, notExists, in; lastName: equals, notEquals, contains, startsWith, exists, notExists, in; phone: equals, notEquals, contains, startsWith, exists, notExists, in; timezone: equals, notEquals, contains, startsWith, exists, notExists, in; externalId: equals, notEquals, contains, startsWith, exists, notExists, in; consent.email: equals; consent.push: equals; country: equals, notEquals, in, exists, notExists; locale: equals, notEquals, startsWith, in, exists, notExists; createdAt: before, after, withinLastDays, moreThanDaysAgo; recordSource: equals, notEquals, in; recordSourceId: equals, notEquals, in, exists, notExists; rfmGroup: equals, notEquals, in, exists, notExists; rfmRecency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmFrequency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmMonetary: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; purchaseCount: equals, gt, gte, lt, lte; totalSpent: equals, gt, gte, lt, lte; lastPurchasedAt: before, after, withinLastDays, moreThanDaysAgo, exists, notExists; daysBetweenPurchases: gt, gte, lt, lte, exists, notExists; purchaseOverdueRatio: gt, gte, lt, lte, exists, notExists; purchaseCycleStatus: equals, notEquals, in, exists, notExists. phone holds +country numbers: write equals, notEquals and in values with their country code. Consent takes "true" or "false". Purchases: purchaseCount, totalSpent (in the main currency) and lastPurchasedAt are a customer's totals of the workspace's purchase event (purchaseEvent in workspace settings: an order, a paid invoice), recomputed daily; the contact's stored totalSpent is null when the workspace's purchases carry no amount. In comparisons on purchaseCount and totalSpent a missing count or spend is 0, so someone who never purchased has 0 purchases and 0 spent. RFM: rfmGroup and its scores rfmRecency, rfmFrequency and rfmMonetary (monetary value: how much they spend) come from the same daily pass. A score is a whole number from 1 to 5, written as text ("5"; values of them for in), 5 being the most recent, most frequent or highest spending; any other value is refused with 400. Someone who never purchased has no rfmGroup or scores: on those four fields they match only notExists and notEquals. So rfmRecency notEquals 5 includes everyone who never purchased; add an exists rule on the same field to leave them out (bought, but not recently). Record source: recordSource is how the contact was first added, one of dashboard, api, sdk, import, form, integration, transactional, unknown; recordSourceId what added it: a form's, import's, API key's or member's id, or an integration's slug (segment). Together they make "added through Segment": recordSource equals integration and recordSourceId equals segment. Purchase cycle: daysBetweenPurchases is a regular buyer's usual (median) days between purchase days; purchaseOverdueRatio the days since their last purchase over that (1.5 is half a cycle late), worked out when the rule runs; purchaseCycleStatus its label: overdue from 1.5×, lapsed from 2×, dormant from 3×, else on_track. Only a contact with 4 or more purchase days and a regular pattern has them: anyone else matches only notExists and notEquals, and is never called overdue. These three are on plans that include Kiro: elsewhere a rule on them is refused with 403 PLAN_FEATURE_UNAVAILABLE.

one of email, firstName, lastName, phone, timezone, externalId, consent.email, consent.push, country, locale, createdAt, recordSource, recordSourceId, rfmGroup, rfmRecency, rfmFrequency, rfmMonetary, purchaseCount, totalSpent, lastPurchasedAt, daysBetweenPurchases, purchaseOverdueRatio, purchaseCycleStatus

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Event
6 child attributes
type"event"required
namestringrequired

The event name.

1–128 characters

withinDurationInputoptional

Only events from the last within.

notFollowedBystringoptional

Only when this event name did not follow it afterwards.

1–128 characters

countobjectoptional

How often; defaults to at least once. { operator: equals, value: 0 } is "has not done".

whereobject[]optional

Property conditions the event must meet, up to 5; count counts only events meeting all of them.

at least 1 item · at most 5 items

Message activity
9 child attributes
type"activity"required
activitystringrequired

notOpened and notClicked: sent, and not opened or clicked. Opens include machine opens (see openedByMachine).

one of sent, notSent, opened, clicked, notOpened, notClicked, bounced

countobjectoptional

How many messages had this activity; defaults to at least one. Not with notSent.

linkstringoptional

With clicked or notClicked: only clicks on a link whose address contains this text, ignoring case.

1–500 characters

channelstringoptional

Only messages on this channel (opened a push, not an email); any when left out.

one of email, push

campaignIdstringoptional

Only messages of this campaign.

uuid

tagIdstringoptional

Only messages of campaigns or journeys carrying this tag, as they are tagged when the rule is evaluated.

uuid

journeyStepIdstringoptional

Inside a journey only: the message sent by the step with this id in the contact's current enrollment. Matches nobody outside a journey.

pattern ^[a-z0-9][a-z0-9_-]{0,63}$

withinDurationInputoptional

Only activity from the last within. For notOpened and notClicked it is a waiting time instead: only messages sent at least this long ago count, so each has had that long to be opened or clicked.

Push installation
7 child attributes
type"installation"required
hasstringrequired

active: reachable by push (granted, active, not invalidated); none: not.

one of active, none

pushProjectIdstringoptional

Only devices of this push project; any when omitted.

uuid

platformstringoptional

Only devices on this platform; any when omitted.

one of ios, android, web

localestringoptional

Only devices set to this language, as the device last reported it: fr matches fr and fr-CA, fr-CA only fr-CA. Devices that reported none never match.

up to 35 characters

appVersionVersionComparisonInputoptional

Only devices whose app version, as last reported, compares so. A version with text after its numbers (2.1.0-beta) is read by its numbers; one with none never matches.

osVersionVersionComparisonInputoptional

Only devices whose operating system version, as last reported, compares so (17.4 for iOS 17.4, 14 for Android 14). Devices that reported none never match.

List membership
3 child attributes
type"list"required
listIdsstring[]required

One list or several: with member: true in any of them, with false in none of them. Each must be one of the workspace's lists when the rules are saved.

at least 1 item · at most 50 items

memberbooleanrequired

True for in the lists, false for not in them.

Segment membership
3 child attributes
type"segment"required
segmentIdstringrequired

uuid

memberbooleanrequired

True for in the segment, false for not in it.

Topic
4 child attributes
type"topic"required
topicIdstringrequired

One of the workspace's topics when the rules are saved.

uuid

channelstringoptional

Reads the contact's choice for this channel, which overrides their topic-wide choice. Without it, the rule reads the topic-wide choice, which a contact's subscribed shows.

one of email, push

subscribedbooleanrequired

True for contacts the topic reaches, false for those it does not.

Match all
1 child attribute
allobject[]required

Every rule must match.

at least 1 item · at most 20 items

Match any
1 child attribute
anyobject[]required

At least one rule must match.

at least 1 item · at most 20 items

Match any
1 child attribute
anyobject[]required

At least one rule or nested group must match.

at least 1 item · at most 20 items

Any of 10 shapes
Attribute
5 child attributes
type"attribute"required
fieldstringrequired

attributes.<key>, e.g. attributes.plan.

pattern ^attributes\.[\p{L}\p{N}\p{M}_.-]{1,64}$

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Contact field
5 child attributes
type"contact"required
fieldstringrequired

The contact column to test. Each takes these operators, and is refused with others: email: equals, notEquals, contains, startsWith, exists, notExists, in; firstName: equals, notEquals, contains, startsWith, exists, notExists, in; lastName: equals, notEquals, contains, startsWith, exists, notExists, in; phone: equals, notEquals, contains, startsWith, exists, notExists, in; timezone: equals, notEquals, contains, startsWith, exists, notExists, in; externalId: equals, notEquals, contains, startsWith, exists, notExists, in; consent.email: equals; consent.push: equals; country: equals, notEquals, in, exists, notExists; locale: equals, notEquals, startsWith, in, exists, notExists; createdAt: before, after, withinLastDays, moreThanDaysAgo; recordSource: equals, notEquals, in; recordSourceId: equals, notEquals, in, exists, notExists; rfmGroup: equals, notEquals, in, exists, notExists; rfmRecency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmFrequency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmMonetary: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; purchaseCount: equals, gt, gte, lt, lte; totalSpent: equals, gt, gte, lt, lte; lastPurchasedAt: before, after, withinLastDays, moreThanDaysAgo, exists, notExists; daysBetweenPurchases: gt, gte, lt, lte, exists, notExists; purchaseOverdueRatio: gt, gte, lt, lte, exists, notExists; purchaseCycleStatus: equals, notEquals, in, exists, notExists. phone holds +country numbers: write equals, notEquals and in values with their country code. Consent takes "true" or "false". Purchases: purchaseCount, totalSpent (in the main currency) and lastPurchasedAt are a customer's totals of the workspace's purchase event (purchaseEvent in workspace settings: an order, a paid invoice), recomputed daily; the contact's stored totalSpent is null when the workspace's purchases carry no amount. In comparisons on purchaseCount and totalSpent a missing count or spend is 0, so someone who never purchased has 0 purchases and 0 spent. RFM: rfmGroup and its scores rfmRecency, rfmFrequency and rfmMonetary (monetary value: how much they spend) come from the same daily pass. A score is a whole number from 1 to 5, written as text ("5"; values of them for in), 5 being the most recent, most frequent or highest spending; any other value is refused with 400. Someone who never purchased has no rfmGroup or scores: on those four fields they match only notExists and notEquals. So rfmRecency notEquals 5 includes everyone who never purchased; add an exists rule on the same field to leave them out (bought, but not recently). Record source: recordSource is how the contact was first added, one of dashboard, api, sdk, import, form, integration, transactional, unknown; recordSourceId what added it: a form's, import's, API key's or member's id, or an integration's slug (segment). Together they make "added through Segment": recordSource equals integration and recordSourceId equals segment. Purchase cycle: daysBetweenPurchases is a regular buyer's usual (median) days between purchase days; purchaseOverdueRatio the days since their last purchase over that (1.5 is half a cycle late), worked out when the rule runs; purchaseCycleStatus its label: overdue from 1.5×, lapsed from 2×, dormant from 3×, else on_track. Only a contact with 4 or more purchase days and a regular pattern has them: anyone else matches only notExists and notEquals, and is never called overdue. These three are on plans that include Kiro: elsewhere a rule on them is refused with 403 PLAN_FEATURE_UNAVAILABLE.

one of email, firstName, lastName, phone, timezone, externalId, consent.email, consent.push, country, locale, createdAt, recordSource, recordSourceId, rfmGroup, rfmRecency, rfmFrequency, rfmMonetary, purchaseCount, totalSpent, lastPurchasedAt, daysBetweenPurchases, purchaseOverdueRatio, purchaseCycleStatus

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Event
6 child attributes
type"event"required
namestringrequired

The event name.

1–128 characters

withinDurationInputoptional

Only events from the last within.

notFollowedBystringoptional

Only when this event name did not follow it afterwards.

1–128 characters

countobjectoptional

How often; defaults to at least once. { operator: equals, value: 0 } is "has not done".

whereobject[]optional

Property conditions the event must meet, up to 5; count counts only events meeting all of them.

at least 1 item · at most 5 items

Message activity
9 child attributes
type"activity"required
activitystringrequired

notOpened and notClicked: sent, and not opened or clicked. Opens include machine opens (see openedByMachine).

one of sent, notSent, opened, clicked, notOpened, notClicked, bounced

countobjectoptional

How many messages had this activity; defaults to at least one. Not with notSent.

linkstringoptional

With clicked or notClicked: only clicks on a link whose address contains this text, ignoring case.

1–500 characters

channelstringoptional

Only messages on this channel (opened a push, not an email); any when left out.

one of email, push

campaignIdstringoptional

Only messages of this campaign.

uuid

tagIdstringoptional

Only messages of campaigns or journeys carrying this tag, as they are tagged when the rule is evaluated.

uuid

journeyStepIdstringoptional

Inside a journey only: the message sent by the step with this id in the contact's current enrollment. Matches nobody outside a journey.

pattern ^[a-z0-9][a-z0-9_-]{0,63}$

withinDurationInputoptional

Only activity from the last within. For notOpened and notClicked it is a waiting time instead: only messages sent at least this long ago count, so each has had that long to be opened or clicked.

Push installation
7 child attributes
type"installation"required
hasstringrequired

active: reachable by push (granted, active, not invalidated); none: not.

one of active, none

pushProjectIdstringoptional

Only devices of this push project; any when omitted.

uuid

platformstringoptional

Only devices on this platform; any when omitted.

one of ios, android, web

localestringoptional

Only devices set to this language, as the device last reported it: fr matches fr and fr-CA, fr-CA only fr-CA. Devices that reported none never match.

up to 35 characters

appVersionVersionComparisonInputoptional

Only devices whose app version, as last reported, compares so. A version with text after its numbers (2.1.0-beta) is read by its numbers; one with none never matches.

osVersionVersionComparisonInputoptional

Only devices whose operating system version, as last reported, compares so (17.4 for iOS 17.4, 14 for Android 14). Devices that reported none never match.

List membership
3 child attributes
type"list"required
listIdsstring[]required

One list or several: with member: true in any of them, with false in none of them. Each must be one of the workspace's lists when the rules are saved.

at least 1 item · at most 50 items

memberbooleanrequired

True for in the lists, false for not in them.

Segment membership
3 child attributes
type"segment"required
segmentIdstringrequired

uuid

memberbooleanrequired

True for in the segment, false for not in it.

Topic
4 child attributes
type"topic"required
topicIdstringrequired

One of the workspace's topics when the rules are saved.

uuid

channelstringoptional

Reads the contact's choice for this channel, which overrides their topic-wide choice. Without it, the rule reads the topic-wide choice, which a contact's subscribed shows.

one of email, push

subscribedbooleanrequired

True for contacts the topic reaches, false for those it does not.

Match all
1 child attribute
allobject[]required

Every rule must match.

at least 1 item · at most 20 items

Match any
1 child attribute
anyobject[]required

At least one rule must match.

at least 1 item · at most 20 items

tagsstring[]optional

Tag names, up to 20, matched without case; a tag the workspace lacks is created. On update, replaces the tags whole: [] removes them all.

at most 20 items

Returns

Returns 200 OK with a Segment in data. It can also return 409 Conflict, 413 Payload Too Large or 415 Unsupported Media Type; see the statuses below. Otherwise returns an error; Errors lists every code and which to retry.

  • 200 OKThe updated segment.
  • 409 ConflictThe request conflicts with current state — a duplicate unique value, or a resource whose status does not allow this operation.
  • 413 Payload Too LargeThe body is larger than this operation accepts (PAYLOAD_TOO_LARGE).
  • 415 Unsupported Media TypeThe body is not JSON, or not the upload the operation takes (UNSUPPORTED_MEDIA_TYPE).
idstringrequired

uuid

namestringrequired
descriptionstring | nullrequired
rulesobjectrequired
Any of 2 shapes
Match all
1 child attribute
allobject[]required

Every rule or nested group must match.

at least 1 item · at most 20 items

Any of 10 shapes
Attribute
5 child attributes
type"attribute"required
fieldstringrequired

attributes.<key>, e.g. attributes.plan.

pattern ^attributes\.[\p{L}\p{N}\p{M}_.-]{1,64}$

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Contact field
5 child attributes
type"contact"required
fieldstringrequired

The contact column to test. Each takes these operators, and is refused with others: email: equals, notEquals, contains, startsWith, exists, notExists, in; firstName: equals, notEquals, contains, startsWith, exists, notExists, in; lastName: equals, notEquals, contains, startsWith, exists, notExists, in; phone: equals, notEquals, contains, startsWith, exists, notExists, in; timezone: equals, notEquals, contains, startsWith, exists, notExists, in; externalId: equals, notEquals, contains, startsWith, exists, notExists, in; consent.email: equals; consent.push: equals; country: equals, notEquals, in, exists, notExists; locale: equals, notEquals, startsWith, in, exists, notExists; createdAt: before, after, withinLastDays, moreThanDaysAgo; recordSource: equals, notEquals, in; recordSourceId: equals, notEquals, in, exists, notExists; rfmGroup: equals, notEquals, in, exists, notExists; rfmRecency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmFrequency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmMonetary: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; purchaseCount: equals, gt, gte, lt, lte; totalSpent: equals, gt, gte, lt, lte; lastPurchasedAt: before, after, withinLastDays, moreThanDaysAgo, exists, notExists; daysBetweenPurchases: gt, gte, lt, lte, exists, notExists; purchaseOverdueRatio: gt, gte, lt, lte, exists, notExists; purchaseCycleStatus: equals, notEquals, in, exists, notExists. phone holds +country numbers: write equals, notEquals and in values with their country code. Consent takes "true" or "false". Purchases: purchaseCount, totalSpent (in the main currency) and lastPurchasedAt are a customer's totals of the workspace's purchase event (purchaseEvent in workspace settings: an order, a paid invoice), recomputed daily; the contact's stored totalSpent is null when the workspace's purchases carry no amount. In comparisons on purchaseCount and totalSpent a missing count or spend is 0, so someone who never purchased has 0 purchases and 0 spent. RFM: rfmGroup and its scores rfmRecency, rfmFrequency and rfmMonetary (monetary value: how much they spend) come from the same daily pass. A score is a whole number from 1 to 5, written as text ("5"; values of them for in), 5 being the most recent, most frequent or highest spending; any other value is refused with 400. Someone who never purchased has no rfmGroup or scores: on those four fields they match only notExists and notEquals. So rfmRecency notEquals 5 includes everyone who never purchased; add an exists rule on the same field to leave them out (bought, but not recently). Record source: recordSource is how the contact was first added, one of dashboard, api, sdk, import, form, integration, transactional, unknown; recordSourceId what added it: a form's, import's, API key's or member's id, or an integration's slug (segment). Together they make "added through Segment": recordSource equals integration and recordSourceId equals segment. Purchase cycle: daysBetweenPurchases is a regular buyer's usual (median) days between purchase days; purchaseOverdueRatio the days since their last purchase over that (1.5 is half a cycle late), worked out when the rule runs; purchaseCycleStatus its label: overdue from 1.5×, lapsed from 2×, dormant from 3×, else on_track. Only a contact with 4 or more purchase days and a regular pattern has them: anyone else matches only notExists and notEquals, and is never called overdue. These three are on plans that include Kiro: elsewhere a rule on them is refused with 403 PLAN_FEATURE_UNAVAILABLE.

one of email, firstName, lastName, phone, timezone, externalId, consent.email, consent.push, country, locale, createdAt, recordSource, recordSourceId, rfmGroup, rfmRecency, rfmFrequency, rfmMonetary, purchaseCount, totalSpent, lastPurchasedAt, daysBetweenPurchases, purchaseOverdueRatio, purchaseCycleStatus

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Event
6 child attributes
type"event"required
namestringrequired

The event name.

1–128 characters

withinDurationoptional

Only events from the last within.

notFollowedBystringoptional

Only when this event name did not follow it afterwards.

1–128 characters

countobjectoptional

How often; defaults to at least once. { operator: equals, value: 0 } is "has not done".

whereobject[]optional

Property conditions the event must meet, up to 5; count counts only events meeting all of them.

at least 1 item · at most 5 items

Message activity
9 child attributes
type"activity"required
activitystringrequired

notOpened and notClicked: sent, and not opened or clicked. Opens include machine opens (see openedByMachine).

one of sent, notSent, opened, clicked, notOpened, notClicked, bounced

countobjectoptional

How many messages had this activity; defaults to at least one. Not with notSent.

linkstringoptional

With clicked or notClicked: only clicks on a link whose address contains this text, ignoring case.

1–500 characters

channelstringoptional

Only messages on this channel (opened a push, not an email); any when left out.

one of email, push

campaignIdstringoptional

Only messages of this campaign.

uuid

tagIdstringoptional

Only messages of campaigns or journeys carrying this tag, as they are tagged when the rule is evaluated.

uuid

journeyStepIdstringoptional

Inside a journey only: the message sent by the step with this id in the contact's current enrollment. Matches nobody outside a journey.

pattern ^[a-z0-9][a-z0-9_-]{0,63}$

withinDurationoptional

Only activity from the last within. For notOpened and notClicked it is a waiting time instead: only messages sent at least this long ago count, so each has had that long to be opened or clicked.

Push installation
7 child attributes
type"installation"required
hasstringrequired

active: reachable by push (granted, active, not invalidated); none: not.

one of active, none

pushProjectIdstringoptional

Only devices of this push project; any when omitted.

uuid

platformstringoptional

Only devices on this platform; any when omitted.

one of ios, android, web

localestringoptional

Only devices set to this language, as the device last reported it: fr matches fr and fr-CA, fr-CA only fr-CA. Devices that reported none never match.

up to 35 characters

appVersionVersionComparisonoptional

Only devices whose app version, as last reported, compares so. A version with text after its numbers (2.1.0-beta) is read by its numbers; one with none never matches.

osVersionVersionComparisonoptional

Only devices whose operating system version, as last reported, compares so (17.4 for iOS 17.4, 14 for Android 14). Devices that reported none never match.

List membership
3 child attributes
type"list"required
listIdsstring[]required

One list or several: with member: true in any of them, with false in none of them. Each must be one of the workspace's lists when the rules are saved.

at least 1 item · at most 50 items

memberbooleanrequired

True for in the lists, false for not in them.

Segment membership
3 child attributes
type"segment"required
segmentIdstringrequired

uuid

memberbooleanrequired

True for in the segment, false for not in it.

Topic
4 child attributes
type"topic"required
topicIdstringrequired

One of the workspace's topics when the rules are saved.

uuid

channelstringoptional

Reads the contact's choice for this channel, which overrides their topic-wide choice. Without it, the rule reads the topic-wide choice, which a contact's subscribed shows.

one of email, push

subscribedbooleanrequired

True for contacts the topic reaches, false for those it does not.

Match all
1 child attribute
allobject[]required

Every rule must match.

at least 1 item · at most 20 items

Match any
1 child attribute
anyobject[]required

At least one rule must match.

at least 1 item · at most 20 items

Match any
1 child attribute
anyobject[]required

At least one rule or nested group must match.

at least 1 item · at most 20 items

Any of 10 shapes
Attribute
5 child attributes
type"attribute"required
fieldstringrequired

attributes.<key>, e.g. attributes.plan.

pattern ^attributes\.[\p{L}\p{N}\p{M}_.-]{1,64}$

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Contact field
5 child attributes
type"contact"required
fieldstringrequired

The contact column to test. Each takes these operators, and is refused with others: email: equals, notEquals, contains, startsWith, exists, notExists, in; firstName: equals, notEquals, contains, startsWith, exists, notExists, in; lastName: equals, notEquals, contains, startsWith, exists, notExists, in; phone: equals, notEquals, contains, startsWith, exists, notExists, in; timezone: equals, notEquals, contains, startsWith, exists, notExists, in; externalId: equals, notEquals, contains, startsWith, exists, notExists, in; consent.email: equals; consent.push: equals; country: equals, notEquals, in, exists, notExists; locale: equals, notEquals, startsWith, in, exists, notExists; createdAt: before, after, withinLastDays, moreThanDaysAgo; recordSource: equals, notEquals, in; recordSourceId: equals, notEquals, in, exists, notExists; rfmGroup: equals, notEquals, in, exists, notExists; rfmRecency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmFrequency: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; rfmMonetary: equals, notEquals, in, exists, notExists, gt, gte, lt, lte; purchaseCount: equals, gt, gte, lt, lte; totalSpent: equals, gt, gte, lt, lte; lastPurchasedAt: before, after, withinLastDays, moreThanDaysAgo, exists, notExists; daysBetweenPurchases: gt, gte, lt, lte, exists, notExists; purchaseOverdueRatio: gt, gte, lt, lte, exists, notExists; purchaseCycleStatus: equals, notEquals, in, exists, notExists. phone holds +country numbers: write equals, notEquals and in values with their country code. Consent takes "true" or "false". Purchases: purchaseCount, totalSpent (in the main currency) and lastPurchasedAt are a customer's totals of the workspace's purchase event (purchaseEvent in workspace settings: an order, a paid invoice), recomputed daily; the contact's stored totalSpent is null when the workspace's purchases carry no amount. In comparisons on purchaseCount and totalSpent a missing count or spend is 0, so someone who never purchased has 0 purchases and 0 spent. RFM: rfmGroup and its scores rfmRecency, rfmFrequency and rfmMonetary (monetary value: how much they spend) come from the same daily pass. A score is a whole number from 1 to 5, written as text ("5"; values of them for in), 5 being the most recent, most frequent or highest spending; any other value is refused with 400. Someone who never purchased has no rfmGroup or scores: on those four fields they match only notExists and notEquals. So rfmRecency notEquals 5 includes everyone who never purchased; add an exists rule on the same field to leave them out (bought, but not recently). Record source: recordSource is how the contact was first added, one of dashboard, api, sdk, import, form, integration, transactional, unknown; recordSourceId what added it: a form's, import's, API key's or member's id, or an integration's slug (segment). Together they make "added through Segment": recordSource equals integration and recordSourceId equals segment. Purchase cycle: daysBetweenPurchases is a regular buyer's usual (median) days between purchase days; purchaseOverdueRatio the days since their last purchase over that (1.5 is half a cycle late), worked out when the rule runs; purchaseCycleStatus its label: overdue from 1.5×, lapsed from 2×, dormant from 3×, else on_track. Only a contact with 4 or more purchase days and a regular pattern has them: anyone else matches only notExists and notEquals, and is never called overdue. These three are on plans that include Kiro: elsewhere a rule on them is refused with 403 PLAN_FEATURE_UNAVAILABLE.

one of email, firstName, lastName, phone, timezone, externalId, consent.email, consent.push, country, locale, createdAt, recordSource, recordSourceId, rfmGroup, rfmRecency, rfmFrequency, rfmMonetary, purchaseCount, totalSpent, lastPurchasedAt, daysBetweenPurchases, purchaseOverdueRatio, purchaseCycleStatus

operatorstringrequired

How to compare. Text comparisons (equals, notEquals, contains, notContains, startsWith, in) ignore case and accents ("jose" matches "José"). notEquals and notContains also match contacts without the value. Date operators (before, after, withinLastDays, moreThanDaysAgo) compare as dates and times in UTC: a stored ISO-8601 date is the start of that day, before means earlier than the given day and after later than it, and a value that is not an ISO-8601 date or date and time never matches. inNextDays is a date from today to that many days ahead. anniversaryInNextDays (0 = today) and anniversaryThisMonth ignore the year, so they suit birthdays, and also read a yearless --MM-DD; a 29 February counts on 28 February in other years. Days are UTC days; these three are for attributes and dates, not contact fields.

one of equals, notEquals, contains, notContains, startsWith, exists, notExists, before, after, gt, gte, lt, lte, in, withinLastDays, moreThanDaysAgo, inNextDays, anniversaryInNextDays, anniversaryThisMonth

valuestringoptional

What to compare with, always as text: "pro", "3", "true". Equality compares the stored value as text, so a stored 5 matches "5". An ISO date for before and after; a number for gt, gte, lt and lte; a whole number of days (1 to 3650) for withinLastDays, moreThanDaysAgo and inNextDays, and 0 to 365 for anniversaryInNextDays. Omit for in, exists, notExists and anniversaryThisMonth.

up to 255 characters

valuesstring[]optional

For in only: up to 100 values, each as text, any of which matches.

at least 1 item · at most 100 items

Event
6 child attributes
type"event"required
namestringrequired

The event name.

1–128 characters

withinDurationoptional

Only events from the last within.

notFollowedBystringoptional

Only when this event name did not follow it afterwards.

1–128 characters

countobjectoptional

How often; defaults to at least once. { operator: equals, value: 0 } is "has not done".

whereobject[]optional

Property conditions the event must meet, up to 5; count counts only events meeting all of them.

at least 1 item · at most 5 items

Message activity
9 child attributes
type"activity"required
activitystringrequired

notOpened and notClicked: sent, and not opened or clicked. Opens include machine opens (see openedByMachine).

one of sent, notSent, opened, clicked, notOpened, notClicked, bounced

countobjectoptional

How many messages had this activity; defaults to at least one. Not with notSent.

linkstringoptional

With clicked or notClicked: only clicks on a link whose address contains this text, ignoring case.

1–500 characters

channelstringoptional

Only messages on this channel (opened a push, not an email); any when left out.

one of email, push

campaignIdstringoptional

Only messages of this campaign.

uuid

tagIdstringoptional

Only messages of campaigns or journeys carrying this tag, as they are tagged when the rule is evaluated.

uuid

journeyStepIdstringoptional

Inside a journey only: the message sent by the step with this id in the contact's current enrollment. Matches nobody outside a journey.

pattern ^[a-z0-9][a-z0-9_-]{0,63}$

withinDurationoptional

Only activity from the last within. For notOpened and notClicked it is a waiting time instead: only messages sent at least this long ago count, so each has had that long to be opened or clicked.

Push installation
7 child attributes
type"installation"required
hasstringrequired

active: reachable by push (granted, active, not invalidated); none: not.

one of active, none

pushProjectIdstringoptional

Only devices of this push project; any when omitted.

uuid

platformstringoptional

Only devices on this platform; any when omitted.

one of ios, android, web

localestringoptional

Only devices set to this language, as the device last reported it: fr matches fr and fr-CA, fr-CA only fr-CA. Devices that reported none never match.

up to 35 characters

appVersionVersionComparisonoptional

Only devices whose app version, as last reported, compares so. A version with text after its numbers (2.1.0-beta) is read by its numbers; one with none never matches.

osVersionVersionComparisonoptional

Only devices whose operating system version, as last reported, compares so (17.4 for iOS 17.4, 14 for Android 14). Devices that reported none never match.

List membership
3 child attributes
type"list"required
listIdsstring[]required

One list or several: with member: true in any of them, with false in none of them. Each must be one of the workspace's lists when the rules are saved.

at least 1 item · at most 50 items

memberbooleanrequired

True for in the lists, false for not in them.

Segment membership
3 child attributes
type"segment"required
segmentIdstringrequired

uuid

memberbooleanrequired

True for in the segment, false for not in it.

Topic
4 child attributes
type"topic"required
topicIdstringrequired

One of the workspace's topics when the rules are saved.

uuid

channelstringoptional

Reads the contact's choice for this channel, which overrides their topic-wide choice. Without it, the rule reads the topic-wide choice, which a contact's subscribed shows.

one of email, push

subscribedbooleanrequired

True for contacts the topic reaches, false for those it does not.

Match all
1 child attribute
allobject[]required

Every rule must match.

at least 1 item · at most 20 items

Match any
1 child attribute
anyobject[]required

At least one rule must match.

at least 1 item · at most 20 items

memberCountinteger | nullrequired

Contacts in the stored membership, exact, from the background evaluation that runs about every 15 minutes; null until first counted, and again for a moment after the rules change.

min 0

memberCountedAtstring | nullrequired

When memberCount was taken.

date-time

tagsstring[]required

Tag names, sorted without case.

createdAtstringrequired

date-time

updatedAtstringrequired

date-time