Build a segment from a natural-language description (AI)
Translate a natural-language audience description into structured Orbit segment rules and return them together with a live preview match-count and sample contacts, in a single round-trip. The proposed rules are constrained to the segmentation engine’s allowlisted fields, validated with a dry-run before the preview, and returned in both the dashboard’s flat rule shape and the normalised FilterAst the engine consumes. Requires the contacts:write scope (owner / admin / developer). Returns 503 SERVICE_UNAVAILABLE when the AI backend is not configured for the platform; callers should fall back to the manual segment builder.
Authorizations
Dashboard JWT token from Clerk
Body
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.
1 - 2000Maximum number of sample contacts returned in preview.sample_contacts. Keeps the payload bounded — the dashboard renders only the first 10.
0 <= x <= 50