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

# Exporting Data

> Access audit logs, export logs, and download exported logs from the Portkey app or the API.

This page covers three tasks. Each has an app flow and an API flow.

1. [Access audit logs](#1-access-audit-logs): see who changed what in your organisation
2. [Export logs](#2-export-logs): create an export job for your request logs
3. [Download exported logs](#3-download-exported-logs): get the finished file

## 1. Access audit logs

Audit logs record administrative changes: who made a change, to which resource, and when.

### Access in the app

Go to **Admin Settings > Audit Logs**. Audit logs are collected automatically across all workspaces. See [Audit Logs](https://docs.portkey.ai/docs/product/enterprise-offering/audit-logs.md) for what each entry contains.

### Filters

Narrow the results with any of these filters:

| Filter | Description |
| - | - |
| **Time range** | Period to search |
| **Method** | HTTP method: `POST`, `PUT`, or `DELETE` |
| **Request ID** | A specific request |
| **Resource type** | Type of resource affected, such as workspaces, API keys, integrations, configs, guardrails, or prompts |
| **Action** | Create, update, delete, publish, export, rotate, manage, or duplicate |
| **Response status** | HTTP status code |
| **Workspace** | A specific workspace |
| **User** | The user or API key that made the change |
| **Client IP** | Originating IP address |
| **Country** | Originating country |

In the app, use the filters on the Audit Logs page.

### Access with the API

Call [`GET /audit-logs`](https://docs.portkey.ai/docs/api-reference/admin-api/control-plane/audit-logs/list-audit-logs). `start_time`, `end_time`, and `organisation_id` are required. `start_time` and `end_time` are ISO 8601 timestamps.

```bash theme={"system"}
curl "https://api.portkey.ai/v1/audit-logs?start_time=2026-11-01T00:00:00Z&end_time=2026-11-18T23:59:59Z&organisation_id=YOUR_ORGANISATION_ID" \
  -H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```

Add any of these query parameters to filter the results:

| Parameter | Filters by |
| - | - |
| `method` | `POST`, `PUT`, or `DELETE` |
| `uri` | URI path |
| `request_id` | Request ID |
| `user_id` | User ID |
| `user_type` | `user` or `api_key` |
| `workspace_id` | Workspace |
| `response_status_code` | HTTP status code |
| `resource_type` | Resource type |
| `action` | Action |
| `client_ip` | Client IP address |
| `country` | Country |

Results are paginated. Use `current_page` and `page_size` (maximum 100) to page through them.

## 2. Export logs

Exports run as jobs. Each job writes your request logs for a time range to a JSONL file, up to 50,000 logs per job.

### Export in the app

**1. Open Exports**

Go to **Exports** on the main sidebar and click **Request Data**.

**2. Configure the export**

Set the **Time Range**, the **Logs Limits** (maximum number of logs or a custom offset), and the **Requested Fields** to include.

**3. Request and start the export**

Click **Request Export**. The job appears in the exports list with the status **Draft**. Click **Start** to run it.

### Export with the API

Create the export job, then start it. The job runs asynchronously.

**1. Create the export**

[`POST /v1/logs/exports`](https://docs.portkey.ai/docs/api-reference/admin-api/data-plane/logs/log-exports-beta/create-a-log-export) with a time range and the fields to export. The response contains the export `id`.

```bash theme={"system"}
curl -X POST "https://api.portkey.ai/v1/logs/exports" \
  -H "x-portkey-api-key: YOUR_PORTKEY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filters": {
      "created_at": {
        "gte": "2026-11-01T00:00:00Z",
        "lte": "2026-11-18T23:59:59Z"
      }
    },
    "requested_data": ["id", "created_at", "ai_model", "total_units", "cost", "response_status_code"]
  }'
```

**2. Start the export**

[`POST /v1/logs/exports/{export_id}/start`](https://docs.portkey.ai/docs/api-reference/admin-api/data-plane/logs/log-exports-beta/start-a-log-export)

```bash theme={"system"}
curl -X POST "https://api.portkey.ai/v1/logs/exports/EXPORT_ID/start" \
  -H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```

For the full list of fields, restrictions on exportable fields, and a complete script, see [Logs Export](https://docs.portkey.ai/docs/product/observability/logs-export.md).

## 3. Download exported logs

### Download in the app

**1. Wait for the export to finish**

Open **Exports** on the main sidebar. The status changes to **Success** when the job is done. If it shows **Failure**, click **Start Again** to retry.

**2. Download the file**

Click **Download** next to the completed export. The file is in JSONL format, one log entry per line.

### Download with the API

**1. Check the export status**

[`GET /v1/logs/exports/{export_id}`](https://docs.portkey.ai/docs/api-reference/admin-api/data-plane/logs/log-exports-beta/retrieve-a-log-export). Repeat until `status` is `success`. A status of `failure` means the job failed.

```bash theme={"system"}
curl "https://api.portkey.ai/v1/logs/exports/EXPORT_ID" \
  -H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```

**2. Get the download URL**

[`GET /v1/logs/exports/{export_id}/download`](https://docs.portkey.ai/docs/api-reference/admin-api/data-plane/logs/log-exports-beta/download-a-log-export) returns a signed URL.

```bash theme={"system"}
curl "https://api.portkey.ai/v1/logs/exports/EXPORT_ID/download" \
  -H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```

**3. Download the file**

```bash theme={"system"}
curl -o logs_export.jsonl "SIGNED_DOWNLOAD_URL"
```

## Related

> [card] [Audit Logs](https://docs.portkey.ai/docs/product/enterprise-offering/audit-logs.md)

> [card] [Logs Export](https://docs.portkey.ai/docs/product/observability/logs-export.md)


## Related topics

- [OpenTelemetry(OTel) Export](https://docs.portkey.ai/docs/product/enterprise-offering/otel/otel.md)
- [Analytics Export](https://docs.portkey.ai/docs/product/enterprise-offering/otel/analytics.md)
- [Logs Export](https://docs.portkey.ai/docs/product/observability/logs-export.md)
- [Data Service](https://docs.portkey.ai/docs/changelog/data-service.md)
- [Enterprise Components](https://docs.portkey.ai/docs/product/enterprise-offering/components.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.