# Audit Logs API

## Overview

{% hint style="info" %}

* This feature is available with the [**Paradime Security pack**](https://www.paradime.io/security).
* Your API keys ***must*** have the [Audit Logs viewer capability](/app-help/developers/generate-api-keys.md).
  {% endhint %}

The Audit Log API enables you to access and retrieve audit logs associated with your Paradime account.

## Fetch Audit Logs

This endpoint enables fetching Audit logs metadata for all event types and workspaces in your account.

**Example Request**

{% tabs %}
{% tab title="GraphQL" %}

```python
import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
query GetAuditLogs {
    getAuditLogs {
        auditLogs {
            id
            createdDttm
            updatedDttm
            workspaceId
            workspaceName
            actorType
            actorUserId
            actorEmail
            eventSourceId
            eventSource
            eventId
            eventType
            metadataJson
        }
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
```

{% endtab %}

{% tab title="cURL" %}

```bash
curl --location --request POST '<YOUR_API_ENDPOINT>' \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <YOUR_API_KEY>' \
--header 'X-API-SECRET: <YOUR_API_SECRET>' \
--data-raw '{
  "query": "query GetAuditLogs { getAuditLogs { auditLogs { id createdDttm updatedDttm workspaceId workspaceName actorType actorUserId actorEmail eventSourceId eventSource eventId eventType metadataJson } } }"
}'
```

{% endtab %}
{% endtabs %}

<details>

<summary>Example Response</summary>

```json
{
  "auditLogs": [
    {
      "id": 1,
      "createdDttm": "2024-02-13 16:09:29.718805",
      "updatedDttm": "2024-02-13 16:09:29.718809",
      "workspaceId": 2,
      "workspaceName": "data_platform",
      "actorType": "user",
      "actorUserId": 4,
      "actorEmail": "john@acme.io",
      "eventSourceId": 0,
      "eventSource": "bolt",
      "eventId": 12,
      "eventType": "schedule_manual_run",
      "metadataJson": {
        "schedule_name_uuid": "e3a1e416-f778-3fa5-aac9-10288466cfb5",
        "schedule": {
          "name": "daily run"
        }
      }
    },
    ...
    }
  ]
}
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.paradime.io/app-help/developers/graphql-api/examples/audit-logs-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
