> This page is for Multi-Tenant, version v3.0 (default).
> For other versions, use one of these documentation indexes:
> - v3.0 (default): https://docs.nvidia.com/run-ai/multi-tenant/v3.0/llms.txt
> - v2.26: https://docs.nvidia.com/run-ai/multi-tenant/v2.26/llms.txt
> - v2.25: https://docs.nvidia.com/run-ai/multi-tenant/v2.25/llms.txt
> - v2.24: https://docs.nvidia.com/run-ai/multi-tenant/v2.24/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/run-ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/run-ai/_mcp/server.

# Get audit logs

GET http://localhost:8080/api/v1/audit/log

Get audit logs based on query params filter

Reference: https://docs.nvidia.com/run-ai/multi-tenant/reference/rest-api/endpoints/audit/audit-logs/get-audit-logs

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication

## Request

### Query parameters

- `start` (datetime, required) — Start date of time range to fetch data in ISO 8601 timestamp format.
- `end` (datetime, required) — End date of time range to fetch data in ISO 8601 timestamp format.
- `offset` (integer, optional) — The offset of the first item returned in the collection.
- `numberOfSamples` (integer, optional, default: 20) — The number of samples to take in the specified time range.
- `sortOrder` (enum, optional, default: asc) — Sort results in descending or ascending order.
  - Allowed values: `asc`, `desc`
- `sortBy` (enum, optional) — Sort results by a parameters.
  - Allowed values: `timestamp`, `subject`, `subject_type`, `source_ip`, `action`, `http_method`, `result`, `url`, `entity_type`, `entity_name`, `entity_id`
- `filterBy` (list of string, optional) — Filter results by a parameter. Use the format field-name operator value. Operators are == Equals, != Not equals, \<= Less than or equal, >= Greater than or equal, =@ contains, !@ Does not contains, =^ Starts with and =\$ Ends with. Dates are in ISO 8601 timestamp format and available for operators ==, !=, \<= and >=.

## Response

### 200

Executed successfully

- `total` (integer, optional)
- `next` (integer, optional)
- `audit_logs` (list of AuditLog, optional)

## Errors

### 401 Unauthorized Error

Unauthorized

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 403 Forbidden Error

Forbidden

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 500 Internal Server Error

unexpected error

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

### 503 Service Unavailable Error

unexpected error

- `code` (integer, required)
- `message` (string, required)
- `details` (string, optional)

## Types

### AuditLog

- `tenant_id` (string, required) — the ID of the tenant
- `subject` (string, required) — the user/app which triggered this API
- `subject_type` (enum, required, default: User)
  - Allowed values: `User`, `App`
- `action` (enum, required)
  - Allowed values: `create`, `update`, `delete`, `sign-in`, `sign-out`, `reset-password`
- `result` (enum, required)
  - Allowed values: `Succeeded`, `Failed`
- `id` (string, optional)
- `timestamp` (datetime, optional)
- `source_ip` (string, optional)
- `http_method` (enum, optional)
  - Allowed values: `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `CREATE`
- `url` (string, optional)
- `entity_type` (string, optional)
- `entity_name` (string, optional)
- `entity_id` (string, optional)
- `http_status_code` (integer, optional)
- `cluster_name` (string, optional)
- `cluster_id` (string, optional)
- `request_id` (string, optional)
- `metadata` (map from string to string, optional)

## Examples

**Response**

```json
{
  "total": 2000,
  "next": 100,
  "audit_logs": [
    {
      "tenant_id": "12345",
      "subject": "researcher@run.ai",
      "subject_type": "User",
      "action": "create",
      "result": "Succeeded",
      "id": "string",
      "timestamp": "2022-01-01T03:49:52.531Z",
      "source_ip": "string",
      "http_method": "GET",
      "url": "string",
      "entity_type": "project",
      "entity_name": "project-1",
      "entity_id": "1234",
      "http_status_code": 200,
      "cluster_name": "my favorite cluster",
      "cluster_id": "string",
      "request_id": "bb0c4742-e52f-4d5e-bfee-2c4ff57c339c",
      "metadata": {}
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "http://localhost:8080/api/v1/audit/log"

querystring = {"end":"2023-06-07T12:09:18.211Z","start":"2023-06-06T12:09:18.211Z"}

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript
const url = 'http://localhost:8080/api/v1/audit/log?end=2023-06-07T12%3A09%3A18.211Z&start=2023-06-06T12%3A09%3A18.211Z';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:8080/api/v1/audit/log?end=2023-06-07T12%3A09%3A18.211Z&start=2023-06-06T12%3A09%3A18.211Z"

	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(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("http://localhost:8080/api/v1/audit/log?end=2023-06-07T12%3A09%3A18.211Z&start=2023-06-06T12%3A09%3A18.211Z")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:8080/api/v1/audit/log?end=2023-06-07T12%3A09%3A18.211Z&start=2023-06-06T12%3A09%3A18.211Z")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:8080/api/v1/audit/log?end=2023-06-07T12%3A09%3A18.211Z&start=2023-06-06T12%3A09%3A18.211Z', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("http://localhost:8080/api/v1/audit/log?end=2023-06-07T12%3A09%3A18.211Z&start=2023-06-06T12%3A09%3A18.211Z");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:8080/api/v1/audit/log?end=2023-06-07T12%3A09%3A18.211Z&start=2023-06-06T12%3A09%3A18.211Z")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```