Get workspace analytics
curl --request GET \
--url https://api.example.com/v1/analytics/{metric} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.example.com/v1/analytics/{metric}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.example.com/v1/analytics/{metric}', 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.example.com/v1/analytics/{metric}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/analytics/{metric}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/analytics/{metric}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/analytics/{metric}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"type": "simple",
"value": {
"value": "<string>",
"suffix": "<string>",
"prefix": "<string>",
"cost_details": {
"value": 123,
"estimated_additional_cost": 123,
"estimated_in_progress_cost": 123,
"estimated_interrupted_cost": 123,
"estimated_other_cost": 123,
"message": "<string>"
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Analytics
Get workspace analytics
Query analytics metrics for the workspace associated with the API key. Results are scoped to the workspace and time range provided.
GET
/
v1
/
analytics
/
{metric}
Get workspace analytics
curl --request GET \
--url https://api.example.com/v1/analytics/{metric} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.example.com/v1/analytics/{metric}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.example.com/v1/analytics/{metric}', 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.example.com/v1/analytics/{metric}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/analytics/{metric}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/v1/analytics/{metric}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/analytics/{metric}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"type": "simple",
"value": {
"value": "<string>",
"suffix": "<string>",
"prefix": "<string>",
"cost_details": {
"value": 123,
"estimated_additional_cost": 123,
"estimated_in_progress_cost": 123,
"estimated_interrupted_cost": 123,
"estimated_other_cost": 123,
"message": "<string>"
}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Path Parameters
Analytics metrics available via the public API.
Excludes billing-constraint overage keys, cross-workspace/tenant aggregates, infrastructure/worker metrics, and internal labelling-system keys.
Available options:
flow_runs, trigger_runs, manual_runs, agent_runs, active_users, active_runs, active_triggers, errors, average_run_time, flow_runs_distribution, flow_per_user, errors_over_time, run_time_over_time, ai_models_total_cost, ai_models_total_tokens, average_cost_per_run, tokens_cost, tokens_cost_by_workflow, tokens_cost_by_user, tokens_cost_by_node, model_tokens_total_cost, ai_operations_per_tool, model_tokens_per_tool, ai_operations_per_user, model_tokens_per_user, conversations_started, messages_sent, messages_per_conversation, conversation_users, conversations_started_over_time, messages_sent_over_time, conversations_started_by_user, messages_sent_by_user, conversation_tokens_cost, conversation_tokens_cost_by_user, conversation_chat_costs_total, api_calls_per_date, api_calls_per_endpoint, api_calls_log, kb_total_documents, kb_processed_successfully, kb_contributors, kb_failed_documents, kb_documents_over_time, kb_documents_per_kb, kb_documents_by_user, kb_document_types, kb_user_activity, kb_overview Query Parameters
Start of the time range (ISO 8601 with timezone)
End of the time range (ISO 8601 with timezone)
Page number for paginated metrics
Page size for paginated metrics (default 50, max 200)
Required range:
1 <= x <= 200