GET /api/logs

Get logs that match the given query with pagination.

Pagination on large result sets

For tenants with very large log volumes, the default exact count(*) may exceed Postgres statement_timeout. Pass enableCap=true to short-circuit the count query: any tenant with more than 10,000 matching logs saturates Total-Number at the sentinel value 10001 and the response includes Total-Number-Is-Capped: true. In capped responses the Link header omits rel="last" and rel="next"; walk forward by incrementing page and stop on an empty response.

Query parameters

  • userId string

    Filter logs by user ID.

  • applicationId string

    Filter logs by application ID.

  • logKey string

    Filter logs by log key.

  • enableCap string

    When true, short-circuits the underlying count(*) query: any tenant with more than 10,000 matching logs saturates Total-Number at the sentinel value 10001 and the response emits Total-Number-Is-Capped: true. The Link header then omits rel="last" and rel="next" because the real total is unknown. Default false; recommended true for any client whose tenant volume may exceed 10,000 matching logs to avoid statement_timeout.

  • start_time string

    Exclusive lower bound on createdAt, in unix milliseconds. When set, returns only logs where createdAt > start_time. Recommended for clients paginating across very large log ranges to keep query latency consistent.

  • end_time string

    Exclusive upper bound on createdAt, in unix milliseconds. When set, returns only logs where createdAt < end_time. Returns 400 if start_time >= end_time when both are present.

  • page integer

    Page number (starts from 1).

    Minimum value is 1. Default value is 1.

  • page_size integer

    Entries per page.

    Minimum value is 1. Default value is 20.

Responses

  • 200 application/json

    An array of logs that match the given query.

    Hide headers attributes Show headers attributes
    • Total-Number integer

      When enableCap=false: exact match count. When enableCap=true: either the exact count (≤ 10,000) or the saturation sentinel 10001; inspect Total-Number-Is-Capped to distinguish.

    • Total-Number-Is-Capped string

      Present and set to true only when enableCap=true and the result has more than 10,000 matching logs (in which case Total-Number is 10001). Consumers should treat Total-Number as > 10,000 when this header is present.

      Value is true.

    Hide response attributes Show response attributes object
    • tenantId string Required

      Maximum length is 21.

    • id string Required

      Minimum length is 1, maximum length is 21.

    • key string Required

      Minimum length is 1, maximum length is 128.

    • payload object Required
      Hide payload attributes Show payload attributes object
      • key string Required
      • result string Required

        Values are Success or Error.

      • error object | string

      • ip string
      • userAgent string
      • userAgentParsed object
        Hide userAgentParsed attributes Show userAgentParsed attributes object
        • ua string
        • browser object
          Hide browser attributes Show browser attributes object
          • name string
          • version string
          • major string
          • type string
        • device object
          Hide device attributes Show device attributes object
          • model string
          • type string
          • vendor string
        • engine object
          Hide engine attributes Show engine attributes object
          • name string
          • version string
        • os object
          Hide os attributes Show os attributes object
          • name string
          • version string
        • cpu object
          Hide cpu attribute Show cpu attribute object
          • architecture string
      • userId string
      • applicationId string
      • sessionId string
      • params object
    • createdAt number Required
  • 400

    Returned when start_time or end_time is not a finite number, or when start_time >= end_time.

  • 401

    Unauthorized

  • 403

    Forbidden

GET /api/logs
curl \
 --request GET 'https://[tenant_id].logto.app/api/logs' \
 --header "Authorization: Bearer $ACCESS_TOKEN"
Response examples (200)
# Headers
Total-Number: 42
Total-Number-Is-Capped: true
Link: string

# Payload
[
  {
    "tenantId": "string",
    "id": "string",
    "key": "string",
    "payload": {
      "key": "string",
      "result": "Success",
      "error": {},
      "ip": "string",
      "userAgent": "string",
      "userAgentParsed": {
        "ua": "string",
        "browser": {
          "name": "string",
          "version": "string",
          "major": "string",
          "type": "string"
        },
        "device": {
          "model": "string",
          "type": "string",
          "vendor": "string"
        },
        "engine": {
          "name": "string",
          "version": "string"
        },
        "os": {
          "name": "string",
          "version": "string"
        },
        "cpu": {
          "architecture": "string"
        }
      },
      "userId": "string",
      "applicationId": "string",
      "sessionId": "string",
      "params": {}
    },
    "createdAt": 42.0
  }
]