SegOps AIDocs

Condition Reference

Complete reference for every condition type, their required fields, and example JSON.

event_count#

Matches users based on how many times they have fired a given event type.

FieldTypeRequiredDescription
event_typestringYesThe event type to count (e.g., order_placed)
operatorstringYesComparison: eq, neq, gt, gte, lt, lte
valuenumberYesThe threshold count
window_daysnumberNoIf set, only counts events in the last N days
json
{
  "type": "event_count",
  "event_type": "order_placed",
  "operator": "gte",
  "value": 3,
  "window_days": 90
}

recency#

Matches users based on how many days have passed since they last fired an event. A larger value means the user hasn't been seen recently.

FieldTypeRequiredDescription
event_typestringYesThe event type to check recency for
operatorstringYesComparison: gt (churned), lt (active), eq
window_daysnumberYesDays-since-last threshold
json
{
  "type": "recency",
  "event_type": "page_viewed",
  "operator": "gt",
  "window_days": 30
}

monetary#

Aggregates a numeric property across all events of a given type and compares the result to a threshold. Useful for lifetime value, total spend, average order value.

FieldTypeRequiredDescription
event_typestringYesThe event type to aggregate
propertystringYesPayload property name to aggregate (e.g., total)
metricstringYesAggregation: sum, avg, or max
operatorstringYesComparison: eq, neq, gt, gte, lt, lte
valuenumberYesThe threshold value
json
{
  "type": "monetary",
  "event_type": "order_placed",
  "property": "total",
  "metric": "sum",
  "operator": "gte",
  "value": 500
}

event_property#

Checks the latest value of a specific payload property on the most-recent occurrence of an event type.

FieldTypeRequiredDescription
event_typestringYesEvent type to inspect
propertystringYesPayload property name
operatorstringYesAny operator appropriate for the value type
valueanyYesThe value to compare against
json
{
  "type": "event_property",
  "event_type": "order_placed",
  "property": "currency",
  "operator": "eq",
  "value": "USD"
}

user_property#

Checks a trait from the user's context_identified event payload. Properties are keyed by name and hold the value from the most-recent identify call.

FieldTypeRequiredDescription
propertystringYesTrait name (e.g., plan, country)
operatorstringYesAny operator appropriate for the value type
valueanyYesThe value to compare against
json
{
  "type": "user_property",
  "property": "plan",
  "operator": "eq",
  "value": "starter"
}

event_sequence#

Matches users who fired a specific ordered sequence of events within a time window. Useful for funnel-based audiences (viewed pricing → started trial → cancelled).

FieldTypeRequiredDescription
eventsarrayYesOrdered list of objects, each with event_type
window_daysnumberYesSequence must occur within this many days
strictbooleanNoIf true, no other events may occur between steps
json
{
  "type": "event_sequence",
  "events": [
    { "event_type": "checkout_started" },
    { "event_type": "checkout_abandoned" }
  ],
  "window_days": 7,
  "strict": false
}

segment_membership#

Checks whether a user is currently a member of another segment. Enables segment composition — for example, “in the VIP segment but not in the recent churners segment.”

FieldTypeRequiredDescription
segment_idnumberYesThe ID of the segment to check membership in
operatorstringYesin or not_in
json
{
  "type": "segment_membership",
  "segment_id": 12,
  "operator": "in"
}

Operator Reference#

OperatorMeaningNumericStringBooleanList
eqequals
neqnot equals
gtgreater than
gtegreater than or equal
ltless than
lteless than or equal
invalue is in list
not_invalue is not in list
containsstring contains substring
does_not_containstring does not contain substring
starts_withstring starts with prefix
ends_withstring ends with suffix
matches_regexmatches regex pattern
betweenvalue within inclusive range
not_betweenvalue outside range
is_setproperty exists and is not null
is_not_setproperty is null or missing
is_trueboolean is true
is_falseboolean is false

Full Segment Example#

A complete segment definition combining multiple conditions with AND logic:

json
{
  "logic": "AND",
  "conditions": [
    {
      "type": "monetary",
      "event_type": "order_placed",
      "property": "total",
      "metric": "sum",
      "operator": "gte",
      "value": 500
    },
    {
      "type": "event_count",
      "event_type": "order_placed",
      "operator": "gte",
      "value": 3
    },
    {
      "type": "recency",
      "event_type": "page_viewed",
      "operator": "lt",
      "window_days": 60
    },
    {
      "type": "user_property",
      "property": "plan",
      "operator": "neq",
      "value": "free"
    }
  ]
}

This segment matches users who: spent at least $500 total, placed 3+ orders, visited in the last 60 days, and are not on the free plan.