Segmentation population API endpoints
This functionality is available for Creatio 10.2 and later.
The Segmentation population API is part of the Segmentation Engine API. The Segmentation population API provides endpoints that manage the members of a segment whose population mode is "Direct list" through REST API calls. Such a segment has no entry or exit rules: an external system or a business process adds, removes, replaces, and clears its members. Learn more: Populate a segment through the API or a business process.
The AddMembers, RemoveMembers, ReplaceMembers, and ClearMembers endpoints are called membership endpoints. The membership endpoints work only for an active segment whose population mode is "Direct list." Creatio rejects calls for a segment that is not activated yet, is paused, or is populated by rules. A membership call never changes the population status or the segment status. The only exception is a call that finds the membership table of the segment missing: such a call sets the population status to "Error." Learn more: Error handling.
Each call runs synchronously on behalf of the authenticated user and applies all changes in a single transaction. Creatio applies calls on a segment one after another. A call that waits for another call on the same segment longer than the lock timeout is rejected with the "Busy" rejection. The "Segment membership lock timeout (seconds)" (SegmentMembershipLockTimeout code) system setting specifies the timeout. Out of the box, the value is set to "30" (seconds). If the setting is empty or set to "0," Creatio uses the out-of-the-box value.
To call the endpoints, the user needs permission to edit the "Segments" (SysDataSegment code) object and access to read and edit the segment record.
Add members to a segment
Request string
POST /0/rest/SegmentService/AddMembers
Add contacts to a segment whose population mode is "Direct list." Creatio processes the requested contacts as follows:
- Adds contacts that are not segment members.
- Restores contacts that were removed from the segment earlier and sets a new
AddedOndate for them. - Leaves current members unchanged.
The call is idempotent. If you repeat it with the same data, Creatio returns the "NoChanges" outcome, and the alreadyInSegmentCount property is equal to the number of requested contacts, so a retry is safe. The "Segment membership max records per call" (SegmentMembershipMaxRecords code) system setting specifies the maximum number of contacts per call. Out of the box, the value is set to "100000." If the setting is empty or set to "0," Creatio uses the out-of-the-box value. If the list of contacts exceeds the maximum number of contacts per call, split it into several calls and send them one after another. The end result is the same as for a single call.
Request headers
Use either OAuth 2.0 authorization or cookie-based authentication. OAuth 2.0 authorization works only on a Creatio instance that uses the Identity Service. On an instance without it, use cookie-based authentication.
Header | Description |
|---|---|
Content-Type | The media type of the request body. Set to "application/json." |
Authorization | OAuth 2.0 authorization only. |
CRT_CSRF | Cookie-based authentication only. CSRF protection token. Set to the value of the |
Cookie | Cookie-based authentication only. Every cookie that the |
Request body
Parameter | Type | Required | Description |
|---|---|---|---|
segmentId | Guid | Yes | The ID of the "Segments" ( |
recordIds | array of Guid | Required, only if | The IDs of the contacts to add. Creatio counts a duplicate ID once and ignores an empty ID ( |
filterData | string | Required, only if | A filter that selects the contacts to add, serialized to a JSON string. Uses the same format as an entry filter. Learn more: Filter segments. The filter must contain at least one enabled condition. Creatio evaluates the filter on the "Contact" ( |
Send exactly one of the recordIds and filterData parameters. Creatio treats a parameter as sent when it is present and not "null," whatever its value, so an empty array or an empty string counts as sent. Creatio rejects the following request bodies with the "InvalidRequest" rejection:
- both the
recordIdsandfilterDataparameters, even if one of the parameters is empty; - neither the
recordIdsnor thefilterDataparameter; - an empty
recordIdsparameter array, or an array that contains only empty IDs; - a
filterDatavalue that is blank, is not valid JSON, or has no enabled condition; - a
filterDatavalue whoserootSchemaNameproperty specifies an object other than "Contact" (Contactcode).
Response body
Creatio returns enumeration values as names, for example, "Applied," not as numbers. The response also contains the removedCount and notInSegmentCount properties, which are "0" for this endpoint. The following table lists the properties of the response body.
Property | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
success | boolean | Indicates whether the call succeeded. Value Description true The false The | ||||||||||||||||||||
segmentId | Guid | The requested segment ID. | ||||||||||||||||||||
outcome | string | The outcome of the call. Value Description Applied The members changed. NoChanges The call is valid, but there was nothing to change, for example, the same call was repeated. Rejected Creatio did not attempt the change. The Failed A step of the call failed, and Creatio committed no change to the members. | ||||||||||||||||||||
rejection | string | The reason for the "Rejected" outcome, or "None." Learn more: Error handling. Value Description None Creatio did not reject the call. InvalidRequest The request body breaks the input rules. SegmentNotFound No segment has this ID, or the user cannot read the segment. NotProcessDriven The population mode of the segment is not "Direct list." Paused The segment is paused. Draft The segment is not activated yet. AccessDenied The user has no permission to edit the segment. Busy Another membership call is changing the same segment. TooManyRecords The request exceeds the maximum number of contacts per call. | ||||||||||||||||||||
message | string | The description of the rejection or failure, or a warning about a successful call. Creatio returns the property only when there is something to report. The text can change between versions, so check the | ||||||||||||||||||||
requestedCount | integer | The number of distinct IDs in the request, or the number of contacts that the filter selected. If the filter selects more contacts than the limit, the value is the limit plus one. | ||||||||||||||||||||
insertedCount | integer | The number of contacts added as new members. | ||||||||||||||||||||
restoredCount | integer | The number of contacts that were removed earlier and restored with a new | ||||||||||||||||||||
alreadyInSegmentCount | integer | The number of requested contacts that already were current members. | ||||||||||||||||||||
notFoundCount | integer | The number of IDs that do not match a contact the user can read. Creatio does not distinguish an unknown ID from a contact the user cannot read. | ||||||||||||||||||||
totalActiveMembers | integer | The number of active members after the call. Creatio copies the value to the "Current contacts" ( | ||||||||||||||||||||
startedOn | string | The date and time when the call started, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. | ||||||||||||||||||||
completedOn | string | The date and time when the call completed, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. |
Usage example
The following example adds the contacts whose IDs are "22222222-2222-2222-2222-222222222222" and "33333333-3333-3333-3333-333333333333" to the segment whose ID is "11111111-1111-1111-1111-111111111111" using OAuth 2.0 authorization.
- Request (OAuth 2.0)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/AddMembers" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {access token}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111",
"recordIds": [
"22222222-2222-2222-2222-222222222222",
"33333333-3333-3333-3333-333333333333"
]
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 2,
"insertedCount": 2,
"restoredCount": 0,
"alreadyInSegmentCount": 0,
"notFoundCount": 0,
"removedCount": 0,
"notInSegmentCount": 0,
"totalActiveMembers": 2,
"startedOn": "2026-10-11T20:15:30.123Z",
"completedOn": "2026-10-11T20:15:31.456Z"
}
The following example adds the contacts whose IDs are "22222222-2222-2222-2222-222222222222" and "33333333-3333-3333-3333-333333333333" to the segment whose ID is "11111111-1111-1111-1111-111111111111" using cookie-based authentication. Replace {login cookies} with every cookie that the authentication request returned, in the name=value; name=value format, and {csrf token} with the value of the CRT_CSRF cookie.
- Request (cookie-based authentication)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/AddMembers" \
-H "Content-Type: application/json" \
-H "CRT_CSRF: {csrf token}" \
-H "Cookie: {login cookies}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111",
"recordIds": [
"22222222-2222-2222-2222-222222222222",
"33333333-3333-3333-3333-333333333333"
]
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 2,
"insertedCount": 2,
"restoredCount": 0,
"alreadyInSegmentCount": 0,
"notFoundCount": 0,
"removedCount": 0,
"notInSegmentCount": 0,
"totalActiveMembers": 2,
"startedOn": "2026-10-11T20:15:30.123Z",
"completedOn": "2026-10-11T20:15:31.456Z"
}
Remove members from a segment
Request string
POST /0/rest/SegmentService/RemoveMembers
Remove members from a segment whose population mode is "Direct list." Creatio marks the members as removed by setting the RemovedOn date and keeps their membership history. A later add or replace call restores them. Creatio skips requested contacts that are not current members and counts them in the notInSegmentCount property.
The call is idempotent. If you repeat it with the same data, Creatio returns the "NoChanges" outcome, and the notInSegmentCount property is equal to the number of requested contacts, so a retry is safe. If the list of members exceeds the maximum number of contacts per call, split it into several calls and send them one after another. The end result is the same as for a single call.
Request headers
Use either OAuth 2.0 authorization or cookie-based authentication. OAuth 2.0 authorization works only on a Creatio instance that uses the Identity Service. On an instance without it, use cookie-based authentication.
Header | Description |
|---|---|
Content-Type | The media type of the request body. Set to "application/json." |
Authorization | OAuth 2.0 authorization only. |
CRT_CSRF | Cookie-based authentication only. CSRF protection token. Set to the value of the |
Cookie | Cookie-based authentication only. Every cookie that the |
Request body
Parameter | Type | Required | Description |
|---|---|---|---|
segmentId | Guid | Yes | The ID of the "Segments" ( |
recordIds | array of Guid | Required, only if | The IDs of the members to remove. Creatio counts a duplicate ID once and ignores an empty ID ( |
filterData | string | Required, only if | A filter that selects the members to remove, serialized to a JSON string. Uses the same format as an entry filter. Learn more: Filter segments. The filter must contain at least one enabled condition. Creatio evaluates the filter on the "Contact" ( |
Send exactly one of the recordIds and filterData parameters. Creatio treats a parameter as sent when it is present and not "null," whatever its value, so an empty array or an empty string counts as sent. Creatio rejects the following request bodies with the "InvalidRequest" rejection:
- both the
recordIdsandfilterDataparameters, even if one of the parameters is empty; - neither the
recordIdsnor thefilterDataparameter; - an empty
recordIdsparameter array, or an array that contains only empty IDs; - a
filterDatavalue that is blank, is not valid JSON, or has no enabled condition; - a
filterDatavalue whoserootSchemaNameproperty specifies an object other than "Contact" (Contactcode).
When the call passes IDs, Creatio removes the listed members whether or not the user can read the contact records. When the call passes a filter, Creatio evaluates the filter with the access permissions of the user, so the call removes only members that the user can read.
Response body
Creatio returns enumeration values as names, for example, "Applied," not as numbers. The response also contains the insertedCount, restoredCount, alreadyInSegmentCount, and notFoundCount properties, which are "0" for this endpoint. The following table lists the properties of the response body.
Property | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
success | boolean | Indicates whether the call succeeded. Value Description true The false The | ||||||||||||||||||||
segmentId | Guid | The requested segment ID. | ||||||||||||||||||||
outcome | string | The outcome of the call. Value Description Applied The members changed. NoChanges The call is valid, but there was nothing to change, for example, the same call was repeated. Rejected Creatio did not attempt the change. The Failed A step of the call failed, and Creatio committed no change to the members. | ||||||||||||||||||||
rejection | string | The reason for the "Rejected" outcome, or "None." Learn more: Error handling. Value Description None Creatio did not reject the call. InvalidRequest The request body breaks the input rules. SegmentNotFound No segment has this ID, or the user cannot read the segment. NotProcessDriven The population mode of the segment is not "Direct list." Paused The segment is paused. Draft The segment is not activated yet. AccessDenied The user has no permission to edit the segment. Busy Another membership call is changing the same segment. TooManyRecords The request exceeds the maximum number of contacts per call. | ||||||||||||||||||||
message | string | The description of the rejection or failure, or a warning about a successful call. Creatio returns the property only when there is something to report. The text can change between versions, so check the | ||||||||||||||||||||
requestedCount | integer | The number of distinct IDs in the request, or the number of contacts that the filter selected. If the filter selects more contacts than the limit, the value is the limit plus one. | ||||||||||||||||||||
removedCount | integer | The number of removed members. | ||||||||||||||||||||
notInSegmentCount | integer | The number of requested contacts that were not current members. | ||||||||||||||||||||
totalActiveMembers | integer | The number of active members after the call. Creatio copies the value to the "Current contacts" ( | ||||||||||||||||||||
startedOn | string | The date and time when the call started, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. | ||||||||||||||||||||
completedOn | string | The date and time when the call completed, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. |
Usage example
The following example removes the "22222222-2222-2222-2222-222222222222" member and the "44444444-4444-4444-4444-444444444444" contact, which is not a member, from the segment whose ID is "11111111-1111-1111-1111-111111111111" using OAuth 2.0 authorization.
- Request (OAuth 2.0)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/RemoveMembers" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {access token}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111",
"recordIds": [
"22222222-2222-2222-2222-222222222222",
"44444444-4444-4444-4444-444444444444"
]
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 2,
"insertedCount": 0,
"restoredCount": 0,
"alreadyInSegmentCount": 0,
"notFoundCount": 0,
"removedCount": 1,
"notInSegmentCount": 1,
"totalActiveMembers": 1,
"startedOn": "2026-10-11T20:16:02.210Z",
"completedOn": "2026-10-11T20:16:02.388Z"
}
The following example removes the "22222222-2222-2222-2222-222222222222" member and the "44444444-4444-4444-4444-444444444444" contact, which is not a member, from the segment whose ID is "11111111-1111-1111-1111-111111111111" using cookie-based authentication. Replace {login cookies} with every cookie that the authentication request returned, in the name=value; name=value format, and {csrf token} with the value of the CRT_CSRF cookie.
- Request (cookie-based authentication)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/RemoveMembers" \
-H "Content-Type: application/json" \
-H "CRT_CSRF: {csrf token}" \
-H "Cookie: {login cookies}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111",
"recordIds": [
"22222222-2222-2222-2222-222222222222",
"44444444-4444-4444-4444-444444444444"
]
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 2,
"insertedCount": 0,
"restoredCount": 0,
"alreadyInSegmentCount": 0,
"notFoundCount": 0,
"removedCount": 1,
"notInSegmentCount": 1,
"totalActiveMembers": 1,
"startedOn": "2026-10-11T20:16:02.210Z",
"completedOn": "2026-10-11T20:16:02.388Z"
}
Replace segment members
Request string
POST /0/rest/SegmentService/ReplaceMembers
Make the active members of a segment whose population mode is "Direct list" equal to the given list of contacts. In a single transaction, Creatio removes the current members that are not in the list and adds the contacts of the list that are not members. Members that stay keep their AddedOn date. Users and queries that read the segment never see it empty or partially replaced.
The call is idempotent. If you repeat it with the same data, Creatio returns the "NoChanges" outcome, and the alreadyInSegmentCount property is equal to the number of requested contacts that the user can read, so a retry is safe.
Request headers
Use either OAuth 2.0 authorization or cookie-based authentication. OAuth 2.0 authorization works only on a Creatio instance that uses the Identity Service. On an instance without it, use cookie-based authentication.
Header | Description |
|---|---|
Content-Type | The media type of the request body. Set to "application/json." |
Authorization | OAuth 2.0 authorization only. |
CRT_CSRF | Cookie-based authentication only. CSRF protection token. Set to the value of the |
Cookie | Cookie-based authentication only. Every cookie that the |
Request body
You cannot split a replace call into several calls, since each call makes the segment equal to its own list. If the list exceeds the maximum number of contacts per call, clear the segment and add the contacts in several calls. Between these calls, the segment is partially filled, and campaigns and filters that use it see that state. If the external system stores the list it sent previously, send only the difference instead: call the RemoveMembers endpoint for the contacts that left the list and the AddMembers endpoint for the contacts that joined it.
Parameter | Type | Required | Description |
|---|---|---|---|
segmentId | Guid | Yes | The ID of the "Segments" ( |
recordIds | array of Guid | Required, only if | The IDs of the contacts that the segment must contain after the call. Creatio counts a duplicate ID once and ignores an empty ID ( |
filterData | string | Required, only if | A filter that selects the contacts that the segment must contain after the call, serialized to a JSON string. Uses the same format as an entry filter. Learn more: Filter segments. The filter must contain at least one enabled condition. Creatio evaluates the filter on the "Contact" ( |
Send exactly one of the recordIds and filterData parameters. Creatio treats a parameter as sent when it is present and not "null," whatever its value, so an empty array or an empty string counts as sent. Creatio rejects the following request bodies with the "InvalidRequest" rejection:
- both the
recordIdsandfilterDataparameters, even if one of the parameters is empty; - neither the
recordIdsnor thefilterDataparameter; - an empty
recordIdsparameter array, or an array that contains only empty IDs; - a
filterDatavalue that is blank, is not valid JSON, or has no enabled condition; - a
filterDatavalue whoserootSchemaNameproperty specifies an object other than "Contact" (Contactcode).
Response body
Creatio returns enumeration values as names, for example, "Applied," not as numbers. The response also contains the notInSegmentCount property, which is "0" for this endpoint. The following table lists the properties of the response body.
Property | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
success | boolean | Indicates whether the call succeeded. Value Description true The false The | ||||||||||||||||||||
segmentId | Guid | The requested segment ID. | ||||||||||||||||||||
outcome | string | The outcome of the call. Value Description Applied The members changed. NoChanges The call is valid, but there was nothing to change, for example, the same call was repeated. Rejected Creatio did not attempt the change. The Failed A step of the call failed, and Creatio committed no change to the members. | ||||||||||||||||||||
rejection | string | The reason for the "Rejected" outcome, or "None." Learn more: Error handling. Value Description None Creatio did not reject the call. InvalidRequest The request body breaks the input rules. SegmentNotFound No segment has this ID, or the user cannot read the segment. NotProcessDriven The population mode of the segment is not "Direct list." Paused The segment is paused. Draft The segment is not activated yet. AccessDenied The user has no permission to edit the segment. Busy Another membership call is changing the same segment. TooManyRecords The request exceeds the maximum number of contacts per call. | ||||||||||||||||||||
message | string | The description of the rejection or failure, or a warning about a successful call. Creatio returns the property only when there is something to report. The text can change between versions, so check the | ||||||||||||||||||||
requestedCount | integer | The number of distinct IDs in the request, or the number of contacts that the filter selected. If the filter selects more contacts than the limit, the value is the limit plus one. | ||||||||||||||||||||
insertedCount | integer | The number of contacts added as new members. | ||||||||||||||||||||
restoredCount | integer | The number of contacts that were removed earlier and restored with a new | ||||||||||||||||||||
alreadyInSegmentCount | integer | The number of requested contacts that already were current members. | ||||||||||||||||||||
notFoundCount | integer | The number of IDs that do not match a contact the user can read. Creatio does not distinguish an unknown ID from a contact the user cannot read. | ||||||||||||||||||||
removedCount | integer | The number of removed members. | ||||||||||||||||||||
totalActiveMembers | integer | The number of active members after the call. Creatio copies the value to the "Current contacts" ( | ||||||||||||||||||||
startedOn | string | The date and time when the call started, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. | ||||||||||||||||||||
completedOn | string | The date and time when the call completed, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. |
Creatio handles the result of a replace call as follows:
- The segment becomes equal to the part of the list that the user can read. Creatio counts the IDs of contacts that the user cannot read in the
notFoundCountproperty and removes the current members that are not in that part. - Creatio rejects with the "InvalidRequest" rejection a call that selects no contact the user can read: an empty array, IDs that are all unknown or not readable, or a filter that selects nothing. Nothing changes, so an empty or outdated source never empties the segment. To remove every member, use the
ClearMembersendpoint.
Usage example
The following example makes the segment whose ID is "11111111-1111-1111-1111-111111111111" contain only the contacts whose email contains "@creatio.com" using OAuth 2.0 authorization. The example passes the following filter in the filterData parameter.
{
"rootSchemaName": "Contact",
"filterType": 6,
"logicalOperation": 0,
"isEnabled": true,
"items": {
"EmailContainsCreatio": {
"filterType": 1,
"comparisonType": 11,
"isEnabled": true,
"leftExpression": {
"expressionType": 0,
"columnPath": "Email"
},
"rightExpression": {
"expressionType": 2,
"parameter": {
"dataValueType": 1,
"value": "@creatio.com"
}
}
}
}
}
Serialize the filter to a JSON string and pass the string in the filterData parameter.
- Request (OAuth 2.0)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/ReplaceMembers" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {access token}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111",
"filterData": "{\"rootSchemaName\":\"Contact\",\"filterType\":6,\"logicalOperation\":0,\"isEnabled\":true,\"items\":{\"EmailContainsCreatio\":{\"filterType\":1,\"comparisonType\":11,\"isEnabled\":true,\"leftExpression\":{\"expressionType\":0,\"columnPath\":\"Email\"},\"rightExpression\":{\"expressionType\":2,\"parameter\":{\"dataValueType\":1,\"value\":\"@creatio.com\"}}}}}"
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 5,
"insertedCount": 4,
"restoredCount": 0,
"alreadyInSegmentCount": 1,
"notFoundCount": 0,
"removedCount": 0,
"notInSegmentCount": 0,
"totalActiveMembers": 5,
"startedOn": "2026-10-11T20:17:44.901Z",
"completedOn": "2026-10-11T20:17:45.320Z"
}
The following example makes the segment whose ID is "11111111-1111-1111-1111-111111111111" contain only the contacts whose email contains "@creatio.com" using cookie-based authentication. Replace {login cookies} with every cookie that the authentication request returned, in the name=value; name=value format, and {csrf token} with the value of the CRT_CSRF cookie.
- Request (cookie-based authentication)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/ReplaceMembers" \
-H "Content-Type: application/json" \
-H "CRT_CSRF: {csrf token}" \
-H "Cookie: {login cookies}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111",
"filterData": "{\"rootSchemaName\":\"Contact\",\"filterType\":6,\"logicalOperation\":0,\"isEnabled\":true,\"items\":{\"EmailContainsCreatio\":{\"filterType\":1,\"comparisonType\":11,\"isEnabled\":true,\"leftExpression\":{\"expressionType\":0,\"columnPath\":\"Email\"},\"rightExpression\":{\"expressionType\":2,\"parameter\":{\"dataValueType\":1,\"value\":\"@creatio.com\"}}}}}"
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 5,
"insertedCount": 4,
"restoredCount": 0,
"alreadyInSegmentCount": 1,
"notFoundCount": 0,
"removedCount": 0,
"notInSegmentCount": 0,
"totalActiveMembers": 5,
"startedOn": "2026-10-11T20:17:44.901Z",
"completedOn": "2026-10-11T20:17:45.320Z"
}
Clear segment members
Request string
POST /0/rest/SegmentService/ClearMembers
Remove every current member of a segment whose population mode is "Direct list." Creatio marks the members as removed by setting the RemovedOn date. Unlike the Truncate endpoint, which deletes the membership rows and resets the population status to "Draft," clearing keeps the membership history and both statuses. Clearing a segment that has no members returns the "NoChanges" outcome.
The call is idempotent. If you repeat it, Creatio returns the "NoChanges" outcome, and the removedCount property is "0," so a retry is safe.
Request headers
Use either OAuth 2.0 authorization or cookie-based authentication. OAuth 2.0 authorization works only on a Creatio instance that uses the Identity Service. On an instance without it, use cookie-based authentication.
Header | Description |
|---|---|
Content-Type | The media type of the request body. Set to "application/json." |
Authorization | OAuth 2.0 authorization only. |
CRT_CSRF | Cookie-based authentication only. CSRF protection token. Set to the value of the |
Cookie | Cookie-based authentication only. Every cookie that the |
Request body
Parameter | Type | Required | Description |
|---|---|---|---|
segmentId | Guid | Yes | The ID of the "Segments" ( |
Response body
Creatio returns enumeration values as names, for example, "Applied," not as numbers. The response also contains the requestedCount, insertedCount, restoredCount, alreadyInSegmentCount, notFoundCount, and notInSegmentCount properties, which are "0" for this endpoint. The following table lists the properties of the response body.
Property | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
success | boolean | Indicates whether the call succeeded. Value Description true The false The | ||||||||||||||||||||
segmentId | Guid | The requested segment ID. | ||||||||||||||||||||
outcome | string | The outcome of the call. Value Description Applied The members changed. NoChanges The call is valid, but there was nothing to change, for example, the same call was repeated. Rejected Creatio did not attempt the change. The Failed A step of the call failed, and Creatio committed no change to the members. | ||||||||||||||||||||
rejection | string | The reason for the "Rejected" outcome, or "None." Learn more: Error handling. Value Description None Creatio did not reject the call. InvalidRequest The request body breaks the input rules. SegmentNotFound No segment has this ID, or the user cannot read the segment. NotProcessDriven The population mode of the segment is not "Direct list." Paused The segment is paused. Draft The segment is not activated yet. AccessDenied The user has no permission to edit the segment. Busy Another membership call is changing the same segment. TooManyRecords The request exceeds the maximum number of contacts per call. | ||||||||||||||||||||
message | string | The description of the rejection or failure, or a warning about a successful call. Creatio returns the property only when there is something to report. The text can change between versions, so check the | ||||||||||||||||||||
removedCount | integer | The number of removed members. | ||||||||||||||||||||
totalActiveMembers | integer | The number of active members after the call. Creatio copies the value to the "Current contacts" ( | ||||||||||||||||||||
startedOn | string | The date and time when the call started, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. | ||||||||||||||||||||
completedOn | string | The date and time when the call completed, in UTC using the ISO 8601 format. Omitted when the call failed before Creatio processed it. |
After a successful call, the totalActiveMembers property is "0." Creatio rejects a request body that contains the recordIds or filterData parameter with the "InvalidRequest" rejection instead of ignoring it, even if the value is an empty array or an empty string.
Usage example
The following example clears the segment whose ID is "11111111-1111-1111-1111-111111111111" using OAuth 2.0 authorization.
- Request (OAuth 2.0)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/ClearMembers" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {access token}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111"
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 0,
"insertedCount": 0,
"restoredCount": 0,
"alreadyInSegmentCount": 0,
"notFoundCount": 0,
"removedCount": 5,
"notInSegmentCount": 0,
"totalActiveMembers": 0,
"startedOn": "2026-10-11T20:18:10.004Z",
"completedOn": "2026-10-11T20:18:10.131Z"
}
The following example clears the segment whose ID is "11111111-1111-1111-1111-111111111111" using cookie-based authentication. Replace {login cookies} with every cookie that the authentication request returned, in the name=value; name=value format, and {csrf token} with the value of the CRT_CSRF cookie.
- Request (cookie-based authentication)
- Response
curl -s -X POST "{Creatio URL}/0/rest/SegmentService/ClearMembers" \
-H "Content-Type: application/json" \
-H "CRT_CSRF: {csrf token}" \
-H "Cookie: {login cookies}" \
-d '{
"segmentId": "11111111-1111-1111-1111-111111111111"
}'
{
"success": true,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Applied",
"rejection": "None",
"requestedCount": 0,
"insertedCount": 0,
"restoredCount": 0,
"alreadyInSegmentCount": 0,
"notFoundCount": 0,
"removedCount": 5,
"notInSegmentCount": 0,
"totalActiveMembers": 0,
"startedOn": "2026-10-11T20:18:10.004Z",
"completedOn": "2026-10-11T20:18:10.131Z"
}
Error handling
Creatio returns the 200 OK HTTP status code for errors related to the request data. Check the success property of the response body instead of the HTTP status code to detect such errors. The membership endpoints name the reason in the rejection property and describe it in the message property. Check the rejection property, since the message text can change. When Creatio rejects a call, it changes nothing in the segment. Find the cause of an error and its solution by the HTTP status code or the value of the rejection property in the following table.
HTTP status code or rejection | Description | Solution |
|---|---|---|
HTTP status codes | ||
200 OK | Creatio returns this status for successful calls and for errors related to the request data. | Check the |
400 Bad Request | Creatio returns this status in the following cases:
On .NET, Creatio returns the 200 OK HTTP status code and the "InvalidRequest" rejection for a body that is not valid JSON or an ID that is not a GUID. The | Fix the request body. Do not retry the call without fixing it. Split a request that is too large. 100000 IDs make about 4 MB of JSON, which fits the limit. |
401 Unauthorized, | The session or the access token is missing or invalid. If the request has the | Authenticate again. |
403 Forbidden | A request that uses cookie-based authentication lacks the | Send every cookie that the authentication request returned and the |
404 Not Found, | The endpoint name is wrong (404 Not Found on both runtimes), or the HTTP method is not POST (405 Method Not Allowed on .NET Framework, 404 Not Found on .NET). | Check the request string. Use POST. |
413 Payload Too Large | The request body exceeds the request size limit of the web server on .NET, which is 30000000 bytes (about 30 MB). On .NET Framework, Creatio returns the 400 Bad Request HTTP status code instead. | Split the request. |
5xx server error | A server-side error outside the endpoint. | Retry the call later. If the error persists, contact your system administrator. |
Rejections | ||
Failed outcome | The | Retry the call after a short delay. If the population status of the segment is "Error," re-create the segment and use the ID of the new segment instead of the old ID in API calls, business processes, and campaigns. If the call keeps failing for another reason, contact your system administrator: the details are in the application log. |
InvalidRequest | The request body breaks the input rules:
| Fix the request body. Do not retry the call without fixing it. |
SegmentNotFound | No segment has this ID, or the user cannot read the segment. Creatio returns the same rejection in both cases. | Verify the ID and the access of the user to the segment. |
NotProcessDriven | The population mode of the segment is "Scheduled" or "Static list." | Use the |
Paused | The segment is paused. | Resume the segment, then retry the call. |
Draft | The segment is not activated yet. | Activate the segment, then retry the call. |
AccessDenied | The user has no permission to edit the "Segments" ( | Grant the permission, or call the endpoint on behalf of a user who has it. |
Busy | Another membership call is changing the same segment and did not finish within the lock timeout. The "Segment membership lock timeout (seconds)" ( | Retry the call after a short delay. |
TooManyRecords | The request contains more distinct IDs than the limit, or the filter selects more contacts than the limit. The "Segment membership max records per call" ( | Split an add or remove call into several calls. For a replace call, clear the segment and add the contacts in several calls. |
For example, a call for a segment that is not activated yet returns the following response.
{
"success": false,
"segmentId": "11111111-1111-1111-1111-111111111111",
"outcome": "Rejected",
"rejection": "Draft",
"message": "Segment 'Loyalty program members' is a draft. Activate it to change its members.",
"requestedCount": 1,
"insertedCount": 0,
"restoredCount": 0,
"alreadyInSegmentCount": 0,
"notFoundCount": 0,
"removedCount": 0,
"notInSegmentCount": 0,
"totalActiveMembers": 0,
"startedOn": "2026-11-11T15:35:39.697Z",
"completedOn": "2026-11-11T15:35:40.026Z"
}
A response whose success property is "true" can contain a warning in the message property that Creatio changed the members but could not update the "Current contacts" (RecordCount code) column. The change is committed, but the totalActiveMembers value in such a response can be "0" and does not reflect the members.
See also
Populate a segment through the API or a business process
Segmentation Engine API endpoints
Manage segments using Segmentation Engine API