cohorts

Embed
Preview of the card
<a href="https://lucidace.com/docs/ref-cohorts"><img src="https://lucidace.com/docs/_api/public/orgs/af34862a-c837-4478-8335-0505efe40459/spaces/da916cd3-c0fc-4b63-b971-b3c13623daf3/pages/2a9cbdad-e9aa-41c0-b49c-520116ed35db/social-card.svg?v=3e7ae33eec8b" alt="cohorts" width="600" height="315"></a>
GEThttps://lucidace.com/v1/projects/{project_id}/cohortsScope cohort:read

Parameters

project_idstringpathrequired
limitintegerquery
qstringquery
cursorstringquery

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/cohorts"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Page of Cohort, newest first
Example
{
  "data": [
    {
      "created_at": "2024-01-01T00:00:00Z",
      "created_by": "string",
      "description": "string",
      "filters": {},
      "id": "string",
      "kind": "string",
      "last_computed_at": "2024-01-01T00:00:00Z",
      "last_error": "string",
      "member_count": 0,
      "name": "string",
      "realtime": true,
      "status": "string",
      "updated_at": "2024-01-01T00:00:00Z",
      "version": 0
    }
  ],
  "next_cursor": "string"
}
Schema
dataCohort[]required
Show child parameters
created_atstringrequired
created_bystring
descriptionstringrequired
filtersobjectrequired
Dynamic: the lc-cohort definition tree. Static: {}.
idstringrequired
kindstringrequired
static | dynamic.
last_computed_atstring
last_errorstring
member_countinteger
namestringrequired
realtimebooleanrequired
Dynamic cohorts: members are also added from the event stream as they qualify (G181).
statusstringrequired
pending | calculating | ready | error.
updated_atstringrequired
versionintegerrequired
Bumped on every definition change.
next_cursorstring
404
POSThttps://lucidace.com/v1/projects/{project_id}/cohortsScope cohort:write

Parameters

project_idstringpathrequired

Request body

application/json
descriptionstring
filtersobject
Dynamic cohorts: an and/or tree of criteria, {"type": "and", "values": [{"type": "performed", "event": "x", "window": {"days": 7}}]} (performed, not_performed, sequence, person_property, in_cohort, not_in_cohort, lifecycle, stopped, started); help page cohorts-actions-api.
kindstringrequired
dynamic (needs filters) or static (fill it with POST .../upload).
namestringrequired
realtimeboolean
Dynamic cohorts: also add members from the event stream as they qualify. Only for and/or trees of performed (event, at least once, last N days) and person_property (eq) criteria; the 15-minute recalculation still removes people who left.
{
  "description": "string",
  "filters": {},
  "kind": "string",
  "name": "string",
  "realtime": true
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/cohorts" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","filters":{},"kind":"string","name":"string","realtime":true}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201
Example
{
  "created_at": "2024-01-01T00:00:00Z",
  "created_by": "string",
  "description": "string",
  "filters": {},
  "id": "string",
  "kind": "string",
  "last_computed_at": "2024-01-01T00:00:00Z",
  "last_error": "string",
  "member_count": 0,
  "name": "string",
  "realtime": true,
  "status": "string",
  "updated_at": "2024-01-01T00:00:00Z",
  "version": 0
}
Schema
created_atstringrequired
created_bystring
descriptionstringrequired
filtersobjectrequired
Dynamic: the lc-cohort definition tree. Static: {}.
idstringrequired
kindstringrequired
static | dynamic.
last_computed_atstring
last_errorstring
member_countinteger
namestringrequired
realtimebooleanrequired
Dynamic cohorts: members are also added from the event stream as they qualify (G181).
statusstringrequired
pending | calculating | ready | error.
updated_atstringrequired
versionintegerrequired
Bumped on every definition change.
400
403
404
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/from-queryScope cohort:write

Parameters

project_idstringpathrequired

Request body

application/json
descriptionstring
namestringrequired
queryobjectrequired
An insight_actors or funnel_persons query IR (its limit is raised to 10 000), or a sql query with a person_id column (the first 10 000 distinct persons are kept).
{
  "description": "string",
  "name": "string",
  "query": {}
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/cohorts/from-query" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","name":"string","query":{}}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201
Example
{
  "added": 0,
  "cohort": {
    "created_at": "2024-01-01T00:00:00Z",
    "created_by": "string",
    "description": "string",
    "filters": {},
    "id": "string",
    "kind": "string",
    "last_computed_at": "2024-01-01T00:00:00Z",
    "last_error": "string",
    "member_count": 0,
    "name": "string",
    "realtime": true,
    "status": "string",
    "updated_at": "2024-01-01T00:00:00Z",
    "version": 0
  }
}
Schema
addedintegerrequired
Persons the query returned.
cohortobjectrequired
Show child parameters
created_atstringrequired
created_bystring
descriptionstringrequired
filtersobjectrequired
Dynamic: the lc-cohort definition tree. Static: {}.
idstringrequired
kindstringrequired
static | dynamic.
last_computed_atstring
last_errorstring
member_countinteger
namestringrequired
realtimebooleanrequired
Dynamic cohorts: members are also added from the event stream as they qualify (G181).
statusstringrequired
pending | calculating | ready | error.
updated_atstringrequired
versionintegerrequired
Bumped on every definition change.
400
403
404
422
503
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/snapshotScope cohort:write

Parameters

project_idstringpathrequired

Request body

application/json
descriptionstring
filtersobjectrequired
A cohort definition (as for dynamic cohorts), evaluated once now.
namestringrequired
{
  "description": "string",
  "filters": {},
  "name": "string"
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/cohorts/snapshot" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","filters":{},"name":"string"}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201 A static cohort of who matches now; the definition is kept, read-only

Same as 201 · POST /v1/projects/{project_id}/cohorts

400
404
503
GEThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}Scope cohort:read

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

404
DELETEhttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}Scope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X DELETE "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

204
403
404
409 Another cohort or a flag references it
PATCHhttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}Scope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
descriptionstring
filtersobject
Dynamic cohorts only; queues a recalculation. Static snapshots keep their definition read-only.
namestring
realtimeboolean
See CreateCohort.realtime; checked against the new filters when both are sent.
{
  "description": "string",
  "filters": {},
  "name": "string",
  "realtime": true
}

Code samples

cURL
curl -X PATCH "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}" \
  -H "Content-Type: application/json" \
  -d '{"description":"string","filters":{},"name":"string","realtime":true}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

400
403
404
409 New filters while an enabled flag targets the cohort
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/duplicateScope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}/duplicate"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

201 A static snapshot of the current members

Same as 201 · POST /v1/projects/{project_id}/cohorts

403
404
503
GEThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/membersScope cohort:read

Parameters

project_idstringpathrequired
idstringpathrequired
limitintegerquery
cursorstringquery

Code samples

cURL
curl -X GET "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}/members"
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Alias of /persons (the name the AI service and MCP use)
404
503

Updated