# Download Audit Logs

{% hint style="warning" %}
**Deprecation notice:** The `/audit` endpoint has been deprecated and replaced by [Immuta Detect](https://documentation.immuta.com/2024.3/detect-your-activity/getting-started).
{% 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](https://documentation.immuta.com/2024.3/developer-guides/api-intro/immuta-v1-api/manage-data-access/audit). 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
   ```
