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

# Usage of the calling API key

> The last 31 days of metered `/verify` and `/settle` calls for the API key that makes the request, and
the service fee accrued for its successful settlements.




## OpenAPI

````yaml /api-reference/openapi.yaml get /usage
openapi: 3.1.0
info:
  title: Rail402
  version: 0.0.0
  summary: x402 facilitator and Bazaar discovery layer for Stellar.
  description: >
    The Rail402 HTTP service. `/supported`, `/verify` and `/settle` follow the
    x402 version 2 facilitator

    interface; `/discovery/*` serves the Bazaar catalog and search.


    Every endpoint except `/health`, `/ready` and `/metrics` is rate-limited per
    client address. A limited

    request gets HTTP 429 with a `Retry-After` header and the code
    `rate_limited`.
  license:
    name: Apache-2.0
    identifier: Apache-2.0
servers:
  - url: https://testnet.rail402.dev
    description: Hosted testnet facilitator (stellar:testnet only, no API key)
security: []
tags:
  - name: Facilitator
    description: x402 facilitator interface.
  - name: Discovery
    description: Bazaar catalog and natural-language search.
  - name: Operations
    description: Health, readiness, metrics and usage.
paths:
  /usage:
    get:
      tags:
        - Operations
      summary: Usage of the calling API key
      description: >
        The last 31 days of metered `/verify` and `/settle` calls for the API
        key that makes the request, and

        the service fee accrued for its successful settlements.
      operationId: getUsage
      responses:
        '200':
          description: >-
            Usage rows. With the Postgres store they are ordered newest day
            first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageResponse'
        '401':
          description: No known API key was sent (`unauthorized`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
              example:
                error:
                  code: unauthorized
                  reason: A valid API key is required for this endpoint.
                  retryable: false
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - bearerKey: []
        - headerKey: []
components:
  schemas:
    UsageResponse:
      type: object
      required:
        - subject
        - days
        - serviceFee
        - usage
      properties:
        subject:
          type: string
          description: >-
            `key:` followed by the first 16 hex characters of the key's SHA-256
            digest.
        days:
          type: integer
          const: 31
        serviceFee:
          type: object
          required:
            - perSettlementUsd
            - accruedUsd
          properties:
            perSettlementUsd:
              type: string
            accruedUsd:
              type: string
        usage:
          type: array
          items:
            type: object
            required:
              - day
              - network
              - operation
              - outcome
              - asset
              - requests
              - settledAmount
            properties:
              day:
                type: string
                format: date
              network:
                type: string
              operation:
                type: string
                enum:
                  - verify
                  - settle
              outcome:
                type: string
                enum:
                  - valid
                  - invalid
                  - success
                  - failure
                  - pending
              asset:
                type: string
              requests:
                type: integer
              settledAmount:
                type: string
                description: Settled volume in the asset's base units.
    ErrorBody:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - reason
            - retryable
          properties:
            code:
              type: string
            reason:
              type: string
            retryable:
              type: boolean
            details:
              type: object
              additionalProperties: true
  responses:
    RateLimited:
      description: Rate limited (`rate_limited`).
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
  headers:
    RetryAfter:
      description: Seconds until a retry can succeed.
      schema:
        type: integer
  securitySchemes:
    bearerKey:
      type: http
      scheme: bearer
      description: An API key whose SHA-256 digest is listed in `API_KEY_SHA256`.
    headerKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: An API key whose SHA-256 digest is listed in `API_KEY_SHA256`.

````

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