latestOpenAPI 3.1.0raw.githubusercontent.com2026-08-1983295742.1 KB

060c53b503ce

analytics

Query runtime log data

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.

post/v2/analytics.getRuntimeLogs

Request body

querystring 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.

Example request

{
  "query": "SELECT time, severity, message FROM runtime_logs_v1 WHERE lower(message) LIKE '%timeout%' ORDER BY time DESC LIMIT 100"
}

Response

Query executed successfully

dataobject[] required

The runtime log rows that the query returned. The SELECT clause of the query sets the fields of each row.

Example response

{
  "meta": {
    "requestId": "req_123"
  },
  "data": [
    {
      "time": 1755000000000,
      "severity": "error",
      "message": "upstream timeout after 30s"
    }
  ]
}