Skip to main content
GET
/
audit-logs
Get Audit Logs
curl --request GET \
  --url https://api.portkey.ai/v1/audit-logs \
  --header 'x-portkey-api-key: <api-key>'
import requests

url = "https://api.portkey.ai/v1/audit-logs"

headers = {"x-portkey-api-key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'x-portkey-api-key': '<api-key>'}};

fetch('https://api.portkey.ai/v1/audit-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.portkey.ai/v1/audit-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 => [
"x-portkey-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.portkey.ai/v1/audit-logs"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-portkey-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.portkey.ai/v1/audit-logs")
.header("x-portkey-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.portkey.ai/v1/audit-logs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-portkey-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "records": [
    {
      "timestamp": "<string>",
      "uri": "<string>",
      "request_id": "<string>",
      "request_body": "<string>",
      "query_params": "<string>",
      "request_headers": "<string>",
      "user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "workspace_id": "<string>",
      "response_status_code": 123,
      "resource_type": "<string>",
      "action": "<string>",
      "client_ip": "<string>",
      "country": "<string>"
    }
  ],
  "total": 123,
  "object": "analytics-graph"
}

Authorizations

x-portkey-api-key
string
header
required

Query Parameters

start_time
string
required

Start time for filtering logs (ISO8601 format)

end_time
string
required

End time for filtering logs (ISO8601 format)

organisation_id
string
required

Organisation ID for filtering logs

method
enum<string>

HTTP method for filtering logs

Available options:
POST,
PUT,
DELETE
uri
string

URI path for filtering logs

request_id
string

Request ID for filtering logs

user_id
string

User ID for filtering logs

user_type
enum<string>

Type of user for filtering logs

Available options:
user,
api_key
workspace_id
string

Workspace ID for filtering logs

response_status_code
integer

HTTP response status code for filtering logs

resource_type
string

Resource type for filtering logs

action
string

Action type for filtering logs

client_ip
string

Client IP address for filtering logs

country
string

Country for filtering logs

current_page
integer

Current page number for pagination

Required range: x >= 0
page_size
integer

Number of items per page

Required range: 0 <= x <= 100

Response

200 - application/json

Successful response

records
object[]
total
integer

Total number of records in the response

object
enum<string>

The type of object being returned

Available options:
analytics-graph
Last modified on April 17, 2025