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

# HBAR/USD rate

> Paid, per query. Returns the HBAR/USD rate the Hedera network itself uses for fees, read from the exchange rate file through the mirror node, with the consensus expiry of that rate. Priced per unit with unit "query", so the 402 always asks for exactly one unit; pass quoteId as a query parameter to pin a quote. A mirror node failure answers 502 and cancels settlement.

<Note>
  This endpoint is paid. Read [Paying for a request](/api/paying-for-a-request) for the 402 handshake, or let `BuyerAgent.hbarRate()` handle it.
</Note>


## OpenAPI

````yaml /openapi.yaml get /v1/rates/hbar
openapi: 3.1.0
info:
  title: Agora402 seller API
  version: 1.0.0
  description: >-
    HTTP API served by every Agora402 seller: free discovery documents, a free
    quote endpoint, and paid endpoints gated by x402 and settled on Hedera
    through the Blocky402 facilitator. Typical agent flow: getManifest (what is
    sold, at what price, paid to which account) -> requestQuote (lock a signed
    price, counter below list if you like) -> call the paid endpoint with the
    quoteId. The first call answers 402 with a PAYMENT-REQUIRED header; the
    retry carries PAYMENT-SIGNATURE; the response carries PAYMENT-RESPONSE with
    the Hedera transaction id. Then read listReceipts or the seller's HCS
    receipts topic to audit what was charged. All amounts are decimal strings in
    atomic units of the asset (tinybars for HBAR, 8 decimals); timestamps are
    ISO 8601 unless stated; quote expiry is unix seconds.
servers:
  - url: http://localhost:4402
    description: Local services seller (npm run dev)
  - url: http://localhost:4404
    description: Local auditor (npm run dev)
security: []
tags:
  - name: Discovery
    description: Free documents that describe the seller. Read these before paying anyone.
  - name: Negotiation
    description: Free, signed, time-limited price quotes.
  - name: Paid services
    description: x402-gated endpoints. Every call is a Hedera micropayment.
  - name: Trust
    description: Paid audits of other sellers, attested on the HCS audit topic.
  - name: Receipts
    description: What this seller has been paid for.
paths:
  /v1/rates/hbar:
    get:
      tags:
        - Paid services
      summary: HBAR/USD rate
      description: >-
        Paid, per query. Returns the HBAR/USD rate the Hedera network itself
        uses for fees, read from the exchange rate file through the mirror node,
        with the consensus expiry of that rate. Priced per unit with unit
        "query", so the 402 always asks for exactly one unit; pass quoteId as a
        query parameter to pin a quote. A mirror node failure answers 502 and
        cancels settlement.
      operationId: getHbarRate
      parameters:
        - name: quoteId
          in: query
          required: false
          schema:
            type: string
          description: >-
            Quote to pin the price to, from requestQuote with endpointId
            hbar-rate.
        - $ref: '#/components/parameters/PaymentSignature'
      responses:
        '200':
          description: Current rate
          headers:
            PAYMENT-RESPONSE:
              $ref: '#/components/headers/PaymentResponse'
            x-agora-usage:
              schema:
                type: string
              description: Always {"units":1,"unit":"query"}.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateResponse'
              example:
                pair: HBAR/USD
                usdPerHbar: 0.0627
                centsPerHbar: 6.27
                source: hedera network exchange rate file via mirror node
                expirationTime: 1789563600
                fetchedAt: '2026-09-13T12:34:56.789Z'
                agora:
                  seller: >-
                    uaid:aid:2NEpo7TZRRrLZSi2U;uid=agora-demo-seller;registry=agora402;proto=a2a;nativeId=hedera:testnet:0.0.5001234;domain=localhost:4402
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '502':
          description: >-
            Mirror node unavailable. Settlement is cancelled; nothing is
            charged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: rate source unavailable
components:
  parameters:
    PaymentSignature:
      name: PAYMENT-SIGNATURE
      in: header
      required: false
      schema:
        type: string
      description: >-
        x402 payment payload (base64 JSON) built from the PAYMENT-REQUIRED
        challenge of the 402 answer. Omit on the first call to receive the
        price. BuyerAgent and @x402/fetch set this for you. The legacy name
        X-PAYMENT is also accepted.
  headers:
    PaymentResponse:
      schema:
        type: string
      description: >-
        x402 settlement result (base64 JSON) including the Hedera transaction
        id, e.g. 0.0.4009876@1789560131.552341000. Look it up on HashScan or
        through the mirror node.
  schemas:
    RateResponse:
      type: object
      required:
        - pair
        - usdPerHbar
        - centsPerHbar
        - source
        - expirationTime
        - fetchedAt
        - agora
      properties:
        pair:
          type: string
          enum:
            - HBAR/USD
        usdPerHbar:
          type: number
          description: centsPerHbar / 100
        centsPerHbar:
          type: number
          description: >-
            cent_equivalent / hbar_equivalent from the network exchange rate
            file
        source:
          type: string
        expirationTime:
          type: integer
          description: Unix seconds at which the network rate expires
        fetchedAt:
          type: string
          format: date-time
        agora:
          type: object
          properties:
            seller:
              $ref: '#/components/schemas/Uaid'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable reason
        detail:
          type: string
    Uaid:
      type: string
      pattern: '^uaid:'
      description: HCS-14 universal agent id
      example: >-
        uaid:aid:2NEpo7TZRRrLZSi2U;uid=agora-demo-seller;registry=agora402;proto=a2a;nativeId=hedera:testnet:0.0.5001234;domain=localhost:4402
    PaymentRequiredBody:
      type: object
      required:
        - error
        - endpoint
        - hint
        - quoteId
      properties:
        error:
          type: string
          enum:
            - payment required
        endpoint:
          type: string
          description: endpointId of the resource
        hint:
          type: string
        quoteId:
          type:
            - string
            - 'null'
          description: The quoteId you sent, if any
  responses:
    PaymentRequired:
      description: >-
        No valid payment attached. The PAYMENT-REQUIRED header carries the x402
        challenge (scheme exact, network, asset, amount, payTo, facilitator).
        Build the payment, retry with PAYMENT-SIGNATURE.
      headers:
        PAYMENT-REQUIRED:
          schema:
            type: string
          description: >-
            base64 JSON x402 challenge with the accepted payment options for
            this exact request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PaymentRequiredBody'
          example:
            error: payment required
            endpoint: infer
            hint: >-
              POST /a2a/quote with {"endpointId":"infer"} to negotiate, then
              retry with the quoteId
            quoteId: null

````