# Export the audit log

The vault records every operation as an immutable audit event. You can query events with rich filters over the API and export them to CSV for archiving or SIEM ingestion.

See the full [Audit Logs API](/api-reference#tag/auditlogs) in the reference.

## List audit events (JSON)

```
GET /v1/audit-logs
```

This endpoint requires only the `Authorization` header (no nonce, timestamp, or assertion). The caller must have the `view_export_audit_log` capability.

**Query parameters:**

| Parameter | Type | Description |
|---|---|---|
| `format` | `json` or `csv` | Response format. Defaults to `json`. |
| `cursor` | integer | Opaque cursor for keyset pagination (use `next_cursor` from the previous response). |
| `limit` | integer (1-100) | Page size for JSON responses. |
| `start_time` | RFC 3339 datetime | Return events at or after this time. |
| `end_time` | RFC 3339 datetime | Return events before this time. |
| `topic` | `admin` or `signing` | Filter by event topic. |
| `status` | `pending`, `success`, `failure`, `cancelled`, or `rejected` | Filter by event outcome. |
| `event_types` | string | Comma-separated list of event type names (see below). |
| `key_ids` | string | Comma-separated key IDs. Returns only events involving those keys. |
| `vault_ids` | string | Comma-separated vault IDs. Returns only events involving those vaults. |
| `wallet_addresses` | string | Comma-separated wallet addresses. Returns only events involving those wallets. |
| `performed_by` | string | Comma-separated user IDs. Returns only events from those actors. |

**Example: fetch the last 10 signing failures for a specific key**

```bash
curl -s \
  "$CV_BASE/v1/audit-logs?topic=signing&status=failure&key_ids=my-key-id&limit=10" \
  -H "Authorization: ApiKey $API_KEY_UUID"
```

**Example: fetch the last 10 events for a specific wallet**

```bash
curl -s \
  "$CV_BASE/v1/audit-logs?wallet_addresses=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0&limit=10" \
  -H "Authorization: ApiKey $API_KEY_UUID"
```

**JSON response shape:**

```json
{
  "items": [
    {
      "seq": 42,
      "event_type": "sign_request",
      "topic": "signing",
      "status": "failure",
      "reason_code": "blocked_by_policy",
      "failure_detail": "Signing request denied by policy",
      "performed_by": "my-trading-bot",
      "request_id": "req-abc123",
      "metadata": { "key_id": "my-key-id" },
      "raw_request": {},
      "logged_at": "2026-06-07T10:30:00Z",
      "completed_at": "2026-06-07T10:30:00.012Z"
    }
  ],
  "total": 142,
  "next_cursor": 41
}
```

## Export to CSV

Set `format=csv` to download all matching events as a CSV file. The CSV response ignores `cursor` and `limit` and returns every event matching the other filters.

**CSV columns:** `seq`, `request_id`, `event_type`, `topic`, `status`, `reason_code`, `failure_detail`, `performed_by`, `key_id`, `vault_id`, `wallet_address`, `logged_at`, `completed_at`, `backup_encryption_keys_id`, `previous_backup_encryption_keys_id`.

Use `reason_code` for programmatic decisions. `failure_detail` is human-readable text whose wording can change.

```bash
curl -s \
  "$CV_BASE/v1/audit-logs?format=csv&start_time=2026-01-01T00:00:00Z&end_time=2026-02-01T00:00:00Z" \
  -H "Authorization: ApiKey $API_KEY_UUID" \
  -o january-audit.csv
```

## Event type reference

**User and group management:**
`create_user`, `update_user`, `delete_users`, `rotate_api_key`, `passkey_added`, `passkey_removed`, `passkey_reset`, `create_user_group`, `update_user_group`, `delete_user_groups`, `add_user_to_user_group`, `remove_user_from_user_group`, `create_security_group`, `update_security_group`, `delete_security_groups`, `add_keys_to_security_group`, `remove_keys_from_security_group`

**Key management:**
`create_key`, `import_key`, `update_key`, `delete_keys`, `add_key_version`, `freeze_key`, `unfreeze_key`, `keys_backup_created`

**Vault and wallet management:**
`create_vault`, `update_vault`, `freeze_vaults`, `unfreeze_vaults`, `generate_wallet`, `update_wallet`, `delete_wallets`, `freeze_wallets`, `unfreeze_wallets`

**Signing:**
`sign_request`, `request_denied`. A signing operation uses `status` and `reason_code` to distinguish success, failure, and policy or freeze blocks.

**Policy:**
`update_admin_policies`, `admin_policy_created`, `admin_policy_updated`, `admin_policy_deleted`, `update_signing_policy`

**Venue and auth:**
`create_venue`, `update_venue`, `delete_venues`, `failed_auth_attempt`

<span id="backup-audit-metadata-in-api-07" />

## Backup audit metadata

`keys_backup_created` records `backup_encryption_keys_id` and `exported_scopes` in JSON metadata. The scopes identify the exported vaults and, when selected, `offchain`. Assignment changes record `backup_encryption_keys_id` and `previous_backup_encryption_keys_id`; a null value represents an unconfigured assignment.

```bash
curl --fail-with-body --silent --show-error \
  "$CV_BASE/v1/audit-logs?vault_ids=treasury&event_types=keys_backup_created&limit=100" \
  -H "Authorization: ApiKey $API_KEY_UUID"
```

The `vault_ids` filter includes backup exports whose scopes contain the requested vault. A matching backup event can have an empty `vault_id` column in CSV because the event describes several scopes. Read JSON `metadata.exported_scopes` to identify those scopes and correlate CSV and JSON records by `seq`.

## Correlating events by request

The `request_id` field links the audit event back to the API call that triggered it. For async operations, the `request_id` in the audit log matches the `request_id` returned in the `202` response. Signing can complete immediately or wait for approval. Use the request ID to correlate its records, and check the final operation result rather than treating an approval as completion.

To find events for a specific request, retrieve the relevant filtered pages and match `request_id` in your application. This endpoint does not expose a `request_id` query filter.

## Forwarding to a SIEM

The CSV export is suitable for bulk ingestion into a SIEM. Schedule recurring time-window exports and deduplicate records by `seq`. For JSON pagination, pass back `next_cursor` to walk older matching records; do not use the highest observed sequence as a cursor for discovering newer events. Allow overlap between time windows to catch records whose completion status changes after they were first logged.

See [Audit retention & SIEM](/deploy/operations/audit-siem) for guidance on configuring audit log retention and shipping, and the [Audit Logs API](/api-reference#tag/auditlogs) for the full endpoint contract.
