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
| Operator | Description | Example |
|---|---|---|
eq | Equals | plan eq "premium" |
neq | Not equals | plan neq "free" |
gt | Greater than | total_xp gt 1000 |
gte | Greater than or equal | streak_count gte 7 |
lt | Less than | days_since_active lt 30 |
lte | Less than or equal | age lte 25 |
contains | String/array contains | tags contains "fitness" |
not_contains | Does not contain | tags not_contains "churned" |
exists | Property exists | email exists |
not_exists | Property does not exist | email not_exists |
within | Within time window | last_seen_at within "7d" |
not_within | Outside time window | last_seen_at not_within "30d" |
Available fields
You can target any field on the user record:
last_seen_at— last activity timestampcreated_at— account creation dateemail— user emailproperties.*— custom user properties (e.g.,properties.plan,properties.age)entitlements.is_active— active entitlement status
Admin API reference
| Method | Path | Description |
|---|---|---|
POST | /admin/segments | Create segment |
GET | /admin/segments | List all segments |
GET | /admin/segments/:id | Get segment details |
PATCH | /admin/segments/:id | Update segment rules |
DELETE | /admin/segments/:id | Delete segment |
POST | /admin/segments/:id/evaluate | Trigger immediate re-evaluation |
POST /admin/segments — Create segment
Body:
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
| Tool | Description |
|---|---|
amba_list_segments | List all segments including system segments |
amba_create_segment | Create a custom segment with rule-based filters |
Example
Database tables
| Table | Purpose |
|---|---|
segments | Segment definitions with name, rules (JSONB), and is_system flag |
segment_memberships | User-to-segment membership, updated every 15 minutes |