Create segment
Create a new audience segment.
DYNAMIC segments (the default) are defined by a condition — a boolean tree that is re-evaluated against your contacts, so membership changes on its own as contact data changes. condition is required for these.
STATIC segments hold a manually managed member list; condition is ignored. Add members with POST /segments/{id}/members.
ApiKeyAuthAuthorizationBearer <API Key>API Key authentication. The project is automatically derived from the key.
/v1/track requires a public key (pk_*) — it is the one endpoint intended for client-side use, and a secret key is rejected there with 401.
Every other endpoint requires a secret key (sk_*) and rejects public keys with 401.
So the two key types are not interchangeable in either direction: pick the key that matches the endpoint you are calling.
application/json- body
name*stringlength <= 100description?stringlength <= 500type?stringDefaults to DYNAMIC when omitted.
"DYNAMIC""DYNAMIC""STATIC"condition?Required for DYNAMIC segments; ignored for STATIC ones.
trackMembership?booleanEmit segment.<slug>.entry / segment.<slug>.exit events as contacts join and leave. These can be used as workflow triggers.
falseSegment created
application/json- response
id?stringname?stringdescription?stringtype?stringDYNAMIC segments are evaluated from condition. STATIC segments hold a manually managed member list.
"DYNAMIC""STATIC"condition?Filter condition for DYNAMIC segments. Null for STATIC segments.
trackMembership?booleanWhen true, contacts entering or leaving the segment emit segment.<slug>.entry / segment.<slug>.exit events.
memberCount?integerCached member count, refreshed by a background job rather than computed per request.
projectId?stringcreatedAt?stringdate-timeupdatedAt?stringdate-timecurl -X POST 'https://api.send.47signals.com/segments' \ -H 'Content-Type: application/json' \ -d '{ "name": "Premium Users", "condition": { "logic": "AND", "groups": [ { "filters": [ { "field": "data.plan", "operator": "equals", "value": "premium" } ] } ] }, "trackMembership": true}'{ "id": "string", "name": "string", "description": "string", "type": "DYNAMIC", "condition": { "logic": "AND", "groups": [ { "filters": [ { "field": "string", "operator": "equals", "value": null, "unit": "days" } ], "conditions": {} } ] }, "trackMembership": true, "memberCount": 0, "projectId": "string", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z"}