A valid request URL is required to generate request examples{
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"definition": {
"groups": [
{
"conditions": [
{
"source": "attribute",
"field": "email_verified",
"operator": "is_true"
}
]
},
{
"conditions": [
{
"source": "event",
"operator": "not_occurred",
"value": "checkout.paid",
"days": 30
}
]
}
]
},
"definition_version": 123,
"members": 123,
"archived_at": "2023-11-07T05:31:56Z",
"system_key": "<string>",
"system": true,
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}Create a segment
Requires segments:manage. The definition is validated on the way in and a condition this engine cannot state exactly is refused rather than approximated — see SegmentDefinition for what that covers and why.
Names are unique per environment; a duplicate answers 409 segment_exists. The same name in the other environment is a different segment, which is the point of the scope: “everybody on the pro plan” names two different groups of people in live and in test.
A valid request URL is required to generate request examples{
"segment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"environment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"definition": {
"groups": [
{
"conditions": [
{
"source": "attribute",
"field": "email_verified",
"operator": "is_true"
}
]
},
{
"conditions": [
{
"source": "event",
"operator": "not_occurred",
"value": "checkout.paid",
"days": 30
}
]
}
]
},
"definition_version": 123,
"members": 123,
"archived_at": "2023-11-07T05:31:56Z",
"system_key": "<string>",
"system": true,
"created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}{
"error": {
"code": "forbidden",
"message": "your role does not allow this action"
}
}Autorizações
A staff session token, uk_st_…. Minted by sign-up, sign-in or the two-factor exchange. Only a 401 means it is spent; not_a_member (403) is about the organization named in X-Organization-Id and leaves the token good for the others.
Cabeçalhos
The organization the caller is acting on — the org_… code that appears in the panel URL. It identifies; the membership JOIN is what authorizes, so a forged code reads nothing: the answer is not_a_member (403), which does not mean the session is over. Absent, the session's default organization answers, or — if that membership was revoked while the session was open — any other one the caller still holds.
Parâmetros de consulta
Which environment to act in. A view parameter, valid only on the staff surface — a machine credential never chooses its environment, it is resolved from the key.
live, test Corpo
120A conjunction of groups; within a group, a disjunction of conditions — (A OR B) AND C. Two levels and no more: arbitrary nesting is a precedence question and a form nobody can draw.
What it refuses. A condition this engine cannot state exactly is refused rather than approximated, and two of those refusals are decisions rather than gaps. A custom contact attribute (attributes.tier) has no store behind it — the contact columns are the profile and the first-touch attribution — so matching one would mean matching something else. An entitlement is resolved by the entitlements engine, with overrides that replace rather than maximise, an expiry, a dunning grace, and a status that can honestly answer "cannot tell"; a segment targets the plan instead, which is a row. An activity metric in a test environment is refused too: the meter never records test, so the condition could only ever match nobody.
Show child attributes
Show child attributes
{
"groups": [
{
"conditions": [
{
"source": "attribute",
"field": "email_verified",
"operator": "is_true"
}
]
},
{
"conditions": [
{
"source": "event",
"operator": "not_occurred",
"value": "checkout.paid",
"days": 30
}
]
}
]
}
Resposta
The segment.
An audience, defined declaratively. Every engagement module takes its recipients from one of these rather than growing a filter of its own.
Show child attributes
Show child attributes