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

# Get a listing's usage

> How a published listing was paid for on `network`: the settlements observed against it that paid
its current owner, the distinct payers, and the latest 20 settlements, newest first (none on a
network that publishes usage counts only, pubnet's default). A listing that
is pending, quarantined or on another network is not found. A listing that declares the
`rail402-private-usage` extension, or whose content no origin confirmed (trust `settled`, such as an
`mcp://` tool), answers 404 with the code `discovery_usage_private`.




## OpenAPI

````yaml /api-reference/openapi.yaml get /discovery/resources/{id}/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 `/verify`

    or `/settle` with an API key is limited per key instead. 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:
  /discovery/resources/{id}/usage:
    get:
      tags:
        - Discovery
      summary: Get a listing's usage
      description: >
        How a published listing was paid for on `network`: the settlements
        observed against it that paid

        its current owner, the distinct payers, and the latest 20 settlements,
        newest first (none on a

        network that publishes usage counts only, pubnet's default). A listing
        that

        is pending, quarantined or on another network is not found. A listing
        that declares the

        `rail402-private-usage` extension, or whose content no origin confirmed
        (trust `settled`, such as an

        `mcp://` tool), answers 404 with the code `discovery_usage_private`.
      operationId: getResourceUsage
      parameters:
        - $ref: '#/components/parameters/ListingId'
        - $ref: '#/components/parameters/UsageNetwork'
      responses:
        '200':
          description: The listing's usage.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListingUsage'
        '400':
          $ref: '#/components/responses/InvalidParameter'
        '404':
          $ref: '#/components/responses/ListingNotFoundOrUsagePrivate'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/DiscoveryUnavailable'
components:
  parameters:
    ListingId:
      name: id
      in: path
      required: true
      description: A listing's id (`rail402.listings[].id`).
      schema:
        type: string
        format: uuid
    UsageNetwork:
      name: network
      in: query
      required: true
      description: The network whose listings and settlements are read.
      schema:
        type: string
        enum:
          - stellar:testnet
          - stellar:pubnet
  schemas:
    ListingUsage:
      type: object
      required:
        - listingId
        - payments
        - payers
        - firstObservedAt
        - lastObservedAt
        - recent
      properties:
        listingId:
          type: string
          format: uuid
        payments:
          type: integer
        payers:
          type: integer
          description: Distinct payers.
        firstObservedAt:
          type:
            - string
            - 'null'
          format: date-time
        lastObservedAt:
          type:
            - string
            - 'null'
          format: date-time
        recent:
          type: array
          maxItems: 20
          description: The latest settlements, newest first.
          items:
            type: object
            required:
              - transaction
              - payer
              - asset
              - amount
              - observedAt
            properties:
              transaction:
                type: string
              payer:
                type: string
              asset:
                type: string
              amount:
                type: string
                description: >-
                  The amount settled in base units; for `upto`, what was
                  charged.
              observedAt:
                type: string
                format: date-time
    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:
    InvalidParameter:
      description: >-
        A parameter is malformed or not supported
        (`discovery_invalid_parameter`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error:
              code: discovery_invalid_parameter
              reason: 'Unsupported parameter: foo.'
              retryable: false
    ListingNotFoundOrUsagePrivate:
      description: >-
        No listing published on this network has this id
        (`discovery_listing_not_found`), or its usage is private because its
        seller keeps it private or no origin confirmed it
        (`discovery_usage_private`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error:
              code: discovery_usage_private
              reason: The seller of this listing keeps its usage private.
              retryable: false
    RateLimited:
      description: Rate limited (`rate_limited`).
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
    DiscoveryUnavailable:
      description: >-
        Discovery is at capacity or the catalog database is busy
        (`discovery_overloaded`), or the catalog database cannot be reached
        (`discovery_catalog_unavailable`). Retry after `Retry-After`.
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorBody'
          example:
            error:
              code: discovery_overloaded
              reason: Discovery is at capacity; retry after the Retry-After interval.
              retryable: true
  headers:
    RetryAfter:
      description: Seconds until a retry can succeed.
      schema:
        type: integer

````

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