Loading...
Loading...
Define and use segments — named, saved filters over a Cargo model that become the audience for a batch run, a play trigger, or an export. Triggers: "build a segment of", "filter my contacts where", "who matches this criteria", "save this as a list", "how many companies match", "the Closed-Won segment", "everyone who has not been emailed", "target only accounts that", "what is in this segment", "narrow this down to". Filter JSON uses `conjonction` (not `conjunction`) — misspelling it fails silently. Skip when: running something over the segment — use cargo-orchestration; exporting its rows — use cargo-analytics; ad-hoc SQL over the model — use cargo-storage.
npx skill4agent add getcargohq/cargo-skills cargo-segmentationSeefor full JSON response structures. Seereferences/response-shapes.mdfor common errors and how to fix them. Filter condition kinds and operators live inreferences/troubleshooting.md— the single source of truth for filter JSON.../cargo-orchestration/references/filter-syntax.md
cargo-ai whoaminpm install -g @cargo-ai/cli # no global install? prefix every command with `npx @cargo-ai/cli`
cargo-ai login --email you@company.com # emailed code, no browser; creates the account on first use
# alternatives: --oauth (browser) · --token <api-token> (CI)
cargo-ai whoami # confirm the active workspace before any write{"errorMessage": "..."}--wait-until-finishedget../cargo/references/prerequisites.md| Term | What it is |
|---|---|
| Filter | A JSON object ( |
| Segment | A filter saved with a name, a |
| Change | One computed delta of a segment between two syncs — how many records were |
| Tracking columns | The subset of columns ( |
segment fetchsegment createcargo-ai segmentation segment list # all segments (uuid, name, slug, modelUuid, recordsCount)
cargo-ai storage model list # find the modelUuid a segment must target
cargo-ai storage column list --model-uuid <uuid> # the column slugs your filter conditions referenceGENERATED_PLAY_SEGMENTfromPlay: trueapp.getcargo.io/workspaces/<WORKSPACE_UUID>/models/<MODEL_UUID><WORKSPACE_UUID>cargo-ai whoamicargo-ai segmentation segment list
cargo-ai segmentation segment get <segment-uuid>
cargo-ai segmentation segment create --name "<name>" --model-uuid <uuid> --filter '<json>'
cargo-ai segmentation segment update --uuid <segment-uuid> --filter '<json>'
cargo-ai segmentation segment remove <segment-uuid>
cargo-ai segmentation segment fetch --model-uuid <uuid> --filter '<json>' --limit 50
cargo-ai segmentation segment download --model-uuid <uuid> --filter '<json>'
cargo-ai segmentation change list --segment-uuid <segment-uuid>
cargo-ai segmentation change fetch --uuid <change-uuid> --kinds added --limit 50
cargo-ai segmentation record fetch --model-uuid <uuid> --ids <id[,id…]>kindstringnumberdatebooleanarrayrelation../cargo-orchestration/references/filter-syntax.md{
"conjonction": "and",
"groups": [
{
"conjonction": "and",
"conditions": [
{ "kind": "number", "columnSlug": "employee_count", "operator": "greaterThan", "value": 100 },
{ "kind": "string", "columnSlug": "email", "operator": "isNotEmpty" }
]
}
]
}, notconjonction. The French spelling is intentional and it is the single most expensive typo in the CLI: a misspelled key does not error — the filter silently matches nothing, and you conclude the data is empty. Grep your JSON forconjunctionbefore every call.conjunction
{"conjonction":"and","groups":[]}# 1. How many records match? — inline filter, no saved object, 1 row back
cargo-ai segmentation segment fetch \
--model-uuid <uuid> \
--filter '{"conjonction":"and","groups":[{"conjonction":"and","conditions":[
{"kind":"number","columnSlug":"employee_count","operator":"greaterThan","value":100}]}]}' \
--limit 1
# 2. Happy with the shape? Save it as the real audience.
cargo-ai segmentation segment create \
--name "Mid-market accounts" \
--model-uuid <uuid> \
--filter '<same json>' \
--column-slugs "name,domain,employee_count" \
--tracking-column-slugs "employee_count,funding_stage"segment get <uuid>recordsCount| Command | Returns | Use for |
|---|---|---|
| Records inline as JSON, paginated ( | Inspecting a handful of rows, counting, previewing a filter before saving it |
| A signed URL to the full dataset | Handing the whole audience to the user or another tool — see |
| Specific records by id | Re-reading rows a change feed just told you about |
segment fetch --sync--enrich--limit 3download# What deltas exist for this segment?
cargo-ai segmentation change list --segment-uuid <segment-uuid>
# → { "changes": [ { "uuid", "totalRecordsCount", "addedRecordsCount",
# "updatedRecordsCount", "removedRecordsCount",
# "unchangedRecordsCount", "createdAt" } ] }
# Which records actually entered the audience in that delta?
cargo-ai segmentation change fetch --uuid <change-uuid> --kinds added --limit 50--kindschange fetchaddedupdatedremovedunchanged_kind_id_title_timeupdatedRecordsCount0--tracking-column-slugssegment listsegment getlastChange../cargo-orchestration/SKILL.mdkind: "filter"GENERATED_PLAY_SEGMENT../cargo-orchestration/references/examples/plays.md../cargo-analytics/SKILL.mdsegment download--model-uuid--segment-uuid../cargo-observability/SKILL.md../cargo-gtm/SKILL.mddefineSegment../cargo-cdk/SKILL.mdconjonctionconjunctionsegment download--model-uuid--segment-uuidchange fetch--uuid--kindschange list--segment-uuidsegmentUuid--helpchangerecordfromPlay: true--limit--fetching-limitcargo-ai workspaceManagement report create \
--title "<one-line summary>" \
--description "<commands run, errorMessage verbatim, expected vs actual, UUIDs>"