Segments API

Rule-based groups of contacts. 8 ops: get_segment_fields, list_segments, get_segment, preview_segment, create_segment, update_segment, delete_segment, explain_segment_membership.

Rule-based groups of contacts.

Get segment fields · POST /api/v1/get_segment_fields · scope segments:read or GET …?input=

The fields, field families (attributes.<key>, consent.<purpose>, event.<name>) and operators a segment definition may use, with what each means.

curl -X POST https://getwabi.dev/api/v1/get_segment_fields \  -H "Authorization: Bearer wabi_…"

List segments · POST /api/v1/list_segments · scope segments:read or GET …?input=

Saved segments (with their last computed member count) and the built-in ones (builtin:needs_reply, builtin:window_expiring, builtin:marketing_eligible…). Use a segment id in list_contacts, export_contacts or create_campaign. plan_allows_saving says whether create_segment works on this plan.

curl -X POST https://getwabi.dev/api/v1/list_segments \  -H "Authorization: Bearer wabi_…"

Get a segment · POST /api/v1/get_segment · scope segments:read or GET …?input=

A segment's definition with its live member count and the first members.

curl -X POST https://getwabi.dev/api/v1/get_segment \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"segment":"segment"}'

Preview a segment · POST /api/v1/preview_segment · scope segments:read or GET …?input=

Counts and lists the contacts an unsaved definition matches, to try rules before saving. Works on every plan.

curl -X POST https://getwabi.dev/api/v1/preview_segment \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"definition":null}'

Create a segment · POST /api/v1/create_segment · scope segments:write

Saves a named segment (Growth plan and up). Membership stays live: it is computed when read. Returns the segment with its member count.

curl -X POST https://getwabi.dev/api/v1/create_segment \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"name":"Support","definition":null}'

Update a segment · POST /api/v1/update_segment · scope segments:write

Renames a saved segment or replaces its definition. Returns it with a fresh count.

curl -X POST https://getwabi.dev/api/v1/update_segment \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"segment":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Delete a segment · POST /api/v1/delete_segment · scope segments:write

Deletes a saved segment (contacts are untouched; campaigns keep their recipients).

curl -X POST https://getwabi.dev/api/v1/delete_segment \  -H "Authorization: Bearer wabi_…" \  -H "Content-Type: application/json" \  -d '{"segment":"6f1c2e0a-4b7d-4c2e-9a51-0d3b8e7f9a10"}'

Why a contact qualifies · POST /api/v1/explain_segment_membership · scope segments:read or GET …?input=

Evaluates a segment (or an unsaved definition) on one contact and returns every rule with matched true/false and the contact's actual value, so you can see why they are in or out.

curl -X POST https://getwabi.dev/api/v1/explain_segment_membership \  -H "Authorization: Bearer wabi_…"