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

# List spend events

> Cursor-paged pull over the per-request spend record, ascending by insert order so rows folded late are never skipped by an in-flight cursor. Events are the same canonical objects webhook deliveries carry. Retention is a fixed 13 months, which bounds reconciliation and replay. When feeding a downstream biller, mind its dedup window (Metronome 34 days, Stripe meters 24h+): re-pulling older ranges into a biller past its window can double-bill.



## OpenAPI

````yaml GET /api/gateway/v1/spend-events
openapi: 3.1.0
info:
  title: LangWatch API
  version: 1.0.0
  description: LangWatch openapi spec
servers:
  - url: https://app.langwatch.ai
security:
  - project_api_key: []
paths:
  /api/gateway/v1/spend-events:
    get:
      tags:
        - Gateway Spend
      summary: List spend events
      description: >-
        Cursor-paged pull over the per-request spend record, ascending by insert
        order so rows folded late are never skipped by an in-flight cursor.
        Events are the same canonical objects webhook deliveries carry.
        Retention is a fixed 13 months, which bounds reconciliation and replay.
        When feeding a downstream biller, mind its dedup window (Metronome 34
        days, Stripe meters 24h+): re-pulling older ranges into a biller past
        its window can double-bill.
      operationId: getApiGatewayV1Spend-events
      parameters:
        - in: query
          name: from
          schema:
            type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
          required: true
        - in: query
          name: to
          schema:
            type: integer
            minimum: -9007199254740991
            maximum: 9007199254740991
          required: true
        - in: query
          name: cursor
          schema:
            type: string
            maxLength: 500
          required: false
        - in: query
          name: limit
          schema:
            type: integer
            exclusiveMinimum: 0
            maximum: 200
            default: 50
          required: false
        - in: query
          name: virtual_key_id
          schema:
            type: string
            minLength: 1
            maxLength: 100
          required: false
        - in: query
          name: end_user_id
          schema:
            type: string
            minLength: 1
            maxLength: 256
          required: false
        - in: query
          name: project_id
          schema:
            type: string
            minLength: 1
            maxLength: 100
          required: false
        - in: query
          name: model
          schema:
            type: string
            minLength: 1
            maxLength: 200
          required: false
        - in: query
          name: status
          schema:
            type: string
            enum:
              - success
              - error
              - admitted
              - confirmed
              - failed
              - settled
          required: false
      responses:
        '200':
          description: One page of billing envelopes
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        type:
                          type: string
                        created:
                          type: string
                        schema_version:
                          type: string
                        data:
                          type: object
                          properties:
                            event_id:
                              type: string
                            event_type:
                              type: string
                            gateway_request_id:
                              type: string
                            occurred_at:
                              type: string
                            usage:
                              type:
                                - object
                                - 'null'
                              properties:
                                input_tokens:
                                  type: integer
                                output_tokens:
                                  type: integer
                                cache_read_input_tokens:
                                  type: integer
                                cache_creation_input_tokens:
                                  type: integer
                                reasoning_tokens:
                                  type: integer
                              required:
                                - input_tokens
                                - output_tokens
                                - cache_read_input_tokens
                                - cache_creation_input_tokens
                                - reasoning_tokens
                            cost:
                              type:
                                - object
                                - 'null'
                              properties:
                                total_usd:
                                  type: string
                                  description: >-
                                    Display value. Decimal string, up to 9
                                    fractional digits, trailing zeros trimmed,
                                    never exponent notation. Use nano_usd for
                                    arithmetic.
                                nano_usd:
                                  type: integer
                                  description: >-
                                    Canonical integer cost, nano-USD. Rated as
                                    an integer and summed as one, so this is the
                                    figure to reconcile against.
                              required:
                                - total_usd
                                - nano_usd
                            status:
                              type: string
                            needs_reconciliation:
                              type:
                                - boolean
                                - 'null'
                            settle_reason:
                              type:
                                - string
                                - 'null'
                            error:
                              type:
                                - object
                                - 'null'
                              properties:
                                class:
                                  type: string
                                http_status:
                                  type:
                                    - integer
                                    - 'null'
                              required:
                                - class
                                - http_status
                            duration_ms:
                              type:
                                - integer
                                - 'null'
                            labels:
                              type: array
                              items:
                                type: string
                            metadata:
                              type: object
                              additionalProperties: {}
                          required:
                            - event_id
                            - event_type
                            - gateway_request_id
                            - occurred_at
                            - usage
                            - cost
                            - status
                            - needs_reconciliation
                            - settle_reason
                            - error
                            - duration_ms
                            - labels
                            - metadata
                          additionalProperties: true
                      required:
                        - id
                        - type
                        - created
                        - schema_version
                        - data
                  next_cursor:
                    type:
                      - string
                      - 'null'
                required:
                  - data
                  - next_cursor
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      type:
                        type: string
                      code:
                        type: string
                      message:
                        type: string
                      meta:
                        type: object
                        additionalProperties: {}
                      trace_id:
                        type: string
                      span_id:
                        type: string
                    required:
                      - type
                      - code
                      - message
                required:
                  - error
components:
  securitySchemes:
    project_api_key:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        Project API key for sending traces and accessing project-scoped
        resources. Format: sk-lw-... (no underscore). Obtain one by creating a
        project via the Admin API or the LangWatch UI.

````