Preview a cohort rule
curl --request POST \
--url https://api.kintra.io/api/v1/tenant/{tenantId}/cohorts/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": {
"operator": "and",
"predicates": [
{
"key": "<string>",
"op": "<string>",
"type": "attribute",
"value": "<string>"
}
],
"version": 1
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rules: {
operator: 'and',
predicates: [{key: '<string>', op: '<string>', type: 'attribute', value: '<string>'}],
version: 1
}
})
};
fetch('https://api.kintra.io/api/v1/tenant/{tenantId}/cohorts/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.kintra.io/api/v1/tenant/{tenantId}/cohorts/preview"
payload = { "rules": {
"operator": "and",
"predicates": [
{
"key": "<string>",
"op": "<string>",
"type": "attribute",
"value": "<string>"
}
],
"version": 1
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"count": 123,
"sample": [
{
"user": {
"auth_provider": "<string>",
"auth_provider_id": "<string>",
"email": "<string>",
"id": "<string>",
"status": "<string>",
"username": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"first_name": "<string>",
"internal_wallets": [
{
"address": "<string>",
"id": "<string>",
"user_id": "<string>",
"wallet_kind": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"label": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"last_name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"clubs": [
{
"country_id": "<string>",
"icon_url": "<string>",
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"sport_id": "<string>"
}
],
"cohort_metadata": {},
"country": {
"code": "<string>",
"icon_url": "<string>",
"id": "<string>",
"name": "<string>"
}
},
"tenant": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
}
}
]
},
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}Cohorts
Preview a cohort rule
Runs a rules document without saving it and reports what it would select, which is how you check a rule before creating or updating a cohort. The response data carries count and a sample of matching customers. A rule document the API cannot read returns 422.
POST
/
tenant
/
{tenantId}
/
cohorts
/
preview
Preview a cohort rule
curl --request POST \
--url https://api.kintra.io/api/v1/tenant/{tenantId}/cohorts/preview \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rules": {
"operator": "and",
"predicates": [
{
"key": "<string>",
"op": "<string>",
"type": "attribute",
"value": "<string>"
}
],
"version": 1
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
rules: {
operator: 'and',
predicates: [{key: '<string>', op: '<string>', type: 'attribute', value: '<string>'}],
version: 1
}
})
};
fetch('https://api.kintra.io/api/v1/tenant/{tenantId}/cohorts/preview', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.kintra.io/api/v1/tenant/{tenantId}/cohorts/preview"
payload = { "rules": {
"operator": "and",
"predicates": [
{
"key": "<string>",
"op": "<string>",
"type": "attribute",
"value": "<string>"
}
],
"version": 1
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"success": true,
"data": {
"count": 123,
"sample": [
{
"user": {
"auth_provider": "<string>",
"auth_provider_id": "<string>",
"email": "<string>",
"id": "<string>",
"status": "<string>",
"username": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"first_name": "<string>",
"internal_wallets": [
{
"address": "<string>",
"id": "<string>",
"user_id": "<string>",
"wallet_kind": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"deleted_at": "2023-11-07T05:31:56Z",
"label": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"last_name": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"clubs": [
{
"country_id": "<string>",
"icon_url": "<string>",
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"sport_id": "<string>"
}
],
"cohort_metadata": {},
"country": {
"code": "<string>",
"icon_url": "<string>",
"id": "<string>",
"name": "<string>"
}
},
"tenant": {
"id": "<string>",
"name": "<string>",
"slug": "<string>"
}
}
]
},
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}{
"success": true,
"data": null,
"errors": [
{
"message": "<string>",
"path": "<string>"
}
],
"message": "<string>"
}Authorizations
Auth0 access token
Path Parameters
Body
application/json
TSOA-friendly rule document DTO. Cast to CohortRuleDocument at service boundary.
Show child attributes
Show child attributes
⌘I

