Get agent statistics
curl --request GET \
--url https://api.headlessagents.ai/agent/{agent_id}/stats \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.headlessagents.ai/agent/{agent_id}/stats"
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.headlessagents.ai/agent/{agent_id}/stats', 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.headlessagents.ai/agent/{agent_id}/stats",
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.headlessagents.ai/agent/{agent_id}/stats"
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.headlessagents.ai/agent/{agent_id}/stats")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.headlessagents.ai/agent/{agent_id}/stats")
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{
"message_distribution": {
"sample_size": 5,
"assistant_messages": 5,
"user_messages": 5
},
"response_time": {
"sample_size": 5,
"min_seconds": 3.77,
"average_seconds": 17.41,
"max_seconds": 24.99
},
"agent_id": "2ec10f28abac4e01",
"turns_per_conversation": {
"sample_size": 5,
"average": 1
},
"message_length": {
"user": {
"sample_size": 5,
"average": 11,
"min": 11,
"max": 11
},
"assistant": {
"sample_size": 5,
"average": 94.4,
"min": 92,
"max": 101
}
},
"total_conversations": 610,
"messages_per_conversation": {
"average": 2,
"max": 2,
"min": 2
},
"total_messages": 100,
"stats_generated_at": "2025-02-23T21:01:00.750638+00:00",
"usage_timeline": {
"last_7d": 50,
"first_conversation": "2025-02-23T19:48:13.405391+00:00",
"last_24h": 50,
"last_conversation": "2025-02-23T19:55:13.683286+00:00",
"last_30d": 50
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Endpoints
Agent Statistics
Retrieve usage statistics for a specific agent
GET
/
agent
/
{agent_id}
/
stats
Get agent statistics
curl --request GET \
--url https://api.headlessagents.ai/agent/{agent_id}/stats \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.headlessagents.ai/agent/{agent_id}/stats"
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.headlessagents.ai/agent/{agent_id}/stats', 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.headlessagents.ai/agent/{agent_id}/stats",
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.headlessagents.ai/agent/{agent_id}/stats"
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.headlessagents.ai/agent/{agent_id}/stats")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.headlessagents.ai/agent/{agent_id}/stats")
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{
"message_distribution": {
"sample_size": 5,
"assistant_messages": 5,
"user_messages": 5
},
"response_time": {
"sample_size": 5,
"min_seconds": 3.77,
"average_seconds": 17.41,
"max_seconds": 24.99
},
"agent_id": "2ec10f28abac4e01",
"turns_per_conversation": {
"sample_size": 5,
"average": 1
},
"message_length": {
"user": {
"sample_size": 5,
"average": 11,
"min": 11,
"max": 11
},
"assistant": {
"sample_size": 5,
"average": 94.4,
"min": 92,
"max": 101
}
},
"total_conversations": 610,
"messages_per_conversation": {
"average": 2,
"max": 2,
"min": 2
},
"total_messages": 100,
"stats_generated_at": "2025-02-23T21:01:00.750638+00:00",
"usage_timeline": {
"last_7d": 50,
"first_conversation": "2025-02-23T19:48:13.405391+00:00",
"last_24h": 50,
"last_conversation": "2025-02-23T19:55:13.683286+00:00",
"last_30d": 50
}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Retrieve usage statistics for a specific agent.
Endpoint
GET /agent/{agent_id}/stats
Parameters
string
required
ID of the agent to get statistics for
Response
object
required
object
required
string
required
ID of the agent
integer
Total number of conversations
integer
Total number of messages
string
Timestamp when these statistics were generated
{
"message_distribution": {
"sample_size": 5,
"assistant_messages": 5,
"user_messages": 5
},
"response_time": {
"sample_size": 5,
"min_seconds": 3.77,
"average_seconds": 17.41,
"max_seconds": 24.99
},
"agent_id": "2ec10f28abac4e01",
"total_conversations": 610,
"total_messages": 100,
"stats_generated_at": "2025-02-23T21:01:00.750638+00:00"
}
Authorizations
API key provided by Headless Agents
Path Parameters
ID of the agent to get statistics for
Response
Agent statistics retrieved successfully
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I