# Download Audit Logs

{% hint style="warning" %}
**Deprecation notice:** The `/audit` endpoint has been deprecated and replaced by [Immuta Detect](/2024.3/detect-your-activity/getting-started.md).
{% endhint %}

## Download audit logs using the API

1. Generate your API key on the **API Keys** tab on your profile page and save the API key somewhere secure.
2. You will pass this API key in the authorization header when you make a request, as illustrated in the example below:

   ```shell
   curl \
       --request GET \
       --header "Content-Type: application/json" \
       --header "Authorization: dea464c07bd07300095caa8" \
       https://your-immuta-url.immuta.com/audit
   ```
3. Download your audit logs using the GET `/audit` endpoint. To filter or sort the audit logs, use the query parameters on the [`/audit` endpoint API reference page](/2024.3/developer-guides/api-intro/immuta-v1-api/manage-data-access/audit.md). For example, the request below saves 50 audit logs for `https://your-immuta-url.immuta.com` in the file `audit-logs-file.json`, with the audit records sorted by time in descending order.

   ```shell
   curl \
       --request GET \
       --header "Content-Type: application/json" \
       --header "Authorization: dea464c07bd07300095caa8" \
       --output audit-logs-file.json \
       https://your-immuta-url.immuta.com/audit?sortField=dateTime&sortOrder=desc
   ```


---

# 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://documentation.immuta.com/2024.3/detect-your-activity/audit/deprecated-audit-guides/view-audit-logs.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.
