> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Audit Log API

The Audit Log API provides programmatic access to audit logs for your Package Security Manager (Cloud) organization. Use it to query, filter, and export audit log events for security monitoring, compliance reporting, and operational analysis.

Anaconda maintains a Jupyter Notebook that contains helper functions for interacting with the Audit Log API:

[Open in Anaconda Notebooks](https://anaconda.com/app/share/notebooks/95d24368-8a40-4ee4-b0a4-2b8e84c2fa40/overview)

## Authentication

### Obtaining a token

Exchange your [service account](https://anaconda.com/docs/anaconda-platform/admin/service-accounts.md) credentials for an access token:

```sh Terminal theme={null}
curl --request POST \
    --url "https://anaconda.com/api/iam/token" \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --data "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>"
```

```powershell PowerShell theme={null}
Invoke-WebRequest -Method POST `
    -Uri "https://anaconda.com/api/iam/token" `
    -ContentType "application/x-www-form-urlencoded" `
    -Body "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>"
```

Comments

Replace \<CLIENT\_ID> and \<CLIENT\_SECRET> with your service account credentials.

The response includes an `access_token`:

```json theme={null}
{
  "access_token": "<ACCESS_TOKEN>",
  "token_type": "Bearer",
  "expires_in": 900,
  "refresh_token": "HttpOnly"
}
```

> [!NOTE]
>
> Tokens expire after 15 minutes (900 seconds). For longer-running export jobs, request a new token when the current one expires.

### Making authenticated requests

Include the token in the `Authorization` header, along with `X-Org-Name` and `X-API-Version` headers:

```sh Terminal theme={null}
curl --request GET \
    --url "https://anaconda.com/api/audit-logs" \
    --header "Authorization: Bearer <ACCESS_TOKEN>" \
    --header "X-Org-Name: <ORG_ID>" \
    --header "X-API-Version: v1"
```

```powershell PowerShell theme={null}
Invoke-WebRequest -Method GET `
    -Uri "https://anaconda.com/api/audit-logs" `
    -Headers @{
        "Authorization" = "Bearer <ACCESS_TOKEN>"
        "X-Org-Name"    = "<ORG_ID>"
        "X-API-Version" = "v1"
    }
```

Comments

Replace \<ACCESS\_TOKEN> with the token from the previous step.\
&#x20;Replace \<ORG\_ID> with your organization ID, found in your organization's URL: `anaconda.com/app/organizations/<ORG_ID>/`.

## Base URL

```
https://anaconda.com
```

## Endpoints

Method

Path

Description

`GET`

`/api/audit-logs`

Retrieve audit logs with search, sorting, and filtering

`GET`

`/api/audit-logs/{audit_log_id}`

Retrieve a single audit log entry by ID

`POST`

`/api/audit-logs/export`

Create an export job for audit log data

`GET`

`/api/audit-logs/export/{job_id}`

Check the status of an export job

`GET`

`/api/audit-logs/export/{job_id}/download`

Download completed export data
