List gateway request logs
curl --request GET \
--url https://api.airctrl.dev/v1/gateways/{id}/logs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/logs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.airctrl.dev/v1/gateways/{id}/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{
"ok": true,
"data": {
"rows": [
{
"log_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_slug": "<string>",
"model": "<string>",
"status_code": 123,
"streamed": true,
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"cost": "<string>",
"cost_estimated": true,
"cache_hit": true,
"latency_ms": 123,
"error_code": "<string>",
"finish_reason": "<string>",
"upstream_request_id": "<string>",
"claude_session_id": "<string>",
"token_name": "<string>",
"principal_type": "user",
"service_account_name": "<string>",
"owner_email": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
],
"total": 1,
"facets": {
"providers": [
{
"slug": "<string>",
"count": 1
}
],
"statusClasses": [
{
"class": "<string>",
"count": 1
}
]
},
"can_read_spend": true,
"can_read_bodies": true
}
}{
"ok": false,
"error": {
"code": "unauthorized",
"message": "Authentication is required"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "forbidden",
"message": "not_authorized"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "rate_limited",
"message": "Too many requests"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "internal_error",
"message": "Internal server error"
},
"requestId": "req_example"
}Gateways
List gateway request logs
Returns paginated request metadata for one gateway. Request and response bodies are not included. Requires gateways:read-logs.
GET
/
gateways
/
{id}
/
logs
List gateway request logs
curl --request GET \
--url https://api.airctrl.dev/v1/gateways/{id}/logs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/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.airctrl.dev/v1/gateways/{id}/logs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.airctrl.dev/v1/gateways/{id}/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{
"ok": true,
"data": {
"rows": [
{
"log_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider_slug": "<string>",
"model": "<string>",
"status_code": 123,
"streamed": true,
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"cost": "<string>",
"cost_estimated": true,
"cache_hit": true,
"latency_ms": 123,
"error_code": "<string>",
"finish_reason": "<string>",
"upstream_request_id": "<string>",
"claude_session_id": "<string>",
"token_name": "<string>",
"principal_type": "user",
"service_account_name": "<string>",
"owner_email": "<string>",
"created_at": "2023-11-07T05:31:56Z"
}
],
"total": 1,
"facets": {
"providers": [
{
"slug": "<string>",
"count": 1
}
],
"statusClasses": [
{
"class": "<string>",
"count": 1
}
]
},
"can_read_spend": true,
"can_read_bodies": true
}
}{
"ok": false,
"error": {
"code": "unauthorized",
"message": "Authentication is required"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "forbidden",
"message": "not_authorized"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "rate_limited",
"message": "Too many requests"
},
"requestId": "req_example"
}{
"ok": false,
"error": {
"code": "internal_error",
"message": "Internal server error"
},
"requestId": "req_example"
}