Skip to main content
Version: 24.05

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: Read on the cohorts feature

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key for authentication
auth_tokenStringYes (or api_key)Auth token for authentication
app_idStringYesApplication identifier
typeStringNoOptional 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​

FieldTypeDescription
<cohort_id>StringCohort name keyed by cohort ID

Error Responses​

HTTP StatusError ResponseDescription
400{"result": "Insufficient permissions"}User lacks Read permission

Behavior​

  • Validates read permission for cohorts feature.
  • Queries cohorts by app_id (and optional type).
  • Applies visibility filter and excludes names starting with [CLY]_.
  • Returns map object keyed by cohort ID with cohort name values.

Limitations​

  • Returns only _id -> name mapping, not full cohort documents.

Use Cases​

  1. UI list display: Populate cohort selection dropdown with search
  2. Admin dashboard: Show paginated cohort list with sorting
  3. Bulk export: Export multiple cohorts with specific fields
  4. Cohort discovery: Find cohorts matching search criteria
  5. Analytics: Compare cohorts ranked by member count
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.cohortsCollection:Source of cohort list
countly.cohortdataOptional Collection:Source of metrics if requested

Database Collections

  • countly.cohorts - Stores cohort definitions and metadata