Query aggregated results
curl --request POST \
--url https://api.getcluster.ai/v1/analytics/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"timezone": "UTC",
"comparison": "none",
"interval": "day",
"group_by": [],
"scope": [
{
"value": "<string>"
}
],
"sort_by": "leads_reached",
"sort_direction": "desc",
"limit": 50
}
'import requests
url = "https://api.getcluster.ai/v1/analytics/query"
payload = {
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"timezone": "UTC",
"comparison": "none",
"interval": "day",
"group_by": [],
"scope": [{ "value": "<string>" }],
"sort_by": "leads_reached",
"sort_direction": "desc",
"limit": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_date: '2023-12-25',
end_date: '2023-12-25',
timezone: 'UTC',
comparison: 'none',
interval: 'day',
group_by: [],
scope: [{value: '<string>'}],
sort_by: 'leads_reached',
sort_direction: 'desc',
limit: 50
})
};
fetch('https://api.getcluster.ai/v1/analytics/query', 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://api.getcluster.ai/v1/analytics/query",
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([
'start_date' => '2023-12-25',
'end_date' => '2023-12-25',
'timezone' => 'UTC',
'comparison' => 'none',
'interval' => 'day',
'group_by' => [
],
'scope' => [
[
'value' => '<string>'
]
],
'sort_by' => 'leads_reached',
'sort_direction' => 'desc',
'limit' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.getcluster.ai/v1/analytics/query"
payload := strings.NewReader("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"timezone\": \"UTC\",\n \"comparison\": \"none\",\n \"interval\": \"day\",\n \"group_by\": [],\n \"scope\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"sort_by\": \"leads_reached\",\n \"sort_direction\": \"desc\",\n \"limit\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.getcluster.ai/v1/analytics/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"timezone\": \"UTC\",\n \"comparison\": \"none\",\n \"interval\": \"day\",\n \"group_by\": [],\n \"scope\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"sort_by\": \"leads_reached\",\n \"sort_direction\": \"desc\",\n \"limit\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcluster.ai/v1/analytics/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"timezone\": \"UTC\",\n \"comparison\": \"none\",\n \"interval\": \"day\",\n \"group_by\": [],\n \"scope\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"sort_by\": \"leads_reached\",\n \"sort_direction\": \"desc\",\n \"limit\": 50\n}"
response = http.request(request)
puts response.read_body{
"total": {
"dimensions": {},
"labels": {},
"values": {}
},
"series": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"groups": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"group_count": 123,
"channels": [
"<string>"
],
"generated_at": "2023-11-07T05:31:56Z",
"comparison": {
"total": {
"dimensions": {},
"labels": {},
"values": {}
},
"series": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"groups": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"group_count": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}Analytics
Query aggregated results
Reads only; nothing is changed. It is a POST because the query does not fit in a URL.
POST
/
v1
/
analytics
/
query
Query aggregated results
curl --request POST \
--url https://api.getcluster.ai/v1/analytics/query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"timezone": "UTC",
"comparison": "none",
"interval": "day",
"group_by": [],
"scope": [
{
"value": "<string>"
}
],
"sort_by": "leads_reached",
"sort_direction": "desc",
"limit": 50
}
'import requests
url = "https://api.getcluster.ai/v1/analytics/query"
payload = {
"start_date": "2023-12-25",
"end_date": "2023-12-25",
"timezone": "UTC",
"comparison": "none",
"interval": "day",
"group_by": [],
"scope": [{ "value": "<string>" }],
"sort_by": "leads_reached",
"sort_direction": "desc",
"limit": 50
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
start_date: '2023-12-25',
end_date: '2023-12-25',
timezone: 'UTC',
comparison: 'none',
interval: 'day',
group_by: [],
scope: [{value: '<string>'}],
sort_by: 'leads_reached',
sort_direction: 'desc',
limit: 50
})
};
fetch('https://api.getcluster.ai/v1/analytics/query', 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://api.getcluster.ai/v1/analytics/query",
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([
'start_date' => '2023-12-25',
'end_date' => '2023-12-25',
'timezone' => 'UTC',
'comparison' => 'none',
'interval' => 'day',
'group_by' => [
],
'scope' => [
[
'value' => '<string>'
]
],
'sort_by' => 'leads_reached',
'sort_direction' => 'desc',
'limit' => 50
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.getcluster.ai/v1/analytics/query"
payload := strings.NewReader("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"timezone\": \"UTC\",\n \"comparison\": \"none\",\n \"interval\": \"day\",\n \"group_by\": [],\n \"scope\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"sort_by\": \"leads_reached\",\n \"sort_direction\": \"desc\",\n \"limit\": 50\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.getcluster.ai/v1/analytics/query")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"timezone\": \"UTC\",\n \"comparison\": \"none\",\n \"interval\": \"day\",\n \"group_by\": [],\n \"scope\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"sort_by\": \"leads_reached\",\n \"sort_direction\": \"desc\",\n \"limit\": 50\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getcluster.ai/v1/analytics/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\",\n \"timezone\": \"UTC\",\n \"comparison\": \"none\",\n \"interval\": \"day\",\n \"group_by\": [],\n \"scope\": [\n {\n \"value\": \"<string>\"\n }\n ],\n \"sort_by\": \"leads_reached\",\n \"sort_direction\": \"desc\",\n \"limit\": 50\n}"
response = http.request(request)
puts response.read_body{
"total": {
"dimensions": {},
"labels": {},
"values": {}
},
"series": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"groups": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"group_count": 123,
"channels": [
"<string>"
],
"generated_at": "2023-11-07T05:31:56Z",
"comparison": {
"total": {
"dimensions": {},
"labels": {},
"values": {}
},
"series": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"groups": [
{
"dimensions": {},
"labels": {},
"values": {}
}
],
"group_count": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"request_id": "<string>",
"details": [
{
"message": "<string>",
"field": "<string>"
}
]
}
}Authorizations
Body
application/json
Declared field by field, so a field added to the app's own query model never becomes public by accident.
Available options:
leads_reached, replies, reply_rate, invitations_sent, invitations_accepted, acceptance_rate, messages_sent, emails_sent, calls_made, call_conversations, call_conversation_rate, positive_replies, positive_reply_rate, classified_replies, unclassified_replies, classification_coverage Response
Successful Response