Skip to main content

Update segment

Description

Updates segment building rules.

Request URL

Method: POST

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

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
formatstring"json"YesResponse data format.
By default – json
idint1YesSegment ID
namestring"New segment"YesSegment name
segmentJSON array
YesQueries to update

Request example

For static segments

When updating a static segment with the is_refresh_daily flag set to true, the presence of segmentation rules in the segment field is required.

{
"id": 2,
"name": "Static segment 2",
"is_refresh_daily": true,
"segment": [
{
"condition": "and",
"limit": 0,
"list_id": 1,
"percent_from": 1,
"percent_to": 99,
"queries": [
{
"compo": "domaingroup",
"name": "email",
"operator": "equal",
"type": "email",
"value": [
{
"name": "domaingroup",
"value": "Yahoo! (US)"
}
]
}
]
}
],
"token": "abcdefghijklmnqrstuvwxyz"
}

For dynamic segments

When updating a dynamic segment, the presence of segmentation rules in the segment field is required.

{
"id": 3,
"name": "Dynamic segment",
"segment": [
{
"condition": "and",
"limit": 0,
"list_id": 1,
"percent_from": 0,
"percent_to": 99,
"queries": [
{
"compo": "default",
"name": "statseg",
"operator": "once",
"type": "statseg",
"value": [
{
"name": "segment_id",
"value": 1
}
]
},
{
"compo": "default",
"name": "statseg",
"operator": "once",
"type": "statseg",
"value": [
{
"name": "segment_id",
"value": 2
}
]
}
]
}
],
"token": "abcdefghijklmnqrstuvwxyz"
}

Response example

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

Response parameters

ParameterTypeDescription
errorintError code
error_textstringError text
saved_idintSegment ID