Create a segment
Creates a segment from a name and conditions, a tree of op/args nodes in the admin's condition language described with the conditions field, and returns it. The segment is created in General, folder.id 0. Names need not be unique, so a repeated call creates another segment. Use segment_id of the result with list_contacts.
Request
- Base URLhttps://api.getsitecontrol.com
- AuthHTTP bearer
Path parameters
Headers
Makes a retry of a POST safe: a repeat with the same key, body and GSC-Version returns the stored response with Idempotency-Replayed: true instead of running again. The key protects against repeated execution while the key store works. Saving the change and storing the response under the key are not atomic: if the process or the key store fails between them, the change is kept, the key is released after 15 minutes and a retry runs the request again. After a timeout or a 5xx, read the resource to check the result before retrying. 5xx and 429 responses and responses over 256 KB are not stored, so a repeat runs the request again. A key is kept for 24 hours. The same key with another body or version is 422; a repeat while the first request runs is 409.
Request body
Example request
{
"conditions": {
"op": "and",
"args": [
{
"op": "and",
"args": [
{
"op": "=",
"args": [
"{{$contact.isSubscribed}}",
"S"
]
},
{
"op": "ina",
"args": [
"{{$contact.tags}}",
[
12,
15
]
]
}
]
},
{
"op": "or",
"args": [
{
"op": ">",
"args": [
"{{$contact.date}}",
"2026-01-01"
]
},
{
"op": "in",
"args": [
"{{$contact.email}}",
"@example.com"
]
}
]
}
]
}
}Response
Successful Response
Example response
{
"conditions": {
"op": "and",
"args": [
{
"op": "and",
"args": [
{
"op": "=",
"args": [
"{{$contact.isSubscribed}}",
"S"
]
},
{
"op": "ina",
"args": [
"{{$contact.tags}}",
[
12,
15
]
]
}
]
},
{
"op": "or",
"args": [
{
"op": ">",
"args": [
"{{$contact.date}}",
"2026-01-01"
]
},
{
"op": "in",
"args": [
"{{$contact.email}}",
"@example.com"
]
}
]
}
]
}
}Changes
No recorded changes to this operation across all 1 revision of this API.