Docs·Segments
GET
/api/v1/spreelytics/cohorts/:cohortIdGet a segment
Returns one segment with its definition. It answers 404 when the id is not a segment in this audience. Every role can call it, Viewer included.
Keys: an account key or an audience key. Getting started explains both kinds.
Parameters
| Prop | In | Type | Notes |
|---|---|---|---|
cohortId | path | string | The segment id. |
contactListId | query | string | The audience id, a UUID. With an audience key it must be that key's own audience. |
Response
| Prop | Type | Notes |
|---|---|---|
id | string | The segment id. Use it in a chart filter (inCohort), a cohort series or the analytics cohort_id filter. |
name | string | The segment name. |
description | string | The description, or null when there is none. |
definition | PeopleQueryRequestDto | The people-query exactly as saved. Send it to POST /people/query to count the members, or to POST /people/query/members to list them. |
createdAt | string | When it was created. Only the create call answers in ISO 8601 (2026-09-30T09:00:00.000Z). Every other call returns the database form (2026-09-30 09:00:00+00), so parse both. |
updatedAt | string | When it last changed. Create and update calls answer in ISO 8601, lists and reads in the database form, as with createdAt. |
Request
curl 'https://app.spreelytics.com/api/v1/spreelytics/cohorts/:cohortId?contactListId=…' \
-H 'Authorization: Bearer YOUR_API_KEY'
const url = new URL('https://app.spreelytics.com/api/v1/spreelytics/cohorts/:cohortId');
url.searchParams.set('contactListId', '…');
const res = await fetch(url, {
headers: { Authorization: 'Bearer YOUR_API_KEY' },
});
const data = await res.json();
import requests
res = requests.get(
"https://app.spreelytics.com/api/v1/spreelytics/cohorts/:cohortId",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"contactListId": "…"},
)
data = res.json()
Response
{
"id": "string",
"name": "string",
"description": "string",
"definition": {
"conditions": [
{
"source": "internal",
"kind": "revenue",
"event": "string",
"minAmount": 0,
"minCount": 0,
"countOp": "gte",
"propertyFilters": [
null
],
"property": "string",
"propertyOp": "is",
"values": [
null
],
"timeframe": {
"type": null,
"value": null,
"start": null,
"end": null
}
}
],
"match": "all",
"breakdown": "channel",
"startDate": "string",
"endDate": "string"
},
"createdAt": "string",
"updatedAt": "string"
}