Skip to main content

Update statistics on segment

Description

Update the subscription statistics of the profiles in the segment.

Returns a response with task ID without waiting for execution.

URL

Method: POST

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

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
db_idint3Yes, for dynamic requestDatabase ID
resource_idint2YesResource ID
idint1YesSegment ID
formatint"json"NoResponse data format
By default – json

Request example

{
"token": "abcdefghijklmnqrstuvwxyz",
"db_id": 1,
"resource_id": 24,
"id": 7,
"format": "json"
}

Response example

{
"data": {
"task_id": "55a345c8-3d79-47ef-b03e-b84ce8e0c126"
},
"error": 0,
"error_text": "Successful operation"
}
ParameterTypeDescription
dataJSON objectsContains the task identifier – task_id
errorintError code
error_textstringError text

Checking the task status

URL

Method: POST

https://example.com/api/v1.1/tasks/status

Request parameters

ParameterTypeExampleRequiredDescription
tokenstring"abcdefghijklmnqrstuvwxyz"YesAPI token
task_idstring"518f4997-ec43-4df5-bfd0-093aaacf679f"YesTask ID

Request example

{
"task_id": "930bfdb0-a5a8-4207-a77d-6b989bdea326",
"token": "abcdefghijklmnqrstuvwxyz"
}

Response example

{
"data": {
"status": "completed",
"progress": 100,
"result": [
{
"channels": [
{
"channel": "email",
"status": {
"subscribed_sendable": 209,
"unconfirmed_sendable": 0
}
},
{
"channel": "push",
"status": {
"subscribed_sendable": 0,
"unconfirmed_sendable": 0
}
},
{
"channel": "sms",
"status": {
"subscribed_sendable": 0,
"unconfirmed_sendable": 0
}
}
],
"in_progress": false,
"list_id": 1,
"refresh_task_id": "",
"resource_id": 27,
"updated": "2024-04-20T09:30:01.583Z"
}
]
},
"error": 0,
"error_text": "Successful operation"
}