Skip to main content
GET/segments/

List all user segments

You can return a list with all of your users’ segments. Use a returned URL to list all users added to the segment.

Results are paginated: follow next to get the next page (see Response pagination).

Request​

curl -X GET "https://<your_app_subdomain>.user.com/api/public/segments/" \
-H "Authorization: Token <your_64_char_api_key>" \
-H "Accept: */*; version=2"

Response examples​

{
"previous": null,
"results": [
{
"name": "Active",
"description": "Users who have visited your website at least once in the last 30 days.",
"users": "https://<your_app_subdomain>.user.com/api/public/segments/1033/users/",
"id": 1033,
"object_count": 100,
"too_heavy": false,
"update_interval": 240,
"last_counted": "2024-10-11T10:12:32.661576Z",
"updated_at": "2024-10-11T10:12:32.661848Z"
},
{
"name": "New",
"description": "Users who have visited your website for the first time in the last 24 hours.",
"users": "https://<your_app_subdomain>.user.com/api/public/segments/1034/users/",
"id": 1034,
"object_count": 100,
"too_heavy": false,
"update_interval": 240,
"last_counted": "2024-10-11T10:12:32.661576Z",
"updated_at": "2024-10-11T10:12:32.661848Z"
},
{
"name": "New with email",
"description": "Users who first visited your website in the last 24 hours and have provided an email address.",
"users": "https://<your_app_subdomain>.user.com/api/public/segments/1037/users/",
"id": 1037,
"object_count": 100,
"too_heavy": false,
"update_interval": 240,
"last_counted": "2024-10-11T10:12:32.661576Z",
"updated_at": "2024-10-11T10:12:32.661848Z"
},
{
"name": "With email",
"description": "Users whose email address you have.",
"users": "https://<your_app_subdomain>.user.com/api/public/segments/1036/users/",
"id": 1036,
"object_count": 100,
"too_heavy": false,
"update_interval": 240,
"last_counted": "2024-10-11T10:12:32.661576Z",
"updated_at": "2024-10-11T10:12:32.661848Z"
},
{
"name": "Slipping away",
"description": "Users who have not visited your page within the last 30 days.",
"users": "https://<your_app_subdomain>.user.com/api/public/segments/1035/users/",
"id": 1035,
"object_count": 100,
"too_heavy": false,
"update_interval": 240,
"last_counted": "2024-10-11T10:12:32.661576Z",
"updated_at": "2024-10-11T10:12:32.661848Z"
}
],
"next": null,
"count": 5
}

Response fields​

Fields returned in the 200 OK response body.

countinteger
Number of results across all pages. It can lag behind recent changes; see Response pagination.
nextstring (URL)nullable
URL of the next page of results. null on the last page.
previousstring (URL)nullable
URL of the previous page of results. null on the first page.
resultsarray of objects
Results on this page.
results[].idinteger
ID of the segment.
results[].namestring
Name of the segment.
results[].descriptionstring
Description of the segment; an empty string if it has none.
results[].usersstring (URL)
URL of the endpoint that returns the contacts in this segment.
results[].object_countinteger
Number of records in the segment at its last count.
results[].too_heavyboolean
true if the last recount took too long and was stopped; object_count and last_counted are then from the count before.
results[].update_intervalinteger
How often the segment is recounted, in minutes: 30, 60, 120, 240 (default), 1440, 10080 or 43200.
results[].last_countedstring (date-time)
When the segment was last counted, ISO 8601.
results[].updated_atstring (date-time)
When the segment was last saved, recounts included, ISO 8601.
note

Errors that can come from any endpoint (401, 429, 500, 502, 504) are described in HTTP response codes.