> ## 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.

# Read one end user's spend

> Windowed spend rollup for one external end user across the organization (the /customer/info-style read a rebilling integration polls). `cap` is the applicable attributed-user budget cap and its remaining headroom once such a budget template applies; null until then.



## OpenAPI

````yaml GET /api/gateway/v1/end-users/{id}/spend
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/end-users/{id}/spend:
    get:
      tags:
        - Gateway Spend
      summary: Read one end user's spend
      description: >-
        Windowed spend rollup for one external end user across the organization
        (the /customer/info-style read a rebilling integration polls). `cap` is
        the applicable attributed-user budget cap and its remaining headroom
        once such a budget template applies; null until then.
      operationId: getApiGatewayV1End-usersByIdSpend
      parameters:
        - in: query
          name: window
          schema:
            type: string
            enum:
              - day
              - week
              - month
            default: month
        - in: query
          name: from
          schema:
            type: integer
            exclusiveMinimum: 0
        - in: query
          name: to
          schema:
            type: integer
            exclusiveMinimum: 0
        - in: query
          name: virtual_key_id
          schema:
            type: string
            minLength: 1
            maxLength: 100
        - schema:
            type: string
          in: path
          name: id
          required: true
      responses:
        '200':
          description: Spend and standing for one end user
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      end_user_id:
                        type: string
                      window:
                        type: string
                      from:
                        type: string
                      to:
                        type: string
                      cost:
                        type: object
                        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
                      request_count:
                        type: integer
                      usage:
                        type: object
                        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
                      caps:
                        type: array
                        items:
                          type: object
                          properties:
                            budget_id:
                              type: string
                            anchor_id:
                              type: string
                            window:
                              type: string
                            on_breach:
                              type: string
                              enum:
                                - block
                                - warn
                            limit_usd:
                              type: string
                              description: >-
                                The cap for this end user. Decimal string, up to
                                9 fractional digits, trailing zeros trimmed,
                                never exponent notation.
                            spent_usd:
                              type: string
                              description: >-
                                Spend against that cap. Decimal string, up to 9
                                fractional digits, trailing zeros trimmed, never
                                exponent notation.
                            period_started_at:
                              type: string
                          required:
                            - budget_id
                            - anchor_id
                            - window
                            - on_breach
                            - limit_usd
                            - spent_usd
                            - period_started_at
                    required:
                      - end_user_id
                      - window
                      - from
                      - to
                      - cost
                      - request_count
                      - usage
                      - caps
                required:
                  - data
        '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.

````