curl --request PATCH \
--url 'https://api.permutive.app/cohorts-api/v2/cohorts/{cohortId}?k=' \
--header 'Content-Type: application/json' \
--data '
{
"name": "New Segment Name",
"description": "New Segment Description",
"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_d",
"tag_e"
]
}
'
{
"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"
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"status_code": 400,
"status": "Bad Request",
"code": 1002,
"message": "The provided request body was not structured as expected.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7235#section-3.1",
"status_code": 401,
"status": "Unauthorized",
"code": 2005,
"message": "The supplied authentication is invalid.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.3",
"status_code": 403,
"status": "Forbidden",
"code": 2001,
"message": "The API key provided does not provide access to the request operation or resource.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
"status_code": 404,
"status": "Not Found",
"code": 3000,
"message": "The requested resource does not exist.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.8",
"status_code": 409,
"status": "Conflict",
"code": 4000,
"message": "A resource with this identifier already exists.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.6.1",
"status_code": 500,
"status": "Internal Server Error",
"code": 5000,
"message": "An error of unspecified nature was encountered while processing your request. Feel free to get in touch with us at support@permutive.com referencing the Request ID.",
"docs": "https://developer.permutive.com/reference#errors"
}
}Cohorts API
Update a cohort
This endpoint allows updating an existing cohort. Depending on the access level of the provided API key, it can update cohorts owned by the requesting workspace, or also by child workspaces below the requesting workspace in the organization hierarchy. Lookalike-based cohorts cannot be updated via the Cohort API.
Any top level fields for which no value is provided in the request body will remain unchanged. Optional fields (currently only description) can be deleted by explicitly specifying null as the value.
PATCH
/
v2
/
cohorts
/
{cohortId}
curl --request PATCH \
--url 'https://api.permutive.app/cohorts-api/v2/cohorts/{cohortId}?k=' \
--header 'Content-Type: application/json' \
--data '
{
"name": "New Segment Name",
"description": "New Segment Description",
"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_d",
"tag_e"
]
}
'
{
"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"
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"status_code": 400,
"status": "Bad Request",
"code": 1002,
"message": "The provided request body was not structured as expected.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7235#section-3.1",
"status_code": 401,
"status": "Unauthorized",
"code": 2005,
"message": "The supplied authentication is invalid.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.3",
"status_code": 403,
"status": "Forbidden",
"code": 2001,
"message": "The API key provided does not provide access to the request operation or resource.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.4",
"status_code": 404,
"status": "Not Found",
"code": 3000,
"message": "The requested resource does not exist.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.8",
"status_code": 409,
"status": "Conflict",
"code": 4000,
"message": "A resource with this identifier already exists.",
"docs": "https://developer.permutive.com/reference#errors"
}
}{
"request_id": "b887517b-99a2-4ae0-bc32-93d1fb13d1b7",
"error": {
"type": "https://tools.ietf.org/html/rfc7231#section-6.6.1",
"status_code": 500,
"status": "Internal Server Error",
"code": 5000,
"message": "An error of unspecified nature was encountered while processing your request. Feel free to get in touch with us at support@permutive.com referencing the Request ID.",
"docs": "https://developer.permutive.com/reference#errors"
}
}Authorizations
Path Parameters
Cohort UUID
Body
application/json
Response
Cohort in full (including query)
Available options:
Enabled, Disabled - Option 1
- Option 2
⌘I