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

# Credit Usage Events (Admin)

> Returns the raw `usage_events` rows for a single account over the selected period, sorted by `created_at` descending. Powers the drilldown view that expands when a row in the [`/api/admins/credits/rollup`](/api-reference/admins/credits-rollup) table is opened. Each event represents one debit (main agent turn, subagent step, chat completion, or research call), with token counts and `credits_deducted_cents` matching the wallet drop on `credits_usage` for that account. Requires the authenticated account to be a Recoup admin.



## OpenAPI

````yaml api-reference/openapi/accounts.json GET /api/admins/credits/events
openapi: 3.1.0
info:
  title: Recoup API - Accounts
  description: >-
    API documentation for the Recoup platform - an AI agent platform for the
    music industry
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.recoupable.dev
security: []
paths:
  /api/admins/credits/events:
    get:
      description: >-
        Returns the raw `usage_events` rows for a single account over the
        selected period, sorted by `created_at` descending. Powers the drilldown
        view that expands when a row in the
        [`/api/admins/credits/rollup`](/api-reference/admins/credits-rollup)
        table is opened. Each event represents one debit (main agent turn,
        subagent step, chat completion, or research call), with token counts and
        `credits_deducted_cents` matching the wallet drop on `credits_usage` for
        that account. Requires the authenticated account to be a Recoup admin.
      parameters:
        - name: account_id
          in: query
          required: true
          description: UUID of the account whose `usage_events` rows to return.
          schema:
            type: string
            format: uuid
        - name: period
          in: query
          required: false
          description: >-
            Window to filter `created_at` against. Same semantics as the rollup
            endpoint. Defaults to `monthly`.
          schema:
            type: string
            enum:
              - all
              - daily
              - weekly
              - monthly
            default: monthly
        - name: limit
          in: query
          required: false
          description: >-
            Page size — number of events to return per request, sorted by
            `created_at` descending. Defaults to 100; max 500.
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
        - name: page
          in: query
          required: false
          description: >-
            1-indexed page number. Server returns rows `(page - 1) * limit`
            through `page * limit - 1`. Defaults to 1. Use `total_count` in the
            response to drive a 'load more' control on the drilldown (`page *
            limit < total_count`).
          schema:
            type: integer
            minimum: 1
            default: 1
      responses:
        '200':
          description: Usage events retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminCreditsEventsResponse'
        '400':
          description: Missing or invalid `account_id`, `period`, or `limit`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountErrorResponse'
        '401':
          description: Unauthorized - missing or invalid credentials
        '403':
          description: Forbidden - authenticated account is not a Recoup admin
        '500':
          description: Internal server error while fetching usage events
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountErrorResponse'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    AdminCreditsEventsResponse:
      type: object
      required:
        - status
        - account_id
        - period
        - page
        - limit
        - total_count
        - events
      properties:
        status:
          type: string
          enum:
            - success
            - error
          description: Status of the request
        account_id:
          type: string
          format: uuid
          description: UUID of the account whose events were returned (echoes the request)
        period:
          type: string
          enum:
            - all
            - daily
            - weekly
            - monthly
          description: The period the response was filtered to (echoes the request)
        page:
          type: integer
          minimum: 1
          description: 1-indexed page returned (echoes the request, or 1 if omitted)
        limit:
          type: integer
          minimum: 1
          description: >-
            Page size used for this response (echoes the request, or the default
            if omitted)
        total_count:
          type: integer
          minimum: 0
          description: >-
            Total number of `usage_events` rows for this account in the selected
            period (i.e. the size of the full result set before pagination). The
            client derives `has_more` as `page * limit < total_count` and shows
            'X of Y events'. Computed via a `COUNT(*)` query alongside the
            paginated row fetch.
        events:
          type: array
          description: Raw `usage_events` rows, sorted by `created_at` descending
          items:
            type: object
            required:
              - id
              - created_at
              - source
              - agent_type
              - input_tokens
              - cached_input_tokens
              - output_tokens
              - tool_call_count
              - credits_deducted_cents
            properties:
              id:
                type: string
                description: nanoid primary key of the `usage_events` row
              created_at:
                type: string
                format: date-time
                description: When the event was recorded
              source:
                type: string
                enum:
                  - web
                  - api
                description: >-
                  Which surface originated the debit. `web` = open-agents chat.
                  `api` = recoupable api (chat completion or research call).
              agent_type:
                type: string
                enum:
                  - main
                  - subagent
                description: >-
                  `main` for the top-level agent turn or any non-agent debit;
                  `subagent` for a nested task-tool step
              provider:
                type: string
                nullable: true
                description: >-
                  Provider slug (e.g. `anthropic`). Null when the debit isn't
                  tied to a specific provider (e.g. research).
              model_id:
                type: string
                nullable: true
                description: >-
                  Gateway model slug (e.g. `anthropic/claude-opus-4.6`). Null
                  for research/x402-style debits.
              input_tokens:
                type: integer
                description: >-
                  Total input tokens for the call (including cached). 0 for
                  non-LLM debits.
              cached_input_tokens:
                type: integer
                description: >-
                  Subset of `input_tokens` that hit the provider cache (priced
                  at the cache-read rate).
              output_tokens:
                type: integer
                description: Output tokens for the call. 0 for non-LLM debits.
              tool_call_count:
                type: integer
                description: Number of tool calls observed in this step
              credits_deducted_cents:
                type: integer
                description: >-
                  The amount debited from `credits_usage.remaining_credits` for
                  this event. Same value the wallet dropped by on this turn.
        error:
          type: string
          description: Error message (only present if status is 'error')
    AccountErrorResponse:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
          description: Status of the request
        message:
          type: string
          description: Error message describing what went wrong
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your Recoup API key. [Learn more](/quickstart#api-keys).
    bearerAuth:
      type: http
      scheme: bearer

````