logs

List API requests

Changed on

List the requests that the Unkey API served for your workspace, newest first.

Filter by time, path, method, request ID, and status. In one field, values under is, contains, startsWith, and endsWith are combined with OR. Values under isNot and notContains, and the range operators gt, gte, lt, and lte, are combined with AND. Different fields are combined with AND. Every text match is exact and case-sensitive.

To get the next page, send the pagination.cursor of the previous page together with the same filters. A cursor does not expire, but rows older than the log retention leave the listing.

Unkey returns only requests inside the log retention of your workspace. The calls to this endpoint are not logged.

Required Permissions

Your root key must have the following permission:

  • unkey:v1:<workspace_id>:logs/apiRequests#read
post/v2/logs.listApiRequests

Request

  • Base URL
    https://api.unkey.com
  • URL
    https://api.unkey.com/v2/logs.listApiRequests
  • Auth
    HTTP bearer

Request body

limitinteger

The maximum number of requests to return in one page.

cursorstring

The pagination.cursor of the previous page. Send the same filters with every page of one listing. Omit the cursor to get the first page.

Example request

{
  "cursor": "MTc5MjAyMTg1MDEyMzpyZXFfNTY3OGVmZ2g",
  "filters": {
    "time": {
      "gte": 1791936000000,
      "lt": 1792022400000
    },
    "path": {
      "startsWith": [
        "/v2/keys."
      ],
      "notContains": [
        "verifyKey"
      ]
    },
    "method": {
      "is": [
        "POST",
        "PUT"
      ]
    },
    "requestId": {
      "isNot": [
        "api.unkey.dev"
      ]
    },
    "status": {
      "gte": 400,
      "lt": 600,
      "isNot": [
        429
      ]
    }
  }
}

Response

A page of requests, newest first. When hasMore is true, send pagination.cursor to get the next page.

Example response

{
  "meta": {
    "requestId": "req_123"
  },
  "data": [
    {
      "requestId": "req_1234abcd",
      "time": 1792021850123,
      "host": "api.unkey.com",
      "method": "POST",
      "path": "/v2/keys.updateKey",
      "status": 404,
      "latencyMs": 38,
      "requestHeaders": [
        "Content-Type: application/json",
        "Authorization: [REDACTED]"
      ],
      "requestBody": "{\"keyId\":\"key_1234abcd\",\"name\":\"Payments\"}",
      "responseHeaders": [
        "Content-Type: application/json"
      ],
      "responseBody": "{\"meta\":{\"requestId\":\"req_1234abcd\"},\"error\":{\"status\":404}}"
    }
  ],
  "pagination": {
    "cursor": "eyJrZXkiOiJrZXlfMTIzNCIsInRzIjoxNjk5Mzc4ODAwfQ==",
    "hasMore": true
  }
}

Changes