defineSegment.
Define a segment
segments/us-icp.ts
| Field | Role |
|---|---|
model | The model this segment filters — a model handle or modelRef(uuid). Fixed at create; changing it means a new segment. |
filter | Which records the segment includes — the same JSON shape as play eligibility filters and the UI segment builder. |
sort / limit | Optional ordering and cap on the view. |
trackingColumnSlugs | Columns whose changes feed the segment’s change feed. |
columnSlugs | Columns the segment exposes (defaults to all). |
The server derives the segment’s own slug from its
name (which defaults to
the title-cased code slug), and the segment is state-tracked and adopted by
name — so re-deploying the same definition reattaches rather than duplicates.segmentRef("<segment-uuid>") — see Referencing existing resources.
Use a segment
Run a play across a segment as a batch, or export its records:Next steps
Plays
Trigger automations over the rows a segment tracks.
Querying data
SQL over the models behind your segments.

