Skip to main content

Create segment

Description

Creates a new segment.

Request URL

Method: POST

https://example.com/api/v1.1/segments/add/

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
formatstring"json"NoResponse data format.
By default – json
namestring"New segment"YesNew segment name
segmentJSON array
Yes

Request example

{
"name": "New segment",
"segment": [
{
"condition": "or",
"limit": 0,
"list_id": 1,
"percent_from": 0,
"percent_to": 99,
"queries": [
{
"child": [],
"compo": "dataurl",
"condition": "",
"name": "subscription_email",
"operator": "in_data",
"type": "subscription_email",
"value": [
{
"name": "field",
"value": "subscriptions"
},
{
"name": "resource_id",
"value": 1
},
{
"name": "url",
"value": "http://127.0.0.1:8080/json.email.subscriptions"
}
]
}
]
}
],
"token": "abcdefghijklmnqrstuvwxyz"
}

Response example

{
"data": {
"saved_id": 1
},
"error": 0,
"error_text": "Successful operation"
}

Response parameters

ParameterTypeDescription
errorintКод ошибки
error_textstringТекст ошибки
saved_idintNew segment ID