analytics
Query gateway request data
A query can use only the public alias gateway_requests_v1. CTEs, subqueries, UNION, and EXCEPT are permitted. The root key must have the project.*.read_gateway_requests permission. Unkey limits each query to the workspace of the root key. To get the data for one project, app, or environment, add a filter on project_id, app_id, or environment_id. The workspace retention period and the workspace query limits apply. For the columns and more query examples, see the gateway request analytics documentation.
post/v2/analytics.getGatewayRequests
Request body
Example request
{
"query": "SELECT path, count() AS total FROM gateway_requests_v1 WHERE response_status >= 500 AND time >= toUnixTimestamp64Milli(now64(3) - INTERVAL 24 HOUR) GROUP BY path ORDER BY total DESC LIMIT 10"
}Response
Query executed successfully
Example response
{
"meta": {
"requestId": "req_123"
},
"data": [
{
"path": "/v1/orders",
"total": 1234
}
]
}