Skip to main content
POST
/
metrics
/
refresh
Refresh Metrics
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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

db_id
string | null

Database ID to use for metrics calculation

table
string | null

Table to use for metrics calculation

Response

Metrics refreshed successfully

id
string
required

Unique identifier for the metrics record

agent_runs_count
integer
required

Total number of agent runs

Required range: x >= 0
agent_sessions_count
integer
required

Total number of agent sessions

Required range: x >= 0
team_runs_count
integer
required

Total number of team runs

Required range: x >= 0
team_sessions_count
integer
required

Total number of team sessions

Required range: x >= 0
workflow_runs_count
integer
required

Total number of workflow runs

Required range: x >= 0
workflow_sessions_count
integer
required

Total number of workflow sessions

Required range: x >= 0
users_count
integer
required

Total number of unique users

Required range: x >= 0
token_metrics
Token Metrics · object
required

Token usage metrics (input, output, cached, etc.)

model_metrics
Model Metrics · object[]
required

Metrics grouped by model (model_id, provider, count)

date
string<date-time>
required

Date for which these metrics are aggregated

created_at
string<date-time>
required

Timestamp when metrics were created

updated_at
string<date-time>
required

Timestamp when metrics were last updated