Get usage and cost
curl --request GET \
--url https://api.totebot.ai/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.totebot.ai/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.totebot.ai/v1/usage', 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.totebot.ai/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.totebot.ai/v1/usage"
req, _ := http.NewRequest("GET", 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.get("https://api.totebot.ai/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.totebot.ai/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"groupBy": "agent",
"costIncluded": true,
"total": {
"credits": 123,
"inputTokens": 123,
"outputTokens": 123,
"totalTokens": 123,
"whatsappMessagesSent": 123,
"conversations": 123,
"costUsd": 123
},
"rows": [
{
"credits": 123,
"inputTokens": 123,
"outputTokens": 123,
"totalTokens": 123,
"key": "<string>",
"whatsappMessagesSent": 123,
"conversations": 123,
"costUsd": 123,
"agentId": "<string>",
"agentName": "<string>",
"date": "2026-11-24",
"model": "gpt-5-mini",
"modelName": "<string>"
}
],
"credits": {
"used": 123,
"limit": 123,
"topUpRemaining": 123,
"periodStartedAt": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}Analytics
Get usage and cost
Message credits and tokens per agent, per UTC day or per model, for the agents the key can access, plus the team’s credit balance for the current billing period (only for keys that cover all agents). costUsd (what the AI providers charged, in USD) is only included when the key has the opt-in billing:read scope. Default range: the last 30 days.
GET
/
v1
/
usage
Get usage and cost
curl --request GET \
--url https://api.totebot.ai/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.totebot.ai/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.totebot.ai/v1/usage', 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.totebot.ai/v1/usage",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
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.totebot.ai/v1/usage"
req, _ := http.NewRequest("GET", 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.get("https://api.totebot.ai/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.totebot.ai/v1/usage")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"groupBy": "agent",
"costIncluded": true,
"total": {
"credits": 123,
"inputTokens": 123,
"outputTokens": 123,
"totalTokens": 123,
"whatsappMessagesSent": 123,
"conversations": 123,
"costUsd": 123
},
"rows": [
{
"credits": 123,
"inputTokens": 123,
"outputTokens": 123,
"totalTokens": 123,
"key": "<string>",
"whatsappMessagesSent": 123,
"conversations": 123,
"costUsd": 123,
"agentId": "<string>",
"agentName": "<string>",
"date": "2026-11-24",
"model": "gpt-5-mini",
"modelName": "<string>"
}
],
"credits": {
"used": 123,
"limit": 123,
"topUpRemaining": 123,
"periodStartedAt": "2023-11-07T05:31:56Z"
}
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}{
"status": "error",
"error": {
"code": "NotFoundException",
"message": "Agent not found",
"details": {}
},
"path": "/v1/agents/clx123",
"timestamp": "2026-11-24T10:00:00.000Z"
}