Docs: Tool reference
customers toolset

save_segment

Create or update a segment. Creates a segment (no id: name and rules) or updates one (id). Rules use the filter DSL over user and company fields; preview_segment shows who matches first. Membership is evaluated live, so it follows changes to users and companies. Nobody is emailed. Managers and owners.

Toolset
customers
Who can call it
OwnersManagersAPI keys
REST
POST /api/v1/w/{workspace}/segments
Behavior
changes dataidempotentaccepts idempotency_key

Input

FieldTypeDescription
idstringThe segment's ID or name, to update it.
namestring
descriptionstring or null
rulesobjectFilter DSL (Appendix A) over user and company fields: email, email_domain, company, mrr, renewal_date, renewal_risk, created_at, last_active_at, attr.<key>. Company fields match any of the user's companies. Example: {"all":[{"field":"mrr","op":"gte","value":1000},{"field":"attr.plan","op":"eq","value":"enterprise"}]}
expected_versionintegerThe segment's version from your last read; the call fails if it changed since.
idempotency_keystringRetry-safe key. Repeating a call with the same key returns the first result.

Output

FieldTypeDescription
segmentrequiredobject
createdrequiredboolean

Calling it

// MCP: tools/call
{ "name": "save_segment", "arguments": {} }

// Typed client
await carechannel.save_segment({});