Skip to main content
Altcraft Docs LogoAltcraft Docs Logo
User guideDeveloper guideAdmin guide
Company siteHelp center
English
  • Русский
  • English
v74
  • v74
  • v73
  • v72
Login
  • User API documentation
  • API interaction
  • Matching
  • Profiles
  • Databases
  • Resources
  • Segments
    • Get statistics on resource
    • Update statistics on segment
    • Add or remove profile
    • Get profile data in a static segment
    • Create segment
    • Update segment
    • Get segment information
    • Get segments list
    • Delete segment
  • Suppression lists
  • Templates and fragments
  • Campaigns
  • Mailings
  • Automation scenarios
  • Loyalty Programs
  • Promo codes
  • Goals
  • Application push notifications
  • Market
  • Analytic reports
  • SendersDev
  • External datatables queries
  • Objects
  • Miscellaneous
  • Importing the API collection in Postman
  • List of API endpoints
  • SDK
  • Segments
  • Create segment
Documentation for version v74

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

Segment type is determined by a combination of parameters:

  • is_static is false — the segment is dynamic
  • is_static is true and is_refresh_daily is false — the segment is static
  • is_static is true and is_refresh_daily is true — the segment is updatable

For static segments​

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

  • JSON
  • XML
{
"name": "Segment 2",
"is_static": true,
"list_id": 5
"is_refresh_daily": false,
"token": "abcdefghijklmnqrstuvwxyz"
}
<xml>
<list_id>2</list_id>
<name>New segment 2</name>
<is_static>true</is_static>
<is_refresh_daily>false</is_refresh_daily>
<token>abcdefghijklmnqrstuvwxyz</token>
</xml>

For dynamic segments​

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

  • JSON
  • XML
{
"token": "abcdefghijklmnqrstuvwxyz"
"name": "Dynamic segment",
"is_static": false,
"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
}
]
}
]
}
],
}
<xml>
<name>Dynamic segment</name>
<is_static>false</is_static>
<segment array="true">
<condition>and</condition>
<limit>0</limit>
<list_id>1</list_id>
<percent_from>0</percent_from>
<percent_to>99</percent_to>
<queries>
<compo>default</compo>
<name>statseg</name>
<operator>once</operator>
<type>statseg</type>
<value array="true">
<name>segment_id</name>
<value>1</value>
</value>
</queries>
<queries>
<compo>default</compo>
<name>statseg</name>
<operator>once</operator>
<type>statseg</type>
<value array="true">
<name>segment_id</name>
<value>2</value>
</value>
</queries>
</segment>
<token>abcdefghijklmnqrstuvwxyz</token>
</xml>

For updatable segments​

When creating an updatable segment, segmentation rules in the segment field are required.

  • JSON
  • XML
{
"name": "Updatable segment",
"is_static": true,
"is_refresh_daily": true,
"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"
}
  <name>New segment 2</name>
<is_static>true</is_static>
<is_refresh_daily>true</is_refresh_daily>
<list_id>1</list_id>
<segment array="">
<condition>and</condition>
<limit>0</limit>
<list_id>1</list_id>
<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>
<token>abcdefghijklmnqrstuvwxyz</token>
</xml>

Response example​

  • JSON
  • XML
{
"data": {
"saved_id": 1
},
"error": 0,
"error_text": "Successful operation"
}
<xml>
<data>
<saved_id>14</saved_id>
</data>
<error>0</error>
<error_text>Successful operation</error_text>
</xml>

Response parameters​

ParameterTypeDescription
errorintКод ошибки
error_textstringТекст ошибки
saved_idintNew segment ID
Last updated on Jun 6, 2024
Previous
Get profile data in a static segment
Next
Update segment
  • Description
  • Request URL
  • Request parameters
    • For static segments
    • For dynamic segments
    • For updatable segments
  • Response example
  • Response parameters
© 2015 - 2025 Altcraft, LLC. All rights reserved.