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>
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/membersScope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json

Persons to add to a static cohort, as JSON (the MCP and API route; the web uploads a CSV).

keysstring[]required
Distinct ids or emails, at most 10 000.
{
  "keys": [
    "string"
  ]
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}/members" \
  -H "Content-Type: application/json" \
  -d '{"keys":["string"]}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200
Example
{
  "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
  },
  "column": "string",
  "matched": 0,
  "submitted": 0,
  "unmatched": 0
}
Schema
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.
columnstringrequired
The column used: person_id, distinct_id, email, or first (no header: distinct id or email).
matchedintegerrequired
Of submitted, how many name an existing person (members now, or added by this call).
submittedintegerrequired
Distinct values read from the file.
unmatchedintegerrequired
submitted - matched: values that name no person and so were not added.
400
403
404
503
GEThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/members/checkScope cohort:read

Parameters

project_idstringpathrequired
idstringpathrequired
distinct_idstringqueryrequired
Exact distinct id

Code samples

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

Responses

200 Needs cohort:read. member is false for an unknown distinct id; person_id needs pii:read
Example
{
  "member": true,
  "person_id": "string"
}
Schema
memberbooleanrequired
The person behind distinct_id is a current member of the cohort.
person_idstring
Set when member is true and the caller holds pii:read; omitted otherwise.
400
404 Cohort absent or in another project
503
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/members/checkScope cohort:read

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
distinct_idsstring[]required
Exact distinct ids, 1..=1000 after trimming and de-duplication.
{
  "distinct_ids": [
    "string"
  ]
}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}/members/check" \
  -H "Content-Type: application/json" \
  -d '{"distinct_ids":["string"]}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

200 Needs cohort:read; at most 1000 ids. person_id needs pii:read
Example
{
  "members": [
    {
      "distinct_id": "string",
      "person_id": "string"
    }
  ]
}
Schema
membersMemberHit[]required
The submitted ids that belong to a current member; others (and unknown ids) are absent.
Show child parameters
distinct_idstringrequired
person_idstring
Set when the caller holds pii:read; omitted otherwise.
400
404 Cohort absent or in another project
503
GEThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/personsScope cohort:read

Parameters

project_idstringpathrequired
idstringpathrequired
limitintegerquery
cursorstringquery

Code samples

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

Responses

200 Page of {id, properties, created_at, distinct_ids}, newest first
404
503
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/personsScope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

application/json
person_idstringrequired
{
  "person_id": "string"
}

Code samples

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

Responses

200 Added (a no-op for current members)
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 Not a static cohort
404 Cohort or person absent
503
DELETEhttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/persons/{person_id}Scope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired
person_idstringpathrequired

Code samples

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

Responses

200 Removed (a no-op for non-members)

Same as 200 · POST /v1/projects/{project_id}/cohorts/{id}/persons

400
404
503
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/recalculateScope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Code samples

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

Responses

202 Queued; lc-jobs picks it up within seconds

Same as 200 · POST /v1/projects/{project_id}/cohorts/{id}/persons

403
404 Absent or not dynamic
GEThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/size-historyScope cohort:read

Parameters

project_idstringpathrequired
idstringpathrequired
daysintegerquery
Look-back, 1 to 730, default 90

Code samples

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

Responses

200
Example
{
  "cohort_id": "string",
  "points": [
    {
      "members": 0,
      "recorded_at": "2024-01-01T00:00:00Z"
    }
  ]
}
Schema
cohort_idstringrequired
pointsSizePoint[]required
Oldest first; one point per recalculation (at most 1000, the newest).
Show child parameters
membersintegerrequired
recorded_atstringrequired
400
404
POSThttps://lucidace.com/v1/projects/{project_id}/cohorts/{id}/uploadScope cohort:write

Parameters

project_idstringpathrequired
idstringpathrequired

Request body

multipart/form-data

Field file: CSV (at most 20 MB, 1M rows). A header naming person_id, distinct_id (or user_id, id) or email picks that column, in that precedence; without one the first column is matched as a distinct id or email

{}

Code samples

cURL
curl -X POST "https://lucidace.com/v1/projects/{project_id}/cohorts/{id}/upload" \
  -H "Content-Type: multipart/form-data" \
  -d '{}'
TypeScript
Python
Go
PHP
Ruby
Java

Responses

400
403
404
503

Updated