Skip to main content
POST
/
v2
/
cohorts
Create cohort
curl --request POST \
  --url 'https://api.permutive.app/cohorts-api/v2/cohorts?k=' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Example Segment A",
  "description": "This segment is an example for documentation purposes",
  "query": {
    "event": "Pageview",
    "frequency": {
      "greater_than_or_equal_to": 2
    },
    "where": {
      "property": "properties.client.url",
      "condition": {
        "contains": "football"
      }
    },
    "during": {
      "the_last": {
        "value": 30,
        "unit": "days"
      }
    }
  },
  "tags": [
    "tag_a",
    "tag_b"
  ],
  "segment_type": "real_time"
}
'
{
  "id": "38470a62-9837-4c86-bbf3-45dd6d52dd83",
  "code": 12345,
  "name": "Example Segment A",
  "description": "This segment is an example for documentation purposes",
  "query": {
    "event": "Pageview",
    "frequency": {
      "greater_than_or_equal_to": 2
    },
    "where": {
      "property": "properties.client.url",
      "condition": {
        "contains": "football"
      }
    },
    "during": {
      "the_last": {
        "value": 30,
        "unit": "days"
      }
    }
  },
  "tags": [
    "tag_a",
    "tag_b"
  ],
  "state": "Enabled",
  "segment_type": "real_time",
  "created_at": "2022-09-22T15:44:29.518935935Z",
  "last_updated_at": "2022-09-22T15:44:29.518937018Z"
}

Authorizations

k
string
query
required

Body

application/json
name
string
required
query
any
required
description
string
tags
string[]
segmentType
object

Response

Cohort in full (including query)

id
string
required
code
integer
required
name
string
required
query
any
required
state
enum<string>
required
Available options:
Enabled,
Disabled
segmentType
object
required
createdAt
string<date-time>
required
lastUpdatedAt
string<date-time>
required
description
string
tags
string[]
workspaceId
string