Save a segment
Permission
segments:writeRate limit writesIdempotent with Idempotency-Keyconditions: 1 to 50 rules, all of which a contact must meet: [{ rule: { field, condition: "c" (has any of) | "k" (has none of), value: [] } }]. Ids inside rules (tags, lists, products, affiliate programs, field_id, template_id, automation_id, broadcast_id) must belong to this project, or the request is a 422 naming them. The name is unique in the project.
Authorization
ESTAGE-API-KeystringheaderrequiredA project key, est_live_…, from Settings → API keys. Call from server code only.
Body
application/jsonnamestringrequired≤ 255 charsconditionsarray of objectrequired≤ 50 itemsShow 1 field
ruleobjectrequiredfield, condition, value, field_id, template_id, automation_id, broadcast_id
Headers
Idempotency-Keystring≤ 255 charsAny unique string per attempt. A retry with the same key gets the first answer back instead of doing the work twice.
RequestcURL
curl --request POST \ --url 'https://api.estage.com/v1/segments' \ --header 'ESTAGE-API-Key: est_live_your-api-key' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: your-unique-key' \ --data '{ "name": "Customers still mailable", "conditions": [ { "rule": { "field": "tag", "condition": "c", "value": [ 12 ] } }, { "rule": { "field": "suppressed", "condition": "k", "value": [ "email" ] } } ] }'
Created
{
"data": {
"id": 5,
"name": "Customers still mailable",
"conditions": [
{
"rule": {
"field": "tag",
"condition": "c",
"value": [
12
]
}
},
{
"rule": {
"field": "suppressed",
"condition": "k",
"value": [
"email"
]
}
}
],
"created_at": "2026-11-13T10:30:00Z",
"updated_at": "2026-11-13T10:30:00Z"
}
}Example. Errors are
{ error: { code, message, details } }.