Segments

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.

StatusDescription
readySegment is active and available for use
buildingSegment is being calculated (contact matching in progress)
archivedSegment has been archived

Note: Updating a segment's conditions triggers an automatic rebuild — the status changes to building until 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.

EntityDescription
contactFilter based on contact properties
eventFilter based on contact activity

Junction Values

The junction field controls how filters within a condition are combined.

JunctionDescription
andAll filters must match
orAny filter must match

Operators

OperatorDescriptionApplicable Types
anyOfMatches any of the given valuestext, list
noneOfMatches none of the given valuestext, list
equalsExact matchnumber, date, subscriptionStatus
notEqualsNot equalsubscriptionStatus
moreThanGreater thannumber
lessThanLess thannumber
afterDate is afterdate
beforeDate is beforedate
containsContains substringtext, list
doesNotContainsDoes not contain substringtext, list
startsWithStarts withtext
endsWithEnds withtext
inTheLastWithin last N time unitsdate
notInTheLastNot within last N time unitsdate
betweenValue within rangenumber, date
existsProperty has a valueall
doesNotExistProperty has no valueall
anniversaryIsInTheNextAnniversary within next N time unitsdate

For event conditions, use has (event occurred) or hasNot (event did not occur).

Note: The between operator requires both valueFrom and valueTo. Date slider operators (inTheLast, notInTheLast, anniversaryIsInTheNext) require both value and unit.

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:

PropertyDescriptionType
emailContact email addresstext
phoneNumberContact phone numbertext
firstNameFirst nametext
lastNameLast nametext
genderGendertext
countryCountrytext
stateState or regiontext
subscriptionStatusSubscription status per channelsubscriptionStatus
consentConsent statuslist
tagsContact tagslist
birthdayContact birthdayvariadic
dateAddedDate the contact was addeddate
lastDetectedCityLast detected citytext
lastDetectedCountryLast detected countrytext
addressPhysical addresstext
cityCitytext
postalCodePostal/ZIP codetext
averageOrderValueComputed average order valuenumber
totalSpentComputed total spentnumber
customerLifecycleStageRFM lifecycle stagetext
customCustom property (use name field)variadic

Note: When using custom property, specify the custom property name in the name field and the value type in valueType. The name field is required even when using exists or doesNotExist.

Subscription Status Values

When filtering by subscriptionStatus, use the equals or notEquals operator and combine with channels to specify which communication channels:

StatusDescription
subscribedContact opted in to marketing
unsubscribedContact opted out of marketing
nonSubscribedContact hasn't subscribed or unsubscribed

Channels

ChannelDescription
emailEmail channel
smsSMS channel
browserPushBrowser push notification

Customer Lifecycle Stages

When filtering by customerLifecycleStage (RFM segments):

ValueDescription
championsBest customers with high RFM scores
loyalistsFrequent, engaged customers
cantLosePreviously engaged, now at risk
atRiskCustomers showing declining engagement
highPotentialNew customers with growth potential
needNurturingCustomers requiring re-engagement
aboutToLoseLow engagement, high churn risk
recentCustomersRecently acquired customers

Event Conditions

Event conditions filter contacts based on their activity. Use the has or hasNot operator in the filter.

FieldRequiredDescription
nameYesEvent name (e.g., "placed order", "opened message")
operatorYeshas or hasNot
countYesatLeast or equals
valueYesInteger threshold (e.g., 1)
originNoEvent source (e.g., "shopify", "omnisend"). See the origin note below.
periodNoTime window — see Period operators below
filtersNoArray of property sub-filters on the event payload
junctionNoand or or — logical operator for filters

origin is usually optional. Most events belong to a single origin, so the API resolves it for you. You only need to specify origin when 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).

OperatorMeaningExample JSON
inTheLastEvent occurred within the last N units{ "operator": "inTheLast", "unit": "days", "value": 7 }
notInTheLastEvent did not occur within the last N units{ "operator": "notInTheLast", "unit": "months", "value": 3 }

Absolute periods

Use ISO 8601 date strings (YYYY-MM-DD).

OperatorMeaningExample JSON
equalsEvent occurred on an exact date{ "operator": "equals", "value": "2026-01-13" }
beforeEvent occurred before a date (exclusive){ "operator": "before", "value": "2026-01-13" }
afterEvent occurred after a date (exclusive){ "operator": "after", "value": "2026-04-01" }
betweenEvent occurred within a date range (inclusive){ "operator": "between", "valueFrom": "2025-01-01", "valueTo": "2025-01-31" }

Limits

LimitValue
Segments per brand1,000
Rule groups per segment10
Filters per condition9

Examples

For complete segment creation examples, see the Create segment endpoint documentation:

See Also