Segments
List segments in a workspace and page through their members.
Segments are groups of users or accounts that share a behaviour or attribute. Accoil creates a set of default segments automatically; you can also define your own.
Filter the list by scope to get just user or just account segments, and pass exclude_defaults=true to see only the segments you defined yourself. To read a segment's contents, use GET /v2/segments/{id}/members, which pages the same way as every other list endpoint.
Authorization
BearerAuth API Token Authentication
All API requests require authentication via a Bearer token. Provide your API token in the Authorization header of each request.
Example: Authorization: Bearer accoil_YOUR_API_TOKEN
You can create and manage your API token by navigating to: Settings > Product Settings > API Token in the Accoil web app.
⚠️ Note: This API token is used only for reading data from the Accoil API. It is not the same as the
api_keyused for sending (ingesting) event data into Accoil.
In: header
Query Parameters
The workspace ID used to scope the request. You can find the workspace ID in the app URL:
https://app.accoil.com/48/scores/{workspace_id}/accounts/{id} Example: For the URL https://app.accoil.com/48/scores/123/accounts/154, the workspace_id is 123
Omitting it returns 400 (missing_workspace_id); a value that isn't a
positive integer returns 400 (invalid_workspace_id). A well-formed ID
that doesn't belong to your product returns 404
(workspace_id_not_found).
1 <= valueFilter segments by scope (user or account)
Value in
- "user"
- "account"
When true, exclude default segments created automatically by Accoil
falseMaximum number of results to return
1 <= value <= 10050Number of results to skip for pagination
0 <= value0Response Body
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/v2/segments?workspace_id=1"{ "data": [ { "id": 0, "name": "string", "scope": "user", "default": true, "member_count": 0, "description": "string", "_links": { "property1": { "href": "string" }, "property2": { "href": "string" } } } ], "_meta": { "total_count": 0, "returned_count": 0, "limit": 0, "offset": 0, "workspace_id": 0, "product_id": 0 }}Authorization
BearerAuth API Token Authentication
All API requests require authentication via a Bearer token. Provide your API token in the Authorization header of each request.
Example: Authorization: Bearer accoil_YOUR_API_TOKEN
You can create and manage your API token by navigating to: Settings > Product Settings > API Token in the Accoil web app.
⚠️ Note: This API token is used only for reading data from the Accoil API. It is not the same as the
api_keyused for sending (ingesting) event data into Accoil.
In: header
Path Parameters
The segment ID
Query Parameters
The workspace ID used to scope the request. You can find the workspace ID in the app URL:
https://app.accoil.com/48/scores/{workspace_id}/accounts/{id} Example: For the URL https://app.accoil.com/48/scores/123/accounts/154, the workspace_id is 123
Omitting it returns 400 (missing_workspace_id); a value that isn't a
positive integer returns 400 (invalid_workspace_id). A well-formed ID
that doesn't belong to your product returns 404
(workspace_id_not_found).
1 <= valueResponse Body
application/json
application/json
application/json
curl -X GET "https://example.com/v2/segments/0?workspace_id=1"{ "data": { "id": 0, "name": "string", "scope": "user", "default": true, "member_count": 0, "description": "string", "_links": { "property1": { "href": "string" }, "property2": { "href": "string" } } }, "_meta": { "workspace_id": 0, "product_id": 0 }}Authorization
BearerAuth API Token Authentication
All API requests require authentication via a Bearer token. Provide your API token in the Authorization header of each request.
Example: Authorization: Bearer accoil_YOUR_API_TOKEN
You can create and manage your API token by navigating to: Settings > Product Settings > API Token in the Accoil web app.
⚠️ Note: This API token is used only for reading data from the Accoil API. It is not the same as the
api_keyused for sending (ingesting) event data into Accoil.
In: header
Path Parameters
The segment ID
Query Parameters
The workspace ID used to scope the request. You can find the workspace ID in the app URL:
https://app.accoil.com/48/scores/{workspace_id}/accounts/{id} Example: For the URL https://app.accoil.com/48/scores/123/accounts/154, the workspace_id is 123
Omitting it returns 400 (missing_workspace_id); a value that isn't a
positive integer returns 400 (invalid_workspace_id). A well-formed ID
that doesn't belong to your product returns 404
(workspace_id_not_found).
1 <= valueSort field for members. For user-scoped segments one of: score,
name, last_seen, first_seen, activation_rate,
score_change, frequency. Account-scoped segments additionally
support active_users and total_users.
"score"Sort order
"desc"Value in
- "asc"
- "desc"
Maximum number of results to return
1 <= value <= 10050Number of results to skip for pagination
0 <= value0Response Body
application/json
application/json
application/json
application/json
curl -X GET "https://example.com/v2/segments/0/members?workspace_id=1"{ "data": [ { "id": "string", "scope": "user", "name": "string", "tracking_id": "string", "email": "string", "display_name": "string", "metrics": { "engagement_score": 0.1, "score_change": 0.1, "activation_rate": 0.1, "last_seen": "2019-08-24" }, "_links": { "property1": { "href": "string" }, "property2": { "href": "string" } } } ], "_meta": { "total_count": 0, "returned_count": 0, "limit": 0, "offset": 0, "workspace_id": 0, "product_id": 0, "segment_id": 0, "segment_scope": "user" }}