Cohorts
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
GET | |
PATCH | |
GET | |
GET | |
GET | |
PATCH | |
GET |
List all cohorts
Required API key scopes
cohort:read
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- limitinteger
Number of results to return per page.
- offsetinteger
The initial index from which to return the results.
Response
Example request
GET
/api /projects /:project_id /cohorts
Example response
Status 200
Create cohorts
Required API key scopes
cohort:write
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request parameters
- namestring
- descriptionstring
- groups
- deletedboolean
- filters
Filters for the cohort. Examples:
# Behavioral filter (performed event) { "properties": { "type": "OR", "values": [{ "type": "OR", "values": [{ "key": "address page viewed", "type": "behavioral", "value": "performed_event", "negation": false, "event_type": "events", "time_value": "30", "time_interval": "day" }] }] } } # Person property filter { "properties": { "type": "OR", "values": [{ "type": "AND", "values": [{ "key": "promoCodes", "type": "person", "value": ["1234567890"], "negation": false, "operator": "exact" }] }] } } # Cohort filter { "properties": { "type": "OR", "values": [{ "type": "AND", "values": [{ "key": "id", "type": "cohort", "value": 8814, "negation": false }] }] } }
- query
- is_staticboolean
- cohort_type
Type of cohort based on filter complexity
static
- staticperson_property
- person_propertybehavioral
- behavioralanalytical
- analytical
- _create_in_folderstring
- _create_static_person_idsarray
Response
Example request
POST
/api /projects /:project_id /cohorts
Example response
Status 201
Retrieve cohorts
Required API key scopes
cohort:read
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Response
Example request
GET
/api /projects /:project_id /cohorts /:id
Example response
Status 200
Update cohorts
Required API key scopes
cohort:write
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request parameters
- namestring
- descriptionstring
- groups
- deletedboolean
- filters
Filters for the cohort. Examples:
# Behavioral filter (performed event) { "properties": { "type": "OR", "values": [{ "type": "OR", "values": [{ "key": "address page viewed", "type": "behavioral", "value": "performed_event", "negation": false, "event_type": "events", "time_value": "30", "time_interval": "day" }] }] } } # Person property filter { "properties": { "type": "OR", "values": [{ "type": "AND", "values": [{ "key": "promoCodes", "type": "person", "value": ["1234567890"], "negation": false, "operator": "exact" }] }] } } # Cohort filter { "properties": { "type": "OR", "values": [{ "type": "AND", "values": [{ "key": "id", "type": "cohort", "value": 8814, "negation": false }] }] } }
- query
- is_staticboolean
- cohort_type
Type of cohort based on filter complexity
static
- staticperson_property
- person_propertybehavioral
- behavioralanalytical
- analytical
- _create_in_folderstring
- _create_static_person_idsarray
Response
Example request
PATCH
/api /projects /:project_id /cohorts /:id
Example response
Status 200
Delete cohorts
Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true
Required API key scopes
cohort:write
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Example request
DELETE
/api /projects /:project_id /cohorts /:id
Example response
Status 405 No response body
Retrieve cohorts activity retrieve
Required API key scopes
activity_log:read
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Example request
GET
/api /projects /:project_id /cohorts /:id /activity
Example response
Status 200 No response body
Update cohorts add persons to static cohort
Required API key scopes
cohort:write
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request parameters
- person_idsarray
List of person UUIDs to add to the cohort
Example request
PATCH
/api /projects /:project_id /cohorts /:id /add_persons_to_static_cohort
Example response
Status 200 No response body
Retrieve cohorts calculation history
Required API key scopes
cohort:read
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Example request
GET
/api /projects /:project_id /cohorts /:id /calculation_history
Example response
Status 200 No response body
Retrieve cohorts duplicate as static cohort
Create a static copy of a dynamic cohort
Required API key scopes
cohort:write
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Example request
GET
/api /projects /:project_id /cohorts /:id /duplicate_as_static_cohort
Example response
Status 200 No response body
Retrieve cohorts persons
Required API key scopes
cohort:read
person:read
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Query parameters
- formatstringOne of:
"csv"
"json"
Example request
GET
/api /projects /:project_id /cohorts /:id /persons
Example response
Status 200 No response body
Update cohorts remove person from static cohort
Required API key scopes
cohort:write
Path parameters
- idinteger
A unique integer value identifying this cohort.
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Request parameters
- person_idstring
Person UUID to remove from the cohort
Example request
PATCH
/api /projects /:project_id /cohorts /:id /remove_person_from_static_cohort
Example response
Status 200 No response body
Retrieve cohorts activity
Required API key scopes
activity_log:read
Path parameters
- project_idstring
Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.
Example request
GET
/api /projects /:project_id /cohorts /activity