Skip to main content

Segment filter reference

Contents

Overview

When creating export tasks, you can filter results using segment rules. A segment is a set of rules that define which records to include in the export. This page documents the available operators, field types, time factors, and rule structure.

Segments are used in the trigger.segment field of a task request. See Scheduling and triggers in the Tasks API reference for how segments fit into the task creation flow.

Version-specific information

VersionChange details
N/AN/A

Segment structure

A segment is a JSON object with the following fields:

FieldTypeDescription
entitystringAlways set to "people".
indexstringThe data index to filter. One of: users, transactions, vouchers, wallet-ledger, products, product-variants.
joinstringHow to combine multiple rules: "all" (AND — all rules must match) or "any" (OR — at least one rule must match).
chain_idintegerYour chain ID.
rulesarrayAn array of rule objects (see below).

Rule structure

Each rule in the rules array is a JSON object. The required fields depend on the operator:

FieldTypeUsed withDescription
field_namestringAll operatorsThe field to filter on (e.g. timestamp, country).
field_typestringAll operatorsThe type of the field (see Field types below).
operatorstringAll operatorsThe comparison operator (see Operators below).
valueanyis, is_not, contains, does_not_contain, is_dateThe value to compare against.
start_datestringis_after_date, is_between_dateISO 8601 datetime for the start of a range.
end_datestringis_before_date, is_between_dateISO 8601 datetime for the end of a range.
time_factorstringrelative_* operatorsThe time unit (see Time factors below).
time_amountintegerrelative_* operatorsThe number of time units.
minnumberis_between_numberMinimum value for a numeric range.
maxnumberis_between_numberMaximum value for a numeric range.
nestedbooleanNested fieldsSet to true for nested document fields.
nesting_pathstringNested fieldsThe path for nested fields (e.g. transaction, line_items).

Field types

Field typeDescriptionExample fields
dateDate/time fieldtimestamp, created_date, date_time_redeemed
keywordExact-match string fieldcountry, status, retailer_basket_code
textText searchable string fieldusername, first_name
integerWhole number fieldid, chain_id
floatDecimal number fieldamount, total_value
booleanTrue/false fieldopted_in, registered
geo_pointGeographic coordinate fieldgeo_location

Operators

Date operators

Use these operators with fields of type date.

OperatorDescriptionRequired fields
is_dateRecords on a specific dayvalue (ISO 8601 date)
not_is_dateRecords NOT on a specific dayvalue (ISO 8601 date)
is_before_dateRecords before a specific dateend_date
not_is_before_dateRecords NOT before a specific dateend_date
is_after_dateRecords after a specific datestart_date
not_is_after_dateRecords NOT after a specific datestart_date
is_between_dateRecords between two dates (inclusive)start_date + end_date
not_is_between_dateRecords NOT between two datesstart_date + end_date

Relative date operators

Use these for rolling time windows relative to the current time (e.g. "last 7 days").

OperatorDescriptionRequired fields
relative_less_thanWithin the last N time units (e.g. last 7 days)time_factor + time_amount
not_relative_less_thanNOT within the last N time unitstime_factor + time_amount
relative_more_thanMore than N time units agotime_factor + time_amount
not_relative_more_thanNOT more than N time units agotime_factor + time_amount
relative_exactlyExactly N time units ago (within that unit's window)time_factor + time_amount
not_relative_exactlyNOT exactly N time units agotime_factor + time_amount

String/keyword operators

Use these operators with fields of type keyword or text.

OperatorDescriptionRequired fields
isExact matchvalue
is_notDoes not matchvalue
containsContains the value (substring match for text fields)value
does_not_containDoes not contain the valuevalue

Number operators

Use these operators with fields of type integer or float.

OperatorDescriptionRequired fields
is_lteLess than or equal tovalue
not_is_lteNOT less than or equal tovalue
is_gteGreater than or equal tovalue
not_is_gteNOT greater than or equal tovalue
is_between_numberBetween min and max (inclusive)min + max
not_is_between_numberNOT between min and maxmin + max

Boolean operators

Use these operators with fields of type boolean.

OperatorDescriptionRequired fields
is_trueField is trueNone
is_falseField is falseNone

Existence operators

Use these to check whether a field has any value.

OperatorDescriptionRequired fields
not_emptyField has a value (exists)None
is_emptyField has no value (not set)None

Geo operators

Use these operators with fields of type geo_point.

OperatorDescriptionRequired fields
is_within_geo_distanceWithin a radius of a pointgeo_point_values, geo_distance_amount, geo_distance_factor
is_not_within_geo_distanceNOT within a radius of a pointgeo_point_values, geo_distance_amount, geo_distance_factor
is_within_geo_bounding_boxWithin a bounding boxgeo_point_top_left, geo_point_bottom_right
is_not_within_geo_bounding_boxNOT within a bounding boxgeo_point_top_left, geo_point_bottom_right

Time factors

Used with relative date operators to specify the time unit:

Time factorDescription
yearYears
monthMonths
weekWeeks
dayDays
hourHours
minuteMinutes
secondSeconds

Join logic

The join field in the segment determines how multiple rules are combined:

ValueLogicDescription
allANDAll rules must match for a record to be included.
anyORAt least one rule must match for a record to be included.

Examples

Export transactions from a specific date range

{
"entity": "people",
"index": "transactions",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "timestamp",
"field_type": "date",
"operator": "is_between_date",
"start_date": "2026-03-01T00:00:00Z",
"end_date": "2026-03-31T23:59:59Z"
}
]
}

Export users created in the last 30 days who are opted in

{
"entity": "people",
"index": "users",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "created_date",
"field_type": "date",
"operator": "relative_less_than",
"time_factor": "day",
"time_amount": 30
},
{
"field_name": "opted_in",
"field_type": "boolean",
"operator": "is_true"
}
]
}

Filter vouchers for a specific campaign

{
"entity": "people",
"index": "vouchers",
"join": "all",
"chain_id": YOUR_CHAIN_ID,
"rules": [
{
"field_name": "campaign_title",
"field_type": "text",
"operator": "is",
"value": "Summer Sale 2026"
}
]
}