---
title: "Query runtime log data"
method: POST
path: "/v2/analytics.getRuntimeLogs"
tags: ["analytics"]
---

# Query runtime log data

`POST /v2/analytics.getRuntimeLogs`

A query can use only the public alias `runtime_logs_v1`. CTEs, subqueries, UNION, and EXCEPT are permitted.
The root key must have the `project.*.read_runtime_logs` permission.
Unkey limits each query to the workspace of the root key. To get the logs of one project, app, environment, or deployment, add a filter on `project_id`, `app_id`, `environment_id`, or `deployment_id`.
The workspace retention period and the workspace query limits apply.
For the table, the columns, and more query examples, see [Query runtime logs](/platform/analytics/get-runtime-logs).

## Request body

- V2AnalyticsGetRuntimeLogsRequestBody
  - `query` string, required — The SQL query for your runtime log data. A query can use only the public alias `runtime_logs_v1`. The physical `default.*` table name is not permitted. CTEs, subqueries, UNION, and EXCEPT are permitted. Only SELECT queries are permitted. Unkey limits each query to the workspace of the root key. To get the logs of one project, app, environment, or deployment, add a filter on `project_id`, `app_id`, `environment_id`, or `deployment_id`. The workspace retention period and the workspace query limits apply.

## Response `200`

Query executed successfully

- V2AnalyticsGetRuntimeLogsResponseBody
  - `meta` Meta, required — Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The `requestId` is particularly important when troubleshooting issues with the Unkey support team.
    - `requestId` string, required — A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
  - `data` object[], required — The runtime log rows that the query returned. The SELECT clause of the query sets the fields of each row.

## Other responses

- `400` — Invalid SQL query, blocked operation, or missing required authentication
- `401` — Invalid authentication credentials
- `403` — Insufficient permissions
- `412` — Analytics is not configured for the workspace
- `422` — Query exceeds workspace query limits
- `429` — Query quota exceeded
- `500` — Query execution failed
- `503` — Connection to the database failed

---

[API](https://skmtc.net/unkeyed/apis/unkey-api.md) · [All operations](https://skmtc.net/unkeyed/apis/unkey-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unkeyed/unkey-api/revisions/060c53b503ce/schema)
