> ## Documentation Index
> Fetch the complete documentation index at: https://docs.airctrl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Read request logs for one installation-bound protection

> Returns request metadata only for the gateway created by this protection. Bodies are never exposed through OAuth. Cost is present only when the same token also has protections:read-spend.



## OpenAPI

````yaml /api-reference/openapi.json get /oauth/protections/{protectionId}/logs
openapi: 3.0.0
info:
  title: AIRCTRL API
  description: >-
    Programmatic access to AIRCTRL. Record values are encrypted by the client,
    so the API stores ciphertext and encrypted keys instead of plaintext record
    values.
  version: '1'
  contact: {}
servers:
  - url: https://api.airctrl.dev/v1
    description: Production
  - url: https://api.staging.airctrl.dev/v1
    description: QA
security: []
tags:
  - name: Context
    description: Find the accounts available to the caller.
  - name: Projects
    description: Create and manage projects.
  - name: Records
    description: Store and use client-encrypted records.
  - name: Audit
    description: Read record activity and access history.
  - name: Providers
    description: Discover supported AI providers.
  - name: Provider Credentials
    description: Manage encrypted provider credentials.
  - name: Gateways
    description: Create and operate AI gateways.
  - name: Usage
    description: Read gateway usage and spend data.
  - name: Service Accounts
    description: Read Service Account metadata and grant records.
paths:
  /oauth/protections/{protectionId}/logs:
    get:
      tags:
        - OAuth
      summary: Read request logs for one installation-bound protection
      description: >-
        Returns request metadata only for the gateway created by this
        protection. Bodies are never exposed through OAuth. Cost is present only
        when the same token also has protections:read-spend.
      parameters:
        - in: path
          name: protectionId
          required: true
          description: AIRCTRL protection ID returned for one external resource.
          schema:
            type: string
            format: uuid
        - in: query
          name: since
          schema:
            type: string
            format: date-time
        - in: query
          name: provider
          schema:
            maxLength: 64
            type: string
        - in: query
          name: model
          schema:
            maxLength: 200
            type: string
        - in: query
          name: status
          schema:
            minimum: 100
            maximum: 599
            type: integer
        - in: query
          name: limit
          schema:
            minimum: 1
            maximum: 200
            type: integer
            default: 50
        - in: query
          name: offset
          description: Zero-based offset pagination. Must be zero when cursor is provided.
          schema:
            type: integer
            minimum: 0
            default: 0
        - in: query
          name: cursor
          description: >-
            Opaque cursor from the previous response. Reuse the exact active
            filters.
          schema:
            maxLength: 2048
            type: string
      responses:
        '200':
          description: Cursor-paginated request metadata scoped to exactly one protection.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                  data:
                    $ref: '#/components/schemas/GatewayLogs'
        '403':
          description: OAuth scope or installation binding is invalid.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    oneOf:
                      - type: string
                      - type: object
                        properties:
                          code:
                            type: string
                          message:
                            type: string
                        required:
                          - code
                          - message
                  code:
                    type: string
                  message:
                    type: string
                  error_description:
                    type: string
                  requestId:
                    type: string
                additionalProperties: true
        '404':
          description: Protection is not bound to this OAuth installation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    oneOf:
                      - type: string
                      - type: object
                        properties:
                          code:
                            type: string
                          message:
                            type: string
                        required:
                          - code
                          - message
                  code:
                    type: string
                  message:
                    type: string
                  error_description:
                    type: string
                  requestId:
                    type: string
                additionalProperties: true
      security:
        - oauth2:
            - protections:read-logs
components:
  schemas:
    GatewayLogs:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/GatewayRequestLog'
        total:
          type: integer
          minimum: 0
        pagination:
          type: object
          properties:
            limit:
              type: integer
              minimum: 1
              maximum: 200
            has_more:
              type: boolean
            next_cursor:
              type: string
              description: Opaque cursor for the next page.
              nullable: true
          additionalProperties: false
          required:
            - limit
            - has_more
            - next_cursor
        facets:
          type: object
          properties:
            providers:
              type: array
              items:
                type: object
                properties:
                  slug:
                    type: string
                  count:
                    type: integer
                    minimum: 0
                additionalProperties: false
                required:
                  - slug
                  - count
            statusClasses:
              type: array
              items:
                type: object
                properties:
                  class:
                    type: string
                  count:
                    type: integer
                    minimum: 0
                additionalProperties: false
                required:
                  - class
                  - count
          additionalProperties: false
          required:
            - providers
            - statusClasses
        can_read_spend:
          type: boolean
        can_read_bodies:
          type: boolean
      additionalProperties: false
      required:
        - rows
        - total
        - pagination
        - facets
        - can_read_spend
        - can_read_bodies
    GatewayRequestLog:
      type: object
      properties:
        log_id:
          type: string
          format: uuid
        request_id:
          type: string
          format: uuid
          description: >-
            Same stable request identifier exported as airctrl.request.id in
            OTel.
        account_id:
          type: string
          format: uuid
        project_id:
          type: string
          format: uuid
        gateway_id:
          type: string
          format: uuid
        gateway_name:
          type: string
          nullable: true
        token_id:
          type: string
          nullable: true
          format: uuid
        trace_id:
          type: string
          description: 32-character lowercase hexadecimal OpenTelemetry trace id.
          nullable: true
        span_id:
          type: string
          description: 16-character lowercase hexadecimal OpenTelemetry span id.
          nullable: true
        provider_slug:
          type: string
          nullable: true
        model:
          type: string
          nullable: true
        operation_name:
          type: string
          nullable: true
        status_code:
          type: integer
          nullable: true
        streamed:
          type: boolean
        prompt_tokens:
          type: integer
          nullable: true
        completion_tokens:
          type: integer
          nullable: true
        total_tokens:
          type: integer
          nullable: true
        cost:
          type: string
          nullable: true
        cost_estimated:
          type: boolean
        request_bytes:
          type: integer
          minimum: 0
          nullable: true
        response_bytes:
          type: integer
          minimum: 0
          nullable: true
        latency_ms:
          type: integer
          nullable: true
        error_code:
          type: string
          nullable: true
        finish_reason:
          type: string
          nullable: true
        upstream_request_id:
          type: string
          nullable: true
        claude_session_id:
          type: string
          nullable: true
        token_name:
          type: string
          nullable: true
        principal_type:
          type: string
          enum:
            - user
            - service_account
          nullable: true
        principal_id:
          type: string
          nullable: true
          format: uuid
        service_account_name:
          type: string
          nullable: true
        owner_email:
          type: string
          nullable: true
        guardrail_mode:
          type: string
          enum:
            - 'off'
            - flag
            - redact
            - block
          nullable: true
        guardrail_matched:
          type: array
          items:
            type: string
        created_at:
          type: string
          format: date-time
      additionalProperties: false
      required:
        - log_id
        - request_id
        - account_id
        - project_id
        - gateway_id
        - gateway_name
        - token_id
        - trace_id
        - span_id
        - provider_slug
        - model
        - operation_name
        - status_code
        - streamed
        - prompt_tokens
        - completion_tokens
        - total_tokens
        - cost
        - cost_estimated
        - request_bytes
        - response_bytes
        - latency_ms
        - error_code
        - finish_reason
        - upstream_request_id
        - claude_session_id
        - token_name
        - principal_type
        - principal_id
        - service_account_name
        - owner_email
        - guardrail_mode
        - guardrail_matched
        - created_at
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.airctrl.dev/oauth/authorize
          tokenUrl: https://api.airctrl.dev/v1/oauth/token
          refreshUrl: https://api.airctrl.dev/v1/oauth/token
          scopes:
            protections:provision: >-
              Atomically create the disclosed AIRCTRL resources for a protected
              external key.
            protections:read: Read only resources created by this OAuth connection.
            protections:update: >-
              Update allowlisted settings only on gateways created by this OAuth
              connection.
            protections:manage: >-
              Revoke, reactivate or rotate secrets only for protections created
              by this OAuth connection.
            protections:read-logs: >-
              Read request metadata only for protections created by this OAuth
              connection.
            protections:read-spend: >-
              Read token usage and spend only for protections created by this
              OAuth connection.
            offline_access: Receive rotating refresh tokens.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.