Reference / Segments

Change a segment

update_segmentocmgr segments updatePATCH /v1/segments/{id}WRITE

Rename a segment, describe it, set its status vocabulary (statuses, at most eight, each a key, a label and one of four tones), or rewrite its saved filter. The definition is **replaced whole**, not merged — send the one you want the segment to have, and {} to clear the filter and leave only the people somebody added by hand. A definition that actually changed re-walks the membership in this call, so people enter and leave as a result of it; on a community too large to walk inline the segment is marked instead and segment.refresh does it, which is what evaluatedAt being absent afterwards means. Explicit membership is untouched either way: a filter that stops matching somebody a person put there does not remove them.

Parameters

filterobject

The same filter tree as preview_segment and search_members. Use either filter or definition, not both.

append_statusobject

Append one status atomically, keeping the existing vocabulary and automatic filters. Mutually exclusive with statuses.

filterobject

Set automatically when this member filter matches, first matching status wins. A person-held status is preserved. Cannot reference this segment directly or indirectly.

keystringup to 32 charsREQUIRED

What a write names: lower case letters, digits, - and _, e.g. contacted.

labelstringup to 40 charsREQUIRED

What a person reads, e.g. "Contacted".

tone"accent" | "healthy" | "danger" | "muted"REQUIRED

The colour, from the theme’s four: accent (new, act on it), healthy (done, going well), danger (blocked, lost), muted (parked).

pinnedboolean

Pin or unpin on Home. At most six segments.

segmentstringREQUIRED

The segment to change, by name or id.

namestring

Rename it. Its id and its history are kept.

descriptionstring

What it is for.

definitionobject

The saved filter, **replaced whole** rather than merged — send the definition you want the segment to have. {} clears it, which leaves a segment whose members are only the ones somebody added. A definition that actually changed re-walks the membership, so people enter and leave as a result of this call.

filterobject

The filter language (ADR 0025): a tree over the fields list_segment_fields returns. This is the one to use; the five keys below are what a segment could be saved with before the language existed and are still accepted.

querystring

Free text over name, handle, company and email.

source"self" | "github" | "slack" | "discourse" | "vanilla" | "bevy" | "gainsight-cc" | "gradual" | "bettermode" | "circle" | "flarum" | "verint" | "dev" | "stackoverflow" | "meetup" | "luma" | "discord" | "generic" | "csv" | "enrichment"

Only members with an identity on this source.

companystring

Only members whose golden record names this company.

seen_sincestring (date-time)

Only members seen at or after this instant.

tagsstring[]

Only members carrying at least one of these tags.

statusesobject[]up to 8

The status vocabulary, replaced whole; [] clears it. Statuses already set on people are kept.

filterobject

Set automatically when this member filter matches, first matching status wins. A person-held status is preserved. Cannot reference this segment directly or indirectly.

keystringup to 32 charsREQUIRED

What a write names: lower case letters, digits, - and _, e.g. contacted.

labelstringup to 40 charsREQUIRED

What a person reads, e.g. "Contacted".

tone"accent" | "healthy" | "danger" | "muted"REQUIRED

The colour, from the theme’s four: accent (new, act on it), healthy (done, going well), danger (blocked, lost), muted (parked).

CLI flags

--pin

Pin to Home (at most six segments)

--unpin

Remove from Home

--name <name>

Rename it; the id and the history are kept

--description <text>

What the segment is for

--filter <json>

Replace the saved filter whole; it is never merged

--clear-filter

Leave only the people somebody added by hand

--statuses <json>

Replace the status vocabulary whole: a list of {key, label, tone, filter?} (filter assigns this status automatically); [] clears it

Also in Segments