Skip to main content
Documentation for version v74

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
list_idint5Required for static segmentsDatabase ID
idint1YesSegment ID
namestring"New segment"YesSegment name
segmentJSON array
YesQueries to update

Request example

tip

When updating segmentation conditions, the specified profile database cannot be changed

For static segments

{
"token": "abcdefghijklmnqrstuvwxyz"
"list_id":5
"name": "Static segment 2",
"is_static": true,
"is_refresh_daily": false
}

For dynamic segments

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

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

For updatable segments

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

</TabItem>

<TabItem value="XML" label="XML">

```xml
<xml>
<token>abcdefghijklmnqrstuvwxyz</token>
<id>28</id>
<name>New segment 2</name>
<is_static>true</is_static>
<is_refresh_daily>true</is_refresh_daily>
<segment array="">
<list_id>6</list_id>
<condition>and</condition>
<limit>0</limit>
<percent_from>0</percent_from>
<percent_to>99</percent_to>
<queries array="">
<compo>domaingroup</compo>
<name>email</name>
<operator>equal</operator>
<type>email</type>
<value array="">
<name>domaingroup</name>
<value>Yahoo! (US)</value>
</value>
</queries>
</segment>
</xml>

Response example

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

Response parameters

ParameterTypeDescription
errorintError code
error_textstringError text
saved_idintSegment ID