Get Specialized Cohort List
Enterprise
This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.
Endpoint
/o?method=get_cohort_list
Overview
Retrieves a filtered list of cohorts with advanced options for pagination, sorting, searching, and custom field projection. Provides efficient cohort discovery across large numbers of cohorts.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Required permission:
Readon thecohortsfeature
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api_key | String | Yes (or auth_token) | API key for authentication |
| auth_token | String | Yes (or api_key) | Auth token for authentication |
| app_id | String | Yes | Application identifier |
| type | String | No | Optional cohort type filter (manual or auto) |
Examples
Example 1: Get a filtered cohort list
Request:
curl -X GET "https://your-server.com/o?method=get_cohort_list" \
-d "api_key=YOUR_API_KEY" \
-d "app_id=YOUR_APP_ID" \
-d "type=manual"
Response
Success Response
{
"a60e8cc976840453894a590575712351": "DocAuditTemp"
}
Response Fields
| Field | Type | Description |
|---|---|---|
<cohort_id> | String | Cohort name keyed by cohort ID |
Error Responses
| HTTP Status | Error Response | Description |
|---|---|---|
| 400 | {"result": "Insufficient permissions"} | User lacks Read permission |
Behavior
- Validates read permission for
cohortsfeature. - Queries
cohortsbyapp_id(and optionaltype). - Applies visibility filter and excludes names starting with
[CLY]_. - Returns map object keyed by cohort ID with cohort name values.
Limitations
- Returns only
_id -> namemapping, not full cohort documents.
Related Endpoints
- Get all cohorts - GET /o?method=get_cohorts
- Get single cohort - GET /o?method=get_cohort
Use Cases
- UI list display: Populate cohort selection dropdown with search
- Admin dashboard: Show paginated cohort list with sorting
- Bulk export: Export multiple cohorts with specific fields
- Cohort discovery: Find cohorts matching search criteria
- Analytics: Compare cohorts ranked by member count
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly.cohorts | Collection: | Source of cohort list |
countly.cohortdata | Optional Collection: | Source of metrics if requested |
Database Collections
countly.cohorts- Stores cohort definitions and metadata