Skip to content
IForevents Docs
IForevents Docs
HomeDashboardGitHubPrivacyTermsSecurityIntroduction
Support and SLA

Save a cohort (any role but viewer)

POST
/v1/cohorts

Authorization

bearerAuth
AuthorizationBearer <token>

Session token issued by the accounts service (or the legacy /v1/auth routes).

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/cohorts" \  -H "Content-Type: application/json" \  -d '{    "definition": {      "match": "all",      "rules": [        {          "count": {            "operator": "gte",            "value": 2          },          "event": "purchase",          "type": "event",          "window": {            "last_days": 30          }        },        {          "filters": [            {              "operator": "ends_with",              "property": "$email",              "scope": "user",              "values": [                "@example.com"              ]            }          ],          "negate": true,          "type": "property"        }      ],      "schema": "cohort/1"    },    "description": "",    "name": "Engaged buyers"  }'
{  "cohort": {    "created_at": "2026-09-13T12:30:45Z",    "created_by": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",    "definition": {      "match": "all",      "rules": [        {          "count": {            "operator": "gte",            "value": 2          },          "event": "purchase",          "type": "event",          "window": {            "last_days": 30          }        },        {          "filters": [            {              "operator": "ends_with",              "property": "$email",              "scope": "user",              "values": [                "@example.com"              ]            }          ],          "negate": true,          "type": "property"        }      ],      "schema": "cohort/1"    },    "description": "",    "name": "Engaged buyers",    "project_uuid": "5f1c2e7a-1c2d-4b3e-9f10-1a2b3c4d5e6f",    "updated_at": "2026-09-13T12:30:45Z",    "uuid": "2c3d4e5f-6071-4b2c-9d3e-4f5a6b7c8d9e",    "version": 2  }}
definition*
description?string
name*string