Amba

User Segments

Create rule-based user segments with 12 operators for targeting push campaigns and analytics.

Segments let you define groups of users based on rules. Use them to target push campaigns or analyze engagement patterns.

How it works

A segment has a set of rules with an AND or OR operator combining conditions. Each condition evaluates a user property against a value using one of 12 operators.

Segment membership is re-evaluated within 15 minutes of a change to your users' data. Rules with a time window (within / not_within) also follow the clock: a user who crosses a window under a day joins or leaves within 15 minutes, and within the hour for longer windows. See Evaluation cadence.

Operators

OperatorDescriptionExample
eqEqualsentitlements.is_active eq true
neqNot equalsentitlements.product_id neq "premium_monthly"
gtGreater thancreated_at gt "2026-01-01"
gteGreater than or equalentitlements.expiration_date gte "2026-12-01"
ltLess thanlast_seen_at lt "2026-06-01"
lteLess than or equalfirst_seen_at lte "2026-03-31"
containsString/array containsproperties.tags contains "fitness"
not_containsDoes not containproperties.tags not_contains "churned"
existsProperty existsemail exists
not_existsProperty does not existemail not_exists
withinWithin time windowlast_seen_at within "7d"
not_withinOutside time windowlast_seen_at not_within "30d"

Available fields

You can target any field on the user record:

  • last_seen_at — last activity timestamp
  • created_at — account creation date
  • email — user email
  • properties.* — custom user properties (e.g., properties.plan, properties.age). A properties.* comparison follows the type of the rule's value: a string compares with the property's text ({ field: "properties.plan", op: "eq", value: "pro" } matches plan: "pro"), a number compares numerically and counts a JSON number or a numeric string (gt 9 matches 10), and a boolean matches true / false or the strings "true" / "false". An object or array value supports eq / neq against the whole JSON value. A user without the property matches none of these operators.
  • entitlements.is_active — active entitlement status

Admin API reference

MethodPathDescription
POST/v1/admin/projects/:projectId/segmentsCreate segment
GET/v1/admin/projects/:projectId/segmentsList all segments
GET/v1/admin/projects/:projectId/segments/:idGet segment details
PATCH/v1/admin/projects/:projectId/segments/:idUpdate segment rules
DELETE/v1/admin/projects/:projectId/segments/:idDelete segment
POST/v1/admin/projects/:projectId/segments/:id/evaluateTrigger immediate re-evaluation

POST /v1/admin/projects/:projectId/segments — Create segment

Body:

{
  "name": "Active Subscribers",
  "description": "Users active in the last 7 days with an active entitlement",
  "rules": {
    "operator": "AND",
    "conditions": [
      { "field": "last_seen_at", "op": "within", "value": "7d" },
      { "field": "entitlements.is_active", "op": "eq", "value": true }
    ]
  }
}

System segments

Every project comes with built-in system segments that cannot be edited or deleted:

  • All Users — every user in the project
  • Active (7d) — users seen in the last 7 days
  • Active (30d) — users seen in the last 30 days
  • New Users — users created in the last 7 days

MCP tools

ToolDescription
amba_segments_listList all segments including system segments
amba_segments_createCreate a custom segment with rule-based filters

Example

Agent: "Create a segment for users who haven't opened the app in 14 days"

amba_segments_create({
  project_id: "proj_xxx",
  name: "Inactive 14d",
  description: "Users who haven't opened the app in 14 days",
  rules: {
    operator: "AND",
    conditions: [
      { field: "last_seen_at", op: "not_within", value: "14d" }
    ]
  }
})

What can target a segment

FeatureHow it uses segments
Push campaignsPOST /v1/admin/projects/:projectId/push/campaigns accepts segment_id to limit the audience.
Remote config conditionsEach remote_configs.conditions[] entry can carry a segment_id. GET /v1/client/config returns that entry's value to signed-in members of the segment.
Content schedulingA content_schedule with segment_id set writes its rotated value into the per-segment slot of remote_configs.conditions, which signed-in members of the segment read from GET /v1/client/config.

On this page