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

# Retrieve pending settlement balances

> Query pending settlement book balances aggregated by currency for the merchant associated with the current API Key. No merchant_id is required; the response contains only balances and as_of, without merchant_id.

The currency amount field is `amount`. This is an independent merchant-level aggregate, unrelated to `account_no`; do not add it to each account’s `total_amount`. The current version aggregates the total balances of internal pending settlement accounts, including frozen amounts. It must not be interpreted as an available pending settlement amount after deducting frozen or reserved funds.

Authentication follows the [common authentication specification](/en/api/getting-started). Do not pass `merchant_id` or `X-Merchant-Id`; the server only queries data for the merchant associated with the current API Key. No request body is required. Amount examples are fictional and use the smallest ledger unit.



## OpenAPI

````yaml /en/api/global-accounts.openapi.json get /api/v1/pending_settlement_balance
openapi: 3.1.0
info:
  title: StablePay Global Accounts API
  version: '2026-09-29'
  summary: >-
    List global accounts, retrieve an individual account, and query merchant
    pending settlement balances.
  description: >-
    Read-only queries for global accounts and pending settlement balances.
    Authentication follows the common StablePay authentication specification.
    This specification describes the current production implementation; examples
    use fictional data.
servers:
  - url: https://api.stablepay.co
    description: Production
security:
  - bearerAuth: []
    stablepayTimestamp: []
    stablepayNonce: []
    stablepaySignature: []
tags:
  - name: Global Accounts
    description: Read-only account and balance queries. No fund operations are provided.
paths:
  /api/v1/pending_settlement_balance:
    get:
      tags:
        - Global Accounts
      summary: Retrieve pending settlement balances
      description: >-
        Query pending settlement book balances aggregated by currency for the
        merchant associated with the current API Key. No merchant_id is
        required; the response contains only balances and as_of, without
        merchant_id.


        The currency amount field is `amount`. This is an independent
        merchant-level aggregate, unrelated to `account_no`; do not add it to
        each account’s `total_amount`. The current version aggregates the total
        balances of internal pending settlement accounts, including frozen
        amounts. It must not be interpreted as an available pending settlement
        amount after deducting frozen or reserved funds.


        Authentication follows the [common authentication
        specification](/en/api/getting-started). Do not pass `merchant_id` or
        `X-Merchant-Id`; the server only queries data for the merchant
        associated with the current API Key. No request body is required. Amount
        examples are fictional and use the smallest ledger unit.
      operationId: getPendingSettlementBalance
      parameters:
        - $ref: '#/components/parameters/XStablePayTimestamp'
        - $ref: '#/components/parameters/XStablePayNonce'
        - $ref: '#/components/parameters/XStablePaySignature'
      responses:
        '200':
          description: Query successful.
          headers:
            Cache-Control:
              schema:
                type: string
                enum:
                  - no-store
              description: Balance responses must not be cached.
            X-Request-ID:
              schema:
                type: string
              description: Provide this trace ID when troubleshooting.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PendingBalanceResponse'
              example:
                balances:
                  - currency: USDT
                    amount: 2500
                  - currency: USDC
                    amount: -100
                as_of: 1789084800
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: Internal server error.
                request_id: example-request-id
                timestamp: 1789084800
        '503':
          description: >-
            The balance query service is temporarily unavailable. Retry later
            with a new timestamp, nonce, and signature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: service_unavailable
                  message: >-
                    The balance query service is temporarily unavailable. Retry
                    later with a new timestamp, nonce, and signature.
                request_id: example-request-id
                timestamp: 1789084800
components:
  parameters:
    XStablePayTimestamp:
      name: X-StablePay-Timestamp
      in: header
      required: true
      description: Unix timestamp in seconds. Must be within 5 minutes of the server time.
      schema:
        type: string
      example: '1791878400'
    XStablePayNonce:
      name: X-StablePay-Nonce
      in: header
      required: true
      description: >-
        Random string for replay protection, 16–64 characters. A new UUID is
        recommended for each request.
      schema:
        type: string
        minLength: 16
        maxLength: 64
      example: 550e8400-e29b-41d4-a716-446655440000
    XStablePaySignature:
      name: X-StablePay-Signature
      in: header
      required: true
      description: >-
        Compute HMAC-SHA256 over `{timestamp}.{nonce}.{requestBody}` using the
        merchant API Secret and encode the result as lowercase hex. For GET
        requests, `requestBody` is an empty string.
      schema:
        type: string
      example: a1b2c3d4e5f6...
  schemas:
    PendingBalanceResponse:
      type: object
      required:
        - balances
        - as_of
      properties:
        balances:
          type: array
          description: >-
            Pending settlement balances aggregated by currency. Currencies with
            a zero total are omitted. Returns an empty array if there are no
            records.
          items:
            $ref: '#/components/schemas/PendingBalance'
        as_of:
          type: integer
          format: int64
          description: >-
            Database observation time for this query, in Unix seconds. This is
            not a data version and does not guarantee that multiple requests
            share the same snapshot.
      example:
        balances:
          - currency: USDT
            amount: 2500
          - currency: USDC
            amount: -100
        as_of: 1789084800
    ErrorResponse:
      type: object
      required:
        - error
        - request_id
        - timestamp
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Stable business error code.
            message:
              type: string
              description: Human-readable error description.
        request_id:
          type: string
          description: Request trace ID. Not restricted to digits.
        timestamp:
          type: integer
          format: int64
          description: Error response time in Unix seconds.
    PendingBalance:
      type: object
      required:
        - currency
        - amount
      properties:
        currency:
          type: string
          description: Currency code. At most one entry is returned per currency.
          example: USDT
        amount:
          type: integer
          format: int64
          description: >-
            The merchant pending settlement book balance for this currency, in
            the smallest ledger unit. Negative values are allowed and must be
            preserved by clients rather than clamped to zero. This is not an
            available or withdrawable balance.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Bearer API Key, for example `Bearer sk_live_xxx`.
    stablepayTimestamp:
      type: apiKey
      in: header
      name: X-StablePay-Timestamp
      description: Unix timestamp in seconds. Must be within 5 minutes of the server time.
    stablepayNonce:
      type: apiKey
      in: header
      name: X-StablePay-Nonce
      description: Random string for replay protection, 16–64 characters.
    stablepaySignature:
      type: apiKey
      in: header
      name: X-StablePay-Signature
      description: >-
        HMAC-SHA256 signature computed using the merchant API Secret, encoded as
        lowercase hex.

````

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