Amba

User Segments

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

Segments let you define groups of users based on rules. Use them to target push campaigns, roll out config changes to specific users, 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 every 15 minutes.

Operators

OperatorDescriptionExample
eqEqualsplan eq "premium"
neqNot equalsplan neq "free"
gtGreater thantotal_xp gt 1000
gteGreater than or equalstreak_count gte 7
ltLess thandays_since_active lt 30
lteLess than or equalage lte 25
containsString/array containstags contains "fitness"
not_containsDoes not containtags 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)
  • entitlements.is_active — active entitlement status

Admin API reference

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

POST /admin/segments — Create segment

Body:

{
  "name": "Power Users",
  "description": "Users active in the last 7 days with 5+ day streak",
  "rules": {
    "operator": "AND",
    "conditions": [
      { "field": "last_seen_at", "op": "within", "value": "7d" },
      { "field": "properties.streak_count", "op": "gte", "value": 5 }
    ]
  }
}

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_list_segmentsList all segments including system segments
amba_create_segmentCreate a custom segment with rule-based filters

Example

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

amba_create_segment({
  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" }
    ]
  }
})

Database tables

TablePurpose
segmentsSegment definitions with name, rules (JSONB), and is_system flag
segment_membershipsUser-to-segment membership, updated every 15 minutes

On this page