Run a cohort analysis report
curl --request POST \
--url https://{domain}/api/v2/reports/cohort \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"cohort_group": "registration",
"cohort_size": "week",
"date_from": "2023-12-25",
"date_to": "2023-12-25",
"metric": "<string>",
"columns": "age",
"values": "cumulative",
"filters": {
"affiliates": {
"in": [
42
]
}
},
"currency": "<string>",
"sort_by": "<string>"
}
'import requests
url = "https://{domain}/api/v2/reports/cohort"
payload = {
"cohort_group": "registration",
"cohort_size": "week",
"date_from": "2023-12-25",
"date_to": "2023-12-25",
"metric": "<string>",
"columns": "age",
"values": "cumulative",
"filters": { "affiliates": { "in": [42] } },
"currency": "<string>",
"sort_by": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cohort_group: 'registration',
cohort_size: 'week',
date_from: '2023-12-25',
date_to: '2023-12-25',
metric: '<string>',
columns: 'age',
values: 'cumulative',
filters: {affiliates: {in: [42]}},
currency: '<string>',
sort_by: '<string>'
})
};
fetch('https://{domain}/api/v2/reports/cohort', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{domain}/api/v2/reports/cohort",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cohort_group' => 'registration',
'cohort_size' => 'week',
'date_from' => '2023-12-25',
'date_to' => '2023-12-25',
'metric' => '<string>',
'columns' => 'age',
'values' => 'cumulative',
'filters' => [
'affiliates' => [
'in' => [
42
]
]
],
'currency' => '<string>',
'sort_by' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{domain}/api/v2/reports/cohort"
payload := strings.NewReader("{\n \"cohort_group\": \"registration\",\n \"cohort_size\": \"week\",\n \"date_from\": \"2023-12-25\",\n \"date_to\": \"2023-12-25\",\n \"metric\": \"<string>\",\n \"columns\": \"age\",\n \"values\": \"cumulative\",\n \"filters\": {\n \"affiliates\": {\n \"in\": [\n 42\n ]\n }\n },\n \"currency\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{domain}/api/v2/reports/cohort")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cohort_group\": \"registration\",\n \"cohort_size\": \"week\",\n \"date_from\": \"2023-12-25\",\n \"date_to\": \"2023-12-25\",\n \"metric\": \"<string>\",\n \"columns\": \"age\",\n \"values\": \"cumulative\",\n \"filters\": {\n \"affiliates\": {\n \"in\": [\n 42\n ]\n }\n },\n \"currency\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/reports/cohort")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cohort_group\": \"registration\",\n \"cohort_size\": \"week\",\n \"date_from\": \"2023-12-25\",\n \"date_to\": \"2023-12-25\",\n \"metric\": \"<string>\",\n \"columns\": \"age\",\n \"values\": \"cumulative\",\n \"filters\": {\n \"affiliates\": {\n \"in\": [\n 42\n ]\n }\n },\n \"currency\": \"<string>\",\n \"sort_by\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 200,
"name": "<string>",
"message": "<string>",
"info": {
"columns": [
1
],
"cohorts": [
{
"players": 1,
"cells": [
{
"value": 123,
"players": 1,
"is_maturing": true,
"maturing_until": "2023-12-25",
"is_small": true
}
],
"key": "2023-12-25",
"name": "<string>"
}
],
"total": {
"players": 1,
"cells": [
{
"value": 123,
"players": 1,
"is_maturing": true,
"maturing_until": "2023-12-25",
"is_small": true
}
]
},
"cohorts_by": "registration",
"values": "cumulative",
"show": "value",
"cohort_size": "week",
"cohort_group": "registration",
"timezone": "<string>",
"metric": "<string>",
"currency": "<string>",
"date_from": "2023-12-25",
"date_to": "2023-12-25"
}
}{
"status": "error",
"code": 401,
"name": "Unauthorized",
"message": "API key is invalid or missing."
}{
"status": "error",
"code": 403,
"name": "Forbidden",
"message": "This endpoint is not available for your role."
}{
"status": "error",
"code": 123,
"name": "<string>",
"message": "<string>",
"info": {
"errors": {}
}
}Reports
Run a cohort analysis report
Returns cohort player counts, metric cells and mature totals for Operator and Broker workspaces. Requires manager report access and applies the viewer’s affiliate and product visibility.
POST
/
api
/
v2
/
reports
/
cohort
Run a cohort analysis report
curl --request POST \
--url https://{domain}/api/v2/reports/cohort \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"cohort_group": "registration",
"cohort_size": "week",
"date_from": "2023-12-25",
"date_to": "2023-12-25",
"metric": "<string>",
"columns": "age",
"values": "cumulative",
"filters": {
"affiliates": {
"in": [
42
]
}
},
"currency": "<string>",
"sort_by": "<string>"
}
'import requests
url = "https://{domain}/api/v2/reports/cohort"
payload = {
"cohort_group": "registration",
"cohort_size": "week",
"date_from": "2023-12-25",
"date_to": "2023-12-25",
"metric": "<string>",
"columns": "age",
"values": "cumulative",
"filters": { "affiliates": { "in": [42] } },
"currency": "<string>",
"sort_by": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
cohort_group: 'registration',
cohort_size: 'week',
date_from: '2023-12-25',
date_to: '2023-12-25',
metric: '<string>',
columns: 'age',
values: 'cumulative',
filters: {affiliates: {in: [42]}},
currency: '<string>',
sort_by: '<string>'
})
};
fetch('https://{domain}/api/v2/reports/cohort', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{domain}/api/v2/reports/cohort",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'cohort_group' => 'registration',
'cohort_size' => 'week',
'date_from' => '2023-12-25',
'date_to' => '2023-12-25',
'metric' => '<string>',
'columns' => 'age',
'values' => 'cumulative',
'filters' => [
'affiliates' => [
'in' => [
42
]
]
],
'currency' => '<string>',
'sort_by' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{domain}/api/v2/reports/cohort"
payload := strings.NewReader("{\n \"cohort_group\": \"registration\",\n \"cohort_size\": \"week\",\n \"date_from\": \"2023-12-25\",\n \"date_to\": \"2023-12-25\",\n \"metric\": \"<string>\",\n \"columns\": \"age\",\n \"values\": \"cumulative\",\n \"filters\": {\n \"affiliates\": {\n \"in\": [\n 42\n ]\n }\n },\n \"currency\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{domain}/api/v2/reports/cohort")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"cohort_group\": \"registration\",\n \"cohort_size\": \"week\",\n \"date_from\": \"2023-12-25\",\n \"date_to\": \"2023-12-25\",\n \"metric\": \"<string>\",\n \"columns\": \"age\",\n \"values\": \"cumulative\",\n \"filters\": {\n \"affiliates\": {\n \"in\": [\n 42\n ]\n }\n },\n \"currency\": \"<string>\",\n \"sort_by\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{domain}/api/v2/reports/cohort")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"cohort_group\": \"registration\",\n \"cohort_size\": \"week\",\n \"date_from\": \"2023-12-25\",\n \"date_to\": \"2023-12-25\",\n \"metric\": \"<string>\",\n \"columns\": \"age\",\n \"values\": \"cumulative\",\n \"filters\": {\n \"affiliates\": {\n \"in\": [\n 42\n ]\n }\n },\n \"currency\": \"<string>\",\n \"sort_by\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 200,
"name": "<string>",
"message": "<string>",
"info": {
"columns": [
1
],
"cohorts": [
{
"players": 1,
"cells": [
{
"value": 123,
"players": 1,
"is_maturing": true,
"maturing_until": "2023-12-25",
"is_small": true
}
],
"key": "2023-12-25",
"name": "<string>"
}
],
"total": {
"players": 1,
"cells": [
{
"value": 123,
"players": 1,
"is_maturing": true,
"maturing_until": "2023-12-25",
"is_small": true
}
]
},
"cohorts_by": "registration",
"values": "cumulative",
"show": "value",
"cohort_size": "week",
"cohort_group": "registration",
"timezone": "<string>",
"metric": "<string>",
"currency": "<string>",
"date_from": "2023-12-25",
"date_to": "2023-12-25"
}
}{
"status": "error",
"code": 401,
"name": "Unauthorized",
"message": "API key is invalid or missing."
}{
"status": "error",
"code": 403,
"name": "Forbidden",
"message": "This endpoint is not available for your role."
}{
"status": "error",
"code": 123,
"name": "<string>",
"message": "<string>",
"info": {
"errors": {}
}
}Authorizations
Body
application/json
Dates use the workspace timezone. Supply both dates or omit both for the default range.
A player-based Operator or Broker metric visible to the caller, or a custom metric whose operands are eligible for the selected cohort. Examples include dep_amount, dep_total and fdep_rate. Clicks, impressions, CPC, flat fees and affiliate balance metrics return HTTP 422. reg_qty, ver_qty, reg_to_ver, reg_to_ftd and reg_to_qftd require a registration anchor. Defaults to dep_amount when available, otherwise ftd_qty.
Was this page helpful?