Retrieve an api log
curl --request GET \
--url https://api.getlago.com/api/v1/api_logs/{request_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/api_logs/{request_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v1/api_logs/{request_id}', 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.getlago.com/api/v1/api_logs/{request_id}",
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.getlago.com/api/v1/api_logs/{request_id}"
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.getlago.com/api/v1/api_logs/{request_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/api_logs/{request_id}")
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{
"api_log": {
"api_version": "v1",
"client": "Lago Ruby v1.26.0",
"http_method": "post",
"http_status": 200,
"logged_at": "2025-03-31T12:31:44Z",
"request_body": "{ \"billable_metric\": { \"name\": \"Storage\", \"code\": \"storage\" } }",
"request_origin": "https://app.lago.dev/",
"request_path": "/billable_metrics",
"created_at": "2022-04-29T08:59:51Z",
"request_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"request_response": "{ \"lago_id\": \"b9155544-e261-4e92-b54e-f65d7609294c\", ... }"
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Audit logs
Retrieve an API log
This endpoint retrieves an existing api log that represents a request made to the API. The api log is identified by its unique request_id.
GET
/
api_logs
/
{request_id}
Retrieve an api log
curl --request GET \
--url https://api.getlago.com/api/v1/api_logs/{request_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/api_logs/{request_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v1/api_logs/{request_id}', 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.getlago.com/api/v1/api_logs/{request_id}",
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.getlago.com/api/v1/api_logs/{request_id}"
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.getlago.com/api/v1/api_logs/{request_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/api_logs/{request_id}")
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{
"api_log": {
"api_version": "v1",
"client": "Lago Ruby v1.26.0",
"http_method": "post",
"http_status": 200,
"logged_at": "2025-03-31T12:31:44Z",
"request_body": "{ \"billable_metric\": { \"name\": \"Storage\", \"code\": \"storage\" } }",
"request_origin": "https://app.lago.dev/",
"request_path": "/billable_metrics",
"created_at": "2022-04-29T08:59:51Z",
"request_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"request_response": "{ \"lago_id\": \"b9155544-e261-4e92-b54e-f65d7609294c\", ... }"
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The Request Id of the existing api log.
Example:
"bdc0eda6-ea52-4f72-a46a-94f47a89b546"
Response
Api Log
Show child attributes
Show child attributes
⌘I