curl --request POST \
--url https://api.example.com/metrics/refresh \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/metrics/refresh"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/metrics/refresh', 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/metrics/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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/metrics/refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/metrics/refresh")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/metrics/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "e77c9531-818b-47a5-99cd-59fed61e5403",
"agent_runs_count": 2,
"agent_sessions_count": 2,
"team_runs_count": 0,
"team_sessions_count": 0,
"workflow_runs_count": 0,
"workflow_sessions_count": 0,
"users_count": 1,
"token_metrics": {
"input_tokens": 256,
"output_tokens": 441,
"total_tokens": 697,
"audio_total_tokens": 0,
"audio_input_tokens": 0,
"audio_output_tokens": 0,
"cache_read_tokens": 0,
"cache_write_tokens": 0,
"reasoning_tokens": 0
},
"model_metrics": [
{
"model_id": "gpt-4o",
"model_provider": "OpenAI",
"count": 2
}
],
"date": "2025-08-12T00:00:00Z",
"created_at": "2025-08-12T08:01:47Z",
"updated_at": "2025-08-12T08:01:47Z"
}
]{
"detail": "Bad request",
"error_code": "BAD_REQUEST"
}{
"detail": "Unauthenticated access",
"error_code": "UNAUTHENTICATED"
}{
"detail": "Not found",
"error_code": "NOT_FOUND"
}{
"detail": "Validation error",
"error_code": "VALIDATION_ERROR"
}{
"detail": "Internal server error",
"error_code": "INTERNAL_SERVER_ERROR"
}Refresh Metrics
Manually trigger recalculation of system metrics from raw data. This operation analyzes system activity logs and regenerates aggregated metrics. Useful for ensuring metrics are up-to-date or after system maintenance.
curl --request POST \
--url https://api.example.com/metrics/refresh \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/metrics/refresh"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/metrics/refresh', 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/metrics/refresh",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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/metrics/refresh"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/metrics/refresh")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/metrics/refresh")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "e77c9531-818b-47a5-99cd-59fed61e5403",
"agent_runs_count": 2,
"agent_sessions_count": 2,
"team_runs_count": 0,
"team_sessions_count": 0,
"workflow_runs_count": 0,
"workflow_sessions_count": 0,
"users_count": 1,
"token_metrics": {
"input_tokens": 256,
"output_tokens": 441,
"total_tokens": 697,
"audio_total_tokens": 0,
"audio_input_tokens": 0,
"audio_output_tokens": 0,
"cache_read_tokens": 0,
"cache_write_tokens": 0,
"reasoning_tokens": 0
},
"model_metrics": [
{
"model_id": "gpt-4o",
"model_provider": "OpenAI",
"count": 2
}
],
"date": "2025-08-12T00:00:00Z",
"created_at": "2025-08-12T08:01:47Z",
"updated_at": "2025-08-12T08:01:47Z"
}
]{
"detail": "Bad request",
"error_code": "BAD_REQUEST"
}{
"detail": "Unauthenticated access",
"error_code": "UNAUTHENTICATED"
}{
"detail": "Not found",
"error_code": "NOT_FOUND"
}{
"detail": "Validation error",
"error_code": "VALIDATION_ERROR"
}{
"detail": "Internal server error",
"error_code": "INTERNAL_SERVER_ERROR"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Database ID to use for metrics calculation
Table to use for metrics calculation
Response
Metrics refreshed successfully
Unique identifier for the metrics record
Total number of agent runs
x >= 0Total number of agent sessions
x >= 0Total number of team runs
x >= 0Total number of team sessions
x >= 0Total number of workflow runs
x >= 0Total number of workflow sessions
x >= 0Total number of unique users
x >= 0Token usage metrics (input, output, cached, etc.)
Metrics grouped by model (model_id, provider, count)
Date for which these metrics are aggregated
Timestamp when metrics were created
Timestamp when metrics were last updated
Was this page helpful?