> ## 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 token usage and spend for one installation-bound protection



## OpenAPI

````yaml /api-reference/openapi.json get /oauth/protections/{protectionId}/spend
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}/spend:
    get:
      tags:
        - OAuth
      summary: Read token usage and spend for one installation-bound protection
      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
      responses:
        '200':
          description: PostgreSQL-backed usage and spend totals for exactly one protection.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - data
                properties:
                  ok:
                    type: boolean
                    enum:
                      - true
                  data:
                    type: object
                    required:
                      - currency
                      - since
                      - requests
                      - promptTokens
                      - completionTokens
                      - totalTokens
                      - spendUsd
                    properties:
                      currency:
                        type: string
                        enum:
                          - USD
                      since:
                        type: string
                        format: date-time
                        nullable: true
                      requests:
                        type: integer
                        minimum: 0
                      promptTokens:
                        type: integer
                        minimum: 0
                      completionTokens:
                        type: integer
                        minimum: 0
                      totalTokens:
                        type: integer
                        minimum: 0
                      spendUsd:
                        type: string
                        pattern: ^\d+\.\d{10}$
        '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-spend
components:
  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.