List spend logs
Lists the requests the instance served with its keys, newest first, one page at a time. The window defaults to the last 24 hours and spans at most 31 days. A row appears a few seconds after its request. The instance must be ready; otherwise the request answers 409.
GET
/
agent_gateways
/
{instance_id}
/
spend_logs
List spend logs
curl --request GET \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs', 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.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs",
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.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs"
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.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs")
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{
"data": [
{
"id": "chatcmpl-1c0032cc-3d9f-439f-af62-b7f2b6623da4",
"key_id": "5f1c3a0e9b7d4c2a8e6f0b1d3c5a7e9f2b4d6c8a0e1f3a5c7e9b1d3f5a7c9e0b",
"team_id": "0b6c5d4e-3f2a-4b1c-9d8e-7f6a5b4c3d2e",
"model": "zai-org/GLM-5.3-Flash",
"operation": "acompletion",
"status": "success",
"spend": 0.00027747,
"prompt_tokens": 22,
"completion_tokens": 610,
"total_tokens": 632,
"started_at": "2026-10-21T19:41:02.114000Z",
"ended_at": "2026-10-21T19:41:04.879000Z",
"duration_ms": 2765
}
],
"meta": {
"total_results": 1,
"page_number": 1,
"page_size": 50,
"total_pages": 1,
"total_results_capped": false
}
}{
"errors": [
{
"code": "10033",
"title": "Value outside of range",
"detail": "The value is outside of allowed range the start to 31 days after it",
"source": {
"parameter": "end"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10033"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}{
"errors": [
{
"code": "99901",
"title": "Instance not ready",
"detail": "The instance is not ready; its engine is not running."
}
]
}{
"errors": [
{
"code": "99903",
"title": "Engine unavailable",
"detail": "The instance's engine did not answer; try again shortly."
}
]
}Authorizations
Telnyx API key
Path Parameters
The Agent Gateway's id.
Query Parameters
The page to return, counting from 1.
Required range:
x >= 1Results per page.
Required range:
1 <= x <= 100The window's start, an RFC 3339 timestamp with an offset. Defaults to 24 hours before end.
The window's end, an RFC 3339 timestamp with an offset. Defaults to now.
Only the requests made with this key.
Pattern:
^[0-9a-f]{64}$Only the requests made with this team's keys.
Was this page helpful?
List spend logs
curl --request GET \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs', 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.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs",
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.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs"
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.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/agent_gateways/{instance_id}/spend_logs")
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{
"data": [
{
"id": "chatcmpl-1c0032cc-3d9f-439f-af62-b7f2b6623da4",
"key_id": "5f1c3a0e9b7d4c2a8e6f0b1d3c5a7e9f2b4d6c8a0e1f3a5c7e9b1d3f5a7c9e0b",
"team_id": "0b6c5d4e-3f2a-4b1c-9d8e-7f6a5b4c3d2e",
"model": "zai-org/GLM-5.3-Flash",
"operation": "acompletion",
"status": "success",
"spend": 0.00027747,
"prompt_tokens": 22,
"completion_tokens": 610,
"total_tokens": 632,
"started_at": "2026-10-21T19:41:02.114000Z",
"ended_at": "2026-10-21T19:41:04.879000Z",
"duration_ms": 2765
}
],
"meta": {
"total_results": 1,
"page_number": 1,
"page_size": 50,
"total_pages": 1,
"total_results_capped": false
}
}{
"errors": [
{
"code": "10033",
"title": "Value outside of range",
"detail": "The value is outside of allowed range the start to 31 days after it",
"source": {
"parameter": "end"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10033"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}{
"errors": [
{
"code": "99901",
"title": "Instance not ready",
"detail": "The instance is not ready; its engine is not running."
}
]
}{
"errors": [
{
"code": "99903",
"title": "Engine unavailable",
"detail": "The instance's engine did not answer; try again shortly."
}
]
}