Create Cohort
Create a new cohort (user segment) in your project. Cohorts can be static (fixed list of users) or dynamic (automatically updated based on filters).Endpoint
Path Parameters
The ID of the project to create the cohort in
Request Body
Name of the cohort (e.g., “Active Users”, “Power Users”)
Optional description explaining what this cohort represents
Whether this is a static cohort (fixed list) or dynamic (auto-updating based on filters)
Filter criteria for dynamic cohorts. Must contain a
properties key with filter groups.Example structure:HogQL query for creating static cohorts from query results. Must be either
ActorsQuery or HogQLQuery type.Legacy filter format (deprecated). Use
filters instead.CSV file to upload for static cohorts. File should contain person IDs, distinct IDs, or email addresses.Supported column headers:
person_id,person-id, orPerson .iddistinct_idordistinct-idemailore-mail
Response Fields
Unique identifier for the cohort
Name of the cohort
Description of the cohort
Filter criteria defining the cohort membership
Whether this cohort is static (true) or dynamic (false)
Number of users currently in the cohort
Whether the cohort is currently being calculated
User who created the cohort
ISO 8601 timestamp of when the cohort was created
ISO 8601 timestamp of the last time the cohort was calculated
Type of cohort (e.g., “realtime” for real-time evaluation)
Examples
Create Dynamic Cohort
Create a cohort of users who have an email address set:Create Static Cohort
Create a static cohort by uploading a CSV file:Create Behavioral Cohort
Create a cohort based on user actions (users who completed onboarding):Response
Error Responses
Invalid request body or missing required fields
Invalid or missing API key
Insufficient permissions to create cohorts
Notes
- Dynamic cohorts are recalculated periodically to keep membership up to date
- Static cohorts have fixed membership unless manually updated
- Behavioral filters cannot be used in cohorts that are referenced by feature flags
- CSV uploads support person IDs, distinct IDs, and email addresses
- Large cohorts may take time to calculate; check
is_calculatingstatus - Real-time cohorts (for feature flags) have a maximum size limit