Skip to main content
POST
Build a segment from a natural-language description (AI)

Authorizations

Authorization
string
header
required

Dashboard JWT token from Clerk

Body

application/json
description
string
required

Natural-language description of the audience to build (e.g. "customers in Germany who opened an email in the last 30 days"). The handler asks the LLM to translate it into structured segment rules constrained to the segmentation engine's allowlisted fields.

Required string length: 1 - 2000
preview_limit
integer
default:10

Maximum number of sample contacts returned in preview.sample_contacts. Keeps the payload bounded — the dashboard renders only the first 10.

Required range: 0 <= x <= 50

Response

The proposed segment rules plus a live preview (match count + sample contacts), wrapped in the standard { data, meta } envelope.

data
object
meta
object