Intro
Endpoint: https://api.omnisend.com/api/segments
Segments allow you to group contacts based on specific criteria such as contact properties, behaviors, or events.
Segment Status
When retrieving a segment, the status field indicates its current state.
| Status | Description |
|---|---|
| ready | Segment is active and available for use |
| building | Segment is being calculated (contact matching in progress) |
| archived | Segment has been archived |
Note: Updating a segment's conditions triggers an automatic rebuild — the status changes to
buildinguntil the new contact set is calculated.
Segment Structure
Segments use a hierarchical condition structure:
Segment
└── conditionGroups[] (OR logic between groups)
└── conditions[] (AND logic within a group)
└── filters[] (conditions for matching)
Multiple condition groups are combined with OR logic. Within a single group, conditions are combined with AND logic.
Entity Types
Each condition targets a specific entity type.
| Entity | Description |
|---|---|
| contact | Filter based on contact properties |
| event | Filter based on contact activity |
Junction Values
The junction field controls how filters within a condition are combined.
| Junction | Description |
|---|---|
| and | All filters must match |
| or | Any filter must match |
Operators
| Operator | Description | Applicable Types |
|---|---|---|
| anyOf | Matches any of the given values | text, list |
| noneOf | Matches none of the given values | text, list |
| equals | Exact match | number, date, subscriptionStatus |
| notEquals | Not equal | subscriptionStatus |
| moreThan | Greater than | number |
| lessThan | Less than | number |
| after | Date is after | date |
| before | Date is before | date |
| contains | Contains substring | text, list |
| doesNotContains | Does not contain substring | text, list |
| startsWith | Starts with | text |
| endsWith | Ends with | text |
| inTheLast | Within last N time units | date |
| notInTheLast | Not within last N time units | date |
| between | Value within range | number, date |
| exists | Property has a value | all |
| doesNotExist | Property has no value | all |
| anniversaryIsInTheNext | Anniversary within next N time units | date |
For event conditions, use has (event occurred) or hasNot (event did not occur).
Note: The
betweenoperator requires bothvalueFromandvalueTo. Date slider operators (inTheLast,notInTheLast,anniversaryIsInTheNext) require bothvalueandunit.
Value Types
| Value Type |
|---|
| text |
| number |
| bool |
| date |
Date Units
For time-based operators (inTheLast, notInTheLast, anniversaryIsInTheNext), specify a unit:
| Unit |
|---|
| days |
| weeks |
| months |
| years |
Contact Properties
Common properties for contact entity conditions:
| Property | Description | Type |
|---|---|---|
| Contact email address | text | |
| phoneNumber | Contact phone number | text |
| firstName | First name | text |
| lastName | Last name | text |
| gender | Gender | text |
| country | Country | text |
| state | State or region | text |
| subscriptionStatus | Subscription status per channel | subscriptionStatus |
| consent | Consent status | list |
| tags | Contact tags | list |
| birthday | Contact birthday | variadic |
| dateAdded | Date the contact was added | date |
| lastDetectedCity | Last detected city | text |
| lastDetectedCountry | Last detected country | text |
| address | Physical address | text |
| city | City | text |
| postalCode | Postal/ZIP code | text |
| averageOrderValue | Computed average order value | number |
| totalSpent | Computed total spent | number |
| customerLifecycleStage | RFM lifecycle stage | text |
| custom | Custom property (use name field) | variadic |
Note: When using
customproperty, specify the custom property name in thenamefield and the value type invalueType. Thenamefield is required even when usingexistsordoesNotExist.
Subscription Status Values
When filtering by subscriptionStatus, use the equals or notEquals operator and combine with channels to specify which communication channels:
| Status | Description |
|---|---|
| subscribed | Contact opted in to marketing |
| unsubscribed | Contact opted out of marketing |
| nonSubscribed | Contact hasn't subscribed or unsubscribed |
Channels
| Channel | Description |
|---|---|
| Email channel | |
| sms | SMS channel |
| browserPush | Browser push notification |
Customer Lifecycle Stages
When filtering by customerLifecycleStage (RFM segments):
| Value | Description |
|---|---|
| champions | Best customers with high RFM scores |
| loyalists | Frequent, engaged customers |
| cantLose | Previously engaged, now at risk |
| atRisk | Customers showing declining engagement |
| highPotential | New customers with growth potential |
| needNurturing | Customers requiring re-engagement |
| aboutToLose | Low engagement, high churn risk |
| recentCustomers | Recently acquired customers |
Event Conditions
Event conditions filter contacts based on their activity. Use the has or hasNot operator in the filter.
| Field | Required | Description |
|---|---|---|
| name | Yes | Event name (e.g., "placed order", "opened message") |
| operator | Yes | has or hasNot |
| count | Yes | atLeast or equals |
| value | Yes | Integer threshold (e.g., 1) |
| origin | No | Event source (e.g., "shopify", "omnisend"). See the origin note below. |
| period | No | Time window — see Period operators below |
| filters | No | Array of property sub-filters on the event payload |
| junction | No | and or or — logical operator for filters |
originis usually optional. Most events belong to a single origin, so the API resolves it for you. You only need to specifyoriginwhen an event exists under multiple origins — otherwise the API returns an error with the list of valid values to choose from.
Note: You can only segment on events that have been recorded at least once for your brand.
Period Operators
The period object is optional on every event filter. When omitted, the filter matches across all time.
Relative periods
Use value (positive integer) + unit (days | weeks | months | years).
| Operator | Meaning | Example JSON |
|---|---|---|
inTheLast | Event occurred within the last N units | { "operator": "inTheLast", "unit": "days", "value": 7 } |
notInTheLast | Event did not occur within the last N units | { "operator": "notInTheLast", "unit": "months", "value": 3 } |
Absolute periods
Use ISO 8601 date strings (YYYY-MM-DD).
| Operator | Meaning | Example JSON |
|---|---|---|
equals | Event occurred on an exact date | { "operator": "equals", "value": "2026-01-13" } |
before | Event occurred before a date (exclusive) | { "operator": "before", "value": "2026-01-13" } |
after | Event occurred after a date (exclusive) | { "operator": "after", "value": "2026-04-01" } |
between | Event occurred within a date range (inclusive) | { "operator": "between", "valueFrom": "2025-01-01", "valueTo": "2025-01-31" } |
Limits
| Limit | Value |
|---|---|
| Segments per brand | 1,000 |
| Rule groups per segment | 10 |
| Filters per condition | 9 |
Examples
For complete segment creation examples, see the Create segment endpoint documentation:
- Combining contact and event conditions (AND logic)
- Multiple event conditions in a single group
- Multiple condition groups (OR logic)
- Filtering by contact properties
- Filtering by birthday
- Lifecycle stages and computed metrics
- Filtering by custom fields
- Behavioral events (engagement)
- Platform event property filters
- Custom event property filters
- Filtering events by date range
- Filtering events by exact date