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": "2025-08-12_daily",
"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
},
"model_metrics": [
{
"model_id": "gpt-5.5",
"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"
}
]{
"status": "started",
"message": "Metrics refresh started in background"
}{
"detail": "Bad request"
}{
"detail": "Unauthenticated access"
}{
"detail": "Not found"
}{
"detail": [
{
"loc": [
"body",
"endpoint"
],
"msg": "Value error, Endpoint must be a path, not a full URL",
"type": "value_error"
}
]
}{
"detail": "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. By default the refresh runs synchronously and returns the refreshed metrics. Pass background=true to run the refresh in the background instead: the endpoint returns 202 Accepted immediately and GET /metrics can be polled for results. If a background refresh is already in progress for the target database, returns status ‘already_running’ without starting a new one.
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": "2025-08-12_daily",
"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
},
"model_metrics": [
{
"model_id": "gpt-5.5",
"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"
}
]{
"status": "started",
"message": "Metrics refresh started in background"
}{
"detail": "Bad request"
}{
"detail": "Unauthenticated access"
}{
"detail": "Not found"
}{
"detail": [
{
"loc": [
"body",
"endpoint"
],
"msg": "Value error, Endpoint must be a path, not a full URL",
"type": "value_error"
}
]
}{
"detail": "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
Return only this user's metrics. Ignored for non-admin callers
Run the refresh in the background and return 202 immediately
Response
Metrics refreshed successfully
- DayAggregatedMetrics · object[]
- MetricsRefreshResponse · object
Aggregated metrics for a given day
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