openapi: 3.1.0
info:
  title: Fiatless External API
  version: 1.0.0
  summary: Take crypto payments and send payouts from your own install.
  license:
    name: MIT
    identifier: MIT
  description: |
    Give each customer an address, learn when they pay, and send payouts from
    your treasury. One API covers Bitcoin, EVM chains, TRON, Solana and XRPL.

    Amounts are decimal strings in asset units, such as `"12.5"`. A JSON number
    or exponent notation is refused. Times are RFC 3339 in UTC, ending in `Z`. A call that creates something answers
    `202`: the request is stored, and the address or payout is ready later.

    The install loads its API keys when it starts. A new or removed key takes
    effect only after the operator restarts it.
servers:
  - url: /api/v1
    description: Relative to your install's API origin.
security:
  - BearerAuth: []
tags:
  - name: Catalog
    description: Networks, assets and USD rates.
  - name: Wallets
    description: Customer addresses, one per customer and network.
  - name: Balances
    description: One balance per asset for the whole install.
  - name: Transactions
    description: Payments, payouts and sweeps on chain.
  - name: Payouts
    description: Payouts from your treasury.
  - name: Webhooks
    description: Events signed as Standard Webhooks defines, sent to your endpoints.
paths:
  /networks:
    get:
      operationId: listNetworks
      tags:
        - Catalog
      summary: List networks
      description: |
        Returns every network your install has turned on, EVM networks the
        operator added included. Each one carries the confirmations a payment
        needs. Every request that takes a network takes its `code` or its `id`.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/Cursor"
        - $ref: "#/components/parameters/Limit"
      responses:
        "200":
          description: One page of networks.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NetworkPage"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
  /assets:
    get:
      operationId: listAssets
      tags:
        - Catalog
      summary: List assets
      description: |
        Lists the assets you can use: every asset belongs to one network, and
        one the operator has not enabled yet is not listed. `code=usdt&network=tron`
        finds USDT on TRON.

        A capability is `true` only while the install runs that workflow for
        the asset.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/Cursor"
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Network"
        - name: code
          in: query
          required: false
          description: |
            A coin's `code`, in any case. One network can list two assets of
            one code, such as a token and its bridged copy. A code no coin of
            this install has answers `400` with `error.field`.
          schema:
            type: string
            minLength: 1
            maxLength: 100
          example: usdt
      responses:
        "200":
          description: One page of assets.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssetPage"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
  /rates:
    get:
      operationId: listRates
      tags:
        - Catalog
      summary: List USD rates
      description: |
        Returns the stored USD rate of each coin that has an asset on a network
        this install runs, with the providers behind it. This call never asks a
        provider. An asset's `code` from `listAssets` is its coin's code here; a
        symbol alone does not say which coin it is.

        Without `codes`, every such coin is listed, including coins with no
        rate. `codes` takes up to 100 codes, comma-separated, compared without
        regard to case. An empty or unknown code, a code repeated in any case, a
        repeated parameter or an unknown parameter is refused.

        A missing, stale or disputed rate has a `null` price. A `degraded` price
        comes from one source. A rate is a reference, never a quote: it changes
        no balance and no payout. Rates still go stale while
        `collection_enabled` is `false`.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - name: codes
          in: query
          required: false
          description: Coin codes, comma-separated, in any case; omit it for every coin this install quotes.
          schema:
            type: array
            minItems: 1
            maxItems: 100
            uniqueItems: true
            items:
              $ref: "#/components/schemas/RateCoinCode"
          style: form
          explode: false
          example:
            - btc
            - trx
      responses:
        "200":
          description: USD rates with their sources and the state of each provider.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
            Cache-Control:
              schema:
                type: string
                const: no-store
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RatesEnvelope"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/RatesUnavailable"
  /wallets:
    get:
      operationId: listWallets
      tags:
        - Wallets
      summary: List customer addresses
      description: |
        Filter by `external_id` and `network` to find one customer's address.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/Cursor"
        - $ref: "#/components/parameters/Limit"
        - name: external_id
          in: query
          required: false
          schema:
            type: string
            minLength: 1
            maxLength: 255
        - $ref: "#/components/parameters/Network"
      responses:
        "200":
          description: One page of customer addresses.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WalletPage"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
    post:
      operationId: createWallet
      tags:
        - Wallets
      summary: Create customer address
      description: |
        Creates the address for one customer on one network and answers it in
        the same call.

        Only assets listed in `asset_ids` are credited to the address. A second
        address for the same `external_id` on a network answers `409` with
        `resource_conflict`. A network this install does not run now answers
        `503`, as does the call while the operator recovers the install's
        database after a restore. Keys and seeds are never returned.
      x-required-scopes:
        - wallets:write
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateWalletRequest"
      responses:
        "201":
          description: The address, or this is a replay of the same request.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
            Location:
              $ref: "#/components/headers/WalletLocation"
            Idempotent-Replayed:
              $ref: "#/components/headers/IdempotentReplayed"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Wallet"
              examples:
                created:
                  value:
                    id: 1080986a-b3b8-458c-a9cb-855f77f0189a
                    external_id: order-48291
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    address: tb1p4qhjn9zdvkux4e44uhx8tc55attvtyu358kutcqkudyccelu0wasjpkd5c
                    asset_ids:
                      - 311d52dc-f56b-40b3-b77d-b68fab806e29
                    created_at: "2026-07-11T20:00:00Z"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "415":
          $ref: "#/components/responses/UnsupportedMediaType"
        "422":
          $ref: "#/components/responses/ChainRuleRejected"
        "500":
          $ref: "#/components/responses/InternalError"
        "503":
          $ref: "#/components/responses/ServiceUnavailable"
  /wallets/{id}:
    get:
      operationId: getWallet
      tags:
        - Wallets
      summary: Get customer address
      description: |
        Reads an address `createWallet` answered.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "200":
          description: The customer address as it is now.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Wallet"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /balances:
    get:
      operationId: listBalances
      tags:
        - Balances
      summary: List balances
      description: |
        Returns one balance per asset on one network, for the whole install.
        Payouts draw on these balances and leave from your treasury.

        There is no balance per customer address: payouts and their fees are
        held against the whole install, never one address. To follow one
        address, call `listTransactions` with its `wallet_id`.

        Every asset a customer address accepts, or the ledger holds, is listed,
        with zeroes where nothing moved. Rows sort by `asset_id`; the list is
        complete, not paged. This call reads only the ledger, never a node.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - name: network
          in: query
          required: true
          description: |
            A network's `code`, in any case, or its `id`, from `listNetworks`. One
            that names no network of this install answers `400` with
            `error.field`.
          schema:
            type: string
            minLength: 1
            maxLength: 100
          example: tron
      responses:
        "200":
          description: Every balance on the network.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProjectBalances"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
  /transactions:
    get:
      operationId: listTransactions
      tags:
        - Transactions
      summary: List transactions
      description: |
        Returns your install's transactions on chain, the most recently
        recorded first (`created_at`): payments, payouts and sweeps.
        Transactions found by history sync and by the live scanner form one
        list, so a history read records older transactions after newer ones;
        `inclusion.position` gives their order on chain. Confirmation progress
        matches `getTransaction`.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/Cursor"
        - $ref: "#/components/parameters/Limit"
        - name: wallet_id
          in: query
          required: false
          description: An unknown one answers `400` with `error.field`.
          schema:
            type: string
            format: uuid
        - $ref: "#/components/parameters/Network"
        - name: asset
          in: query
          required: false
          description: |
            An asset's `id`, or its `code` in any case, read within `network`
            when the request names one. A code that names no asset, or more than
            one (USDT on two networks, a token and its bridged copy), answers
            `400` with `error.field`, the candidates' ids in its message.
          schema:
            type: string
            minLength: 1
            maxLength: 100
          example: usdt
        - name: source
          in: query
          required: false
          description: |
            `deposit` matches every transaction that moved money at a customer
            address, sweeps included.
          schema:
            $ref: "#/components/schemas/TransactionSource"
        - name: status
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/TransactionStatus"
        - name: tx_hash
          in: query
          required: false
          description: The hash as `tx_hash` spells it. On XRPL that is the 64 uppercase hex characters XRPL nodes and explorers name it by, with no `0x`.
          schema:
            type: string
            minLength: 1
            maxLength: 512
        - name: created_from
          in: query
          required: false
          description: Inclusive RFC 3339 lower time boundary.
          schema:
            type: string
            format: date-time
        - name: created_to
          in: query
          required: false
          description: Exclusive RFC 3339 upper time boundary.
          schema:
            type: string
            format: date-time
        - name: scanner_stale
          in: query
          required: false
          schema:
            type: boolean
      responses:
        "200":
          description: One page of transactions, the most recently recorded first.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TransactionPage"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
  /transactions/{id}:
    get:
      operationId: getTransaction
      tags:
        - Transactions
      summary: Get transaction
      description: |
        Returns one transaction, in the same shape as `listTransactions`.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "200":
          description: The transaction as it is now.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Transaction"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /payouts:
    post:
      operationId: createPayout
      tags:
        - Payouts
      summary: Create payout
      description: |
        Queues a payout from your treasury. `202` means the payout is stored,
        not sent: follow it with `getPayout` or its `payout.*` events.

        `available` in `listBalances` must cover the amount, and the native
        asset's `available` the network fee. While `spendable` is `true`, a
        payout it does not cover fails with `insufficient_balance`, and nothing
        is sent. One it covers but the treasury cannot fund yet stays `queued`,
        spending no attempt, with `waiting_reason` `treasury_underfunded`,
        until the treasury can fund it. While `spendable` is `false` because a
        reorg is being resolved, the payout waits with `reorg_in_progress`;
        while the network's scanner has stopped (stale, halted or failing) or
        is at least its confirmation count behind, or a restored database's
        recovery waits for the operator, with `network_unavailable`.
        `getPayout` names every other wait.

        On native XRP and SOL, a payout that reaches into the treasury's
        reserve is not refused: it waits like one the treasury cannot fund. On
        EVM and Bitcoin the fee is priced after the claim: a payout whose fee
        `available` cannot cover may first wait with `treasury_underfunded`,
        then fails with `insufficient_balance` once the treasury can fund it.
        An XRPL issued-currency payout whose treasury trust line refuses to
        send for more than its balance, such as one its issuer froze, does not
        wait: it fails at once with the refusal as `failure.code`, for example
        `trust_line_is_frozen_by_the_issuer`. So does one of a currency whose
        issuer set Global Freeze (`issuer_global_freeze`) or charges a
        transfer fee (`issuer_transfer_fee_unsupported`), or whose issuer's
        NoRipple on both trust lines stops the payment (`issuer_blocks_rippling`).

        On Solana, XRPL and Bitcoin the network's node runs each payout before
        it is signed. One the node would refuse fails at once with
        `node_refuses_the_transfer`, unsigned and paying no fee. On XRPL a
        refusal about the destination fails with a code that names it instead:
        `destination_account_below_reserve` when the destination has no
        account and the payout is less than the network's base reserve, which
        a payment that creates an account must carry (1 XRP on mainnet when
        this was written), `destination_account_not_found`,
        `destination_tag_required`, or `destination_refuses_the_sender` when
        the destination takes payments only from senders it authorized. A Bitcoin
        payout below its destination's dust limit is refused here with `422`
        and `amount_below_dust_limit`, since no node relays such an output.
        An amount above what one transfer of the asset can carry (64 bits of
        base units for BTC, XRP, TRX and Solana assets, 256 bits for EVM and
        TRC-20 tokens) is refused with `400` and `invalid_request`.

        On Tron and EVM each token payout is simulated before it is signed.
        One the token refuses, as under its issuer's blacklist or pause, fails
        at once, unsigned and paying no fee: `token_refuses_the_transfer` when
        the token refuses this destination or amount, and
        `token_refuses_the_treasury` when it refuses every transfer from the
        treasury.

        A queued payout that can never be paid, one its lane set aside or one
        requested more than an hour ago, may be failed by an operator with
        `failed_by_operator`. Nothing was sent, and the amount and fee are
        available again. So may a Bitcoin payout one of whose coins another
        transaction spent, which none of its signed versions can then pay,
        with `coins_spent_elsewhere`.

        `external_id`, your own reference for the payout, makes a retry safe
        at any age: every payout keeps it for good, so a repeat with the same
        `external_id` and body returns the first response, with
        `Idempotent-Replayed`, however late it comes and whatever its key.
        With another asset, amount, destination or `fee_policy` it answers
        `409` with `resource_conflict`, and nothing is queued.
      x-required-scopes:
        - payouts:write
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/PayoutIdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreatePayoutRequest"
      responses:
        "202":
          description: The payout is queued, or this is a replay of the same request.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
            Location:
              $ref: "#/components/headers/PayoutLocation"
            Idempotent-Replayed:
              $ref: "#/components/headers/IdempotentReplayed"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Payout"
              examples:
                queued:
                  value:
                    id: c17401b0-2256-438c-b9fd-4b860c9216a7
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    source: treasury
                    asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    destination:
                      type: address
                      address: TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA
                      tag: null
                      memo: null
                    amount: "125.5"
                    fee_policy: normal
                    external_id: payout-48291
                    status: queued
                    waiting_reason: null
                    chain_transaction_id: null
                    tx_hash: null
                    transaction: null
                    failure: null
                    created_at: "2026-07-11T20:05:00Z"
                    updated_at: "2026-07-11T20:05:00Z"
                    completed_at: null
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "415":
          $ref: "#/components/responses/UnsupportedMediaType"
        "422":
          $ref: "#/components/responses/ChainRuleRejected"
        "500":
          $ref: "#/components/responses/InternalError"
  /payouts/{id}:
    get:
      operationId: getPayout
      tags:
        - Payouts
      summary: Get payout
      description: |
        Returns a payout with its status, its transaction once one is linked,
        and why it failed or why it waits.
      x-required-scopes:
        - ledger:read
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "200":
          description: The payout as it is now.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Payout"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-endpoints:
    post:
      operationId: registerWebhookEndpoint
      tags:
        - Webhooks
      summary: Register webhook endpoint
      description: |
        Returns the new endpoint and its signing `secret`. Only this call and
        `rotateWebhookEndpointSecret` return a secret: the install derives it
        and never stores it. Store it before you handle the response.

        `events` lists the event types the endpoint receives; left out or
        `null`, it receives every type, one a later release adds included. A
        list never grows by itself: a type added later reaches only endpoints
        that receive every type.

        The URL of an active endpoint again answers `200` with that endpoint
        and no secret, whichever key sends it, and sets the `description` and
        `events` the body sends; what it leaves out keeps its value. Another
        spelling of it is the same URL too: another case of the host, a
        trailing dot on it, `:443` (`:80` over `http`), an escaped letter or
        an empty `?`; `url` returns the one spelling the install stores. The
        URL of a disabled endpoint registers a new endpoint, with its own `id`
        and `secret`. To replace a lost secret, call
        `rotateWebhookEndpointSecret`. The call takes no `Idempotency-Key`,
        because a stored response would keep the secret. The install records
        which key registered an endpoint and which changed it.

        The URL must be `http` or `https`, with no credentials and no fragment.
        Over `http` the event bodies cross the network in clear text; the
        signature still proves them. At most 50 endpoints can be active; one
        more answers `409` with `webhook_endpoint_limit_reached`, even when two
        calls race.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RegisterWebhookEndpointRequest"
      responses:
        "200":
          description: The URL's active endpoint, with what the body set; no secret.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
        "201":
          description: The endpoint is registered; the body carries its signing secret.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpointWithSecret"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "409":
          $ref: "#/components/responses/Conflict"
        "415":
          $ref: "#/components/responses/UnsupportedMediaType"
        "500":
          $ref: "#/components/responses/InternalError"
    get:
      operationId: listWebhookEndpoints
      tags:
        - Webhooks
      summary: List webhook endpoints
      description: |
        Never returns a secret. A disabled endpoint stays listed: endpoints
        are never deleted.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/Cursor"
        - $ref: "#/components/parameters/Limit"
        - name: status
          in: query
          required: false
          description: Only active or only disabled endpoints.
          schema:
            $ref: "#/components/schemas/WebhookEndpointStatus"
      responses:
        "200":
          description: One page of endpoints, newest first.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpointPage"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-endpoints/{id}:
    post:
      operationId: updateWebhookEndpoint
      tags:
        - Webhooks
      summary: Update webhook endpoint
      description: |
        Sets the `description` and `events` the body sends; what it leaves out
        keeps its value, and `description` `""` clears it. A body that sends
        neither answers `400`. The endpoint's URL and secret stay as they are.
        A disabled endpoint answers `409` with `webhook_endpoint_disabled`.
        The install records which key made each change.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateWebhookEndpointRequest"
      responses:
        "200":
          description: The endpoint as it is now.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "415":
          $ref: "#/components/responses/UnsupportedMediaType"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-endpoints/{id}/disable:
    post:
      operationId: disableWebhookEndpoint
      tags:
        - Webhooks
      summary: Disable webhook endpoint
      description: |
        Stops delivery to one endpoint. It takes no body. Endpoints are never
        deleted, so the record of what was sent to them survives, and
        disabling again succeeds. A disabled endpoint stays disabled: to
        receive events at its URL again, register the URL, which makes a new
        endpoint.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "200":
          description: The endpoint is disabled.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpoint"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-endpoints/{id}/rotate-secret:
    post:
      operationId: rotateWebhookEndpointSecret
      tags:
        - Webhooks
      summary: Rotate endpoint secret
      description: |
        Events are signed with the new secret at once, so deploy it before the
        next event arrives; only a delivery already on its way still carries
        the old signature. Only this endpoint changes. This is also how to
        replace a lost secret: no call returns an endpoint's current one. A
        disabled endpoint answers `409` with `webhook_endpoint_disabled`.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "200":
          description: The endpoint with its new secret.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookEndpointWithSecret"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-endpoints/{id}/test:
    post:
      operationId: sendWebhookTestEvent
      tags:
        - Webhooks
      summary: Send test event
      description: |
        Sends one `endpoint.test` event to this endpoint, whatever its
        `events`, signed and retried like every event, so you can check your
        signature code and your answer before a payment arrives. It answers
        with the new delivery, which `listWebhookDeliveries` and
        `getWebhookDelivery` show too. A disabled endpoint answers `409` with
        `webhook_endpoint_disabled`.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "201":
          description: The test event's delivery, pending.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookDelivery"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-deliveries:
    get:
      operationId: listWebhookDeliveries
      tags:
        - Webhooks
      summary: List webhook deliveries
      description: |
        One row per event and endpoint, newest first. It tells an event never
        sent apart from one your endpoint refused until the attempts ran out.

        `status=failed` is the dead-letter list: those deliveries used every
        attempt, 12, and are never retried on their own. Replay one with
        `replayWebhookDelivery`.

        A delivery is removed 30 days after it ends, so the list holds what is
        pending, being sent, or ended in the last 30 days. A dead letter whose
        replay is still listed stays as long as that replay.

        Your endpoint's response body is never stored: `last_status_code` and
        `last_error_code` are all that is kept. No signing material appears.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/Cursor"
        - $ref: "#/components/parameters/Limit"
        - name: endpoint_id
          in: query
          required: false
          description: Restrict to one destination; an unknown one answers `400` with `error.field`.
          schema:
            type: string
            format: uuid
        - name: event_id
          in: query
          required: false
          description: |
            One event's deliveries, by the `id` in its body and its
            `webhook-id` header; an unknown one answers `400` with
            `error.field`.
          schema:
            type: string
            format: uuid
        - name: event_type
          in: query
          required: false
          description: One event type's deliveries; a type no endpoint receives answers `400` with `error.field`.
          schema:
            $ref: "#/components/schemas/WebhookDeliveryEventType"
        - name: status
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/WebhookDeliveryStatus"
      responses:
        "200":
          description: One page of deliveries, newest first.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookDeliveryPage"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-deliveries/{id}:
    get:
      operationId: getWebhookDelivery
      tags:
        - Webhooks
      summary: Get webhook delivery
      description: |
        One delivery with its event's body exactly as each attempt sends it.
        Each attempt signs that body anew, so no signature is shown. A
        delivery that ended more than 30 days ago is removed and answers
        `404`.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "200":
          description: The delivery and the event it sends.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookDeliveryWithEvent"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
  /webhook-deliveries/{id}/replay:
    post:
      operationId: replayWebhookDelivery
      tags:
        - Webhooks
      summary: Replay webhook delivery
      description: |
        Sends the same event to the same endpoint again, as a new delivery
        whose `replayed_from_delivery_id` names this one. The failed delivery
        is left as it was.

        Calling it twice is safe: the first call answers `201` with the
        replay, the second `200` with the same delivery, and sends nothing
        more.

        Only a `failed` delivery can be replayed: a pending, delivering,
        delivered or superseded one answers `409` with
        `webhook_delivery_not_failed`. A disabled endpoint answers `409` with
        `webhook_endpoint_disabled`: register its URL again instead. A
        delivery that ended more than 30 days ago is removed, and replaying it
        answers `404`.
      x-required-scopes:
        - webhooks:manage
      parameters:
        - $ref: "#/components/parameters/XRequestID"
        - $ref: "#/components/parameters/ResourceID"
      responses:
        "200":
          description: The replay an earlier call made, as it is now.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookDelivery"
        "201":
          description: The replay this call made.
          headers:
            X-Request-ID:
              $ref: "#/components/headers/XRequestID"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookDelivery"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/Conflict"
        "500":
          $ref: "#/components/responses/InternalError"
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Fiatless API key
      description: |
        Your secret API key. Its scopes decide which calls it can make.
  parameters:
    XRequestID:
      name: X-Request-ID
      in: header
      required: false
      description: |
        Your ID for this call, echoed in the response. One longer than 128
        characters, or with characters other than letters, digits, `.`, `_` and
        `-`, is replaced with a generated one.
      schema:
        type: string
        minLength: 1
        maxLength: 128
        pattern: ^[A-Za-z0-9._-]+$
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: true
      description: |
        Your key for this call, unique among this call's keys: `createWallet`
        and `createPayout` keep separate keys, so the same text sent to each
        is two keys. The same key with the same body returns the first response.
        With another body it answers `409` with `idempotency_key_conflict`. The
        install keeps a key for 24 hours; after that it is free again.
      schema:
        type: string
        minLength: 1
        maxLength: 255
        pattern: ^[!-~]+$
    PayoutIdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      description: |
        Optional: the payout's `external_id` already makes a retry safe at any
        age. A key sent works as on `createWallet`: the same key with the same
        body returns the first response, another body answers `409` with
        `idempotency_key_conflict`, and the install keeps it for 24 hours.
      schema:
        type: string
        minLength: 1
        maxLength: 255
        pattern: ^[!-~]+$
    Cursor:
      name: cursor
      in: query
      required: false
      description: |
        The previous page's `next_cursor`, passed back as received. Send
        the same filters with it; `limit` may change between pages. A cursor
        never expires. A malformed one answers `400` with `invalid_request`.
      schema:
        type: string
        minLength: 1
        maxLength: 128
    Limit:
      name: limit
      in: query
      required: false
      description: The most rows to return.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 50
    ResourceID:
      name: id
      in: path
      required: true
      description: The resource's `id`.
      schema:
        type: string
        format: uuid
    Network:
      name: network
      in: query
      required: false
      description: |
        A network's `code`, in any case, or its `id`, from `listNetworks`. A
        code names the network this install runs for it, so the same code works
        on a testnet install and a mainnet one. One that names no network of
        this install answers `400` with `error.field`.
      schema:
        type: string
        minLength: 1
        maxLength: 100
      example: tron
  headers:
    XRequestID:
      description: This call's ID, yours when valid, for logs and support.
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 128
        pattern: ^[A-Za-z0-9._-]+$
    IdempotentReplayed:
      description: "`true` when the response is the first response to this key, or to this payout's `external_id`."
      required: false
      schema:
        type: boolean
    WalletLocation:
      description: Where to read the queued customer address.
      required: true
      schema:
        type: string
        example: /api/v1/wallets/1080986a-b3b8-458c-a9cb-855f77f0189a
    PayoutLocation:
      description: Where to read the queued payout.
      required: true
      schema:
        type: string
        example: /api/v1/payouts/c17401b0-2256-438c-b9fd-4b860c9216a7
  responses:
    BadRequest:
      description: |
        A malformed value or query string, an unknown field or query
        parameter, a body member sent twice or matching a field only in
        another case, a bad cursor, or no `Idempotency-Key` on a call that
        needs one. The codes are `invalid_request` and
        `idempotency_key_required`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    Unauthorized:
      description: No API key, or one the install does not know. The code is `authentication_required`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
        WWW-Authenticate:
          description: Bearer authentication challenge.
          required: true
          schema:
            type: string
            const: Bearer realm="fiatless"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    Forbidden:
      description: The key lacks the scope this call needs. The code is `permission_denied`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    NotFound:
      description: The resource does not exist. The code is `resource_not_found`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    Conflict:
      description: |
        The key was used for another request, or the resource's state refuses
        the call, as for a payout `external_id` already used with another
        body. The codes are `idempotency_key_conflict` and
        `resource_conflict`, and on the webhook calls
        `webhook_endpoint_limit_reached`, `webhook_endpoint_disabled` and
        `webhook_delivery_not_failed`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    ChainRuleRejected:
      description: |
        The asset cannot be used for this call, the amount has more
        precision than the asset, or a Bitcoin payout is below its
        destination's dust limit. The codes are `asset_unavailable`,
        `invalid_amount_precision` and `amount_below_dust_limit`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    UnsupportedMediaType:
      description: The body was not sent as `application/json`. The code is `unsupported_media_type`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    RatesUnavailable:
      description: |
        Stored rates could not be read. The code is `rates_unavailable`. A coin
        with no fresh rate is not this error: it comes back in a `200`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    ServiceUnavailable:
      description: |
        The network's node did not answer, or what the call reads is
        unavailable; try again later. The code is `service_unavailable`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    InternalError:
      description: The install failed; the details stay in its logs. The code is `internal_error`.
      headers:
        X-Request-ID:
          $ref: "#/components/headers/XRequestID"
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ErrorEnvelope"
    Delivered:
      description: Any 2xx answer marks the delivery delivered.
  schemas:
    RateCoinCode:
      type: string
      minLength: 1
      maxLength: 128
      description: |
        A coin code as stored. A request may send it in any case. At most 128
        UTF-8 bytes, with no whitespace, control characters or commas.
      examples:
        - btc
        - trx
        - ltc
    RateProvider:
      type: string
      enum:
        - kraken
        - bitfinex
        - bitstamp
        - gemini
        - btse
    RateObservation:
      type: object
      additionalProperties: false
      required:
        - code
        - provider
        - instrument
        - price_usd
        - source_updated_at
        - received_at
      properties:
        code:
          $ref: "#/components/schemas/RateCoinCode"
        provider:
          $ref: "#/components/schemas/RateProvider"
        instrument:
          type: string
          maxLength: 64
          description: Explicit provider-specific market or coin identifier.
        price_usd:
          $ref: "#/components/schemas/ExactAmountString"
          description: Positive USD value per coin, preserved as an exact decimal string.
        source_updated_at:
          type:
            - string
            - "null"
          format: date-time
          description: |
            When the market traded, as the provider says; every provider here
            supplies its latest trade's time. Null only for a source that
            supplies none, which may back a degraded price but no fresh one;
            receipt time is never substituted.
        received_at:
          type: string
          format: date-time
          description: When Fiatless received this provider observation.
    ReferenceRate:
      type: object
      additionalProperties: false
      required:
        - code
        - price_usd
        - status
        - sources
        - as_of
        - expires_at
        - observations
      properties:
        code:
          $ref: "#/components/schemas/RateCoinCode"
        price_usd:
          oneOf:
            - $ref: "#/components/schemas/ExactAmountString"
            - type: "null"
          description: |
            Positive exact decimal string for fresh or degraded rates. Null for
            disputed, stale or unavailable rates; never synthesized as zero.
        status:
          type: string
          enum:
            - fresh
            - degraded
            - disputed
            - stale
            - unavailable
          description: |
            fresh: at least two recent timestamped providers agree within policy.
            degraded: a single recent source. disputed: recent timestamped
            sources disagree beyond policy. stale: observations exist but have
            expired. unavailable: no valid observation. Quality and expiry are
            evaluated on every read.
        sources:
          type: array
          maxItems: 5
          uniqueItems: true
          items:
            $ref: "#/components/schemas/RateProvider"
          description: Providers contributing to price; excludes stale or rejected outliers.
        as_of:
          type:
            - string
            - "null"
          format: date-time
          description: Oldest contributing source timestamp; null for an untimed display price or no price.
        expires_at:
          type:
            - string
            - "null"
          format: date-time
          description: |
            When the oldest contributing observation expires under the install's
            rate policy. Null when there is no usable price. Averaging
            observations never renews their age.
        observations:
          type: array
          maxItems: 5
          items:
            $ref: "#/components/schemas/RateObservation"
          description: Latest valid stored observation per provider, including stale or outlying evidence.
    RateProviderStatus:
      type: object
      additionalProperties: false
      required:
        - provider
        - last_attempt_at
        - last_success_at
        - next_poll_at
        - last_error_code
        - consecutive_failures
      properties:
        provider:
          $ref: "#/components/schemas/RateProvider"
        last_attempt_at:
          type:
            - string
            - "null"
          format: date-time
        last_success_at:
          type:
            - string
            - "null"
          format: date-time
          description: Successful collection time, not proof that every coin has a fresh price.
        next_poll_at:
          type:
            - string
            - "null"
          format: date-time
        last_error_code:
          type:
            - string
            - "null"
          description: Safe provider failure classification; null when no error is recorded.
        consecutive_failures:
          type: integer
          minimum: 0
    RateSourceState:
      type: object
      additionalProperties: false
      required:
        - code
        - provider
        - enabled
        - reason
        - observed_price
        - peer_median
        - peer_count
        - deviation_bps
        - changed_at
        - changed_by
      properties:
        code:
          $ref: "#/components/schemas/RateCoinCode"
        provider:
          $ref: "#/components/schemas/RateProvider"
        enabled:
          type: boolean
          description: |
            False means this pair contributes to no status, quorum, price or
            peer median. Its observations are still collected and still listed.
        reason:
          type:
            - string
            - "null"
          maxLength: 200
          description: |
            `outlier` when the collector suspended it, `recovered` when the
            collector returned it after its price stayed within half the allowed
            deviation of its peers for 30 minutes; free operator text when a
            person decided. Null for a pair whose state has never been changed.
        observed_price:
          oneOf:
            - $ref: "#/components/schemas/ExactAmountString"
            - type: "null"
          description: The price this source reported when it was suspended. Null unless a collector suspension stands.
        peer_median:
          oneOf:
            - $ref: "#/components/schemas/ExactAmountString"
            - type: "null"
          description: The median its peers agreed on at that moment. Null unless a collector suspension stands.
        peer_count:
          type:
            - integer
            - "null"
          minimum: 3
          description: How many fresh sources, this one included, that median was taken over. Null unless a collector suspension stands.
        deviation_bps:
          type:
            - integer
            - "null"
          minimum: 0
          description: Distance from that median in basis points. Null unless a collector suspension stands.
        changed_at:
          type:
            - string
            - "null"
          format: date-time
          description: Database time of the last state change; null for a pair never changed.
        changed_by:
          type:
            - string
            - "null"
          maxLength: 128
          description: |
            `collector` for an automatic suspension or return,
            `operator:<api-key-id>` for a person's decision. Null for a pair
            never changed.
    RatesEnvelope:
      type: object
      additionalProperties: false
      required:
        - data
        - providers
        - sources
        - collection_enabled
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ReferenceRate"
        providers:
          type: array
          maxItems: 5
          items:
            $ref: "#/components/schemas/RateProviderStatus"
        sources:
          type: array
          description: |
            One entry per mapped (coin, provider) pair, whatever its state, and
            never filtered by `codes`: an operator clearing a suspension must be
            able to find it without first guessing its coin.
          items:
            $ref: "#/components/schemas/RateSourceState"
        collection_enabled:
          type: boolean
          description: Whether this install collects rates; stored rates stay readable when it does not.
    Network:
      type: object
      additionalProperties: false
      required:
        - id
        - code
        - family
        - name
        - native_symbol
        - testnet
        - explorer_tx_url
        - confirmations
        - address_type
      properties:
        id:
          type: string
          format: uuid
        code:
          type: string
          minLength: 1
          description: |
            What every request that takes a network takes in place of its `id`:
            `tron`, `ethereum`, `bsc`, `bitcoin`, `solana`, `xrpl`, or
            `evm-<chain id>` for an EVM network the operator added. An install
            runs one network of each code, so the code is the same on a testnet
            install and a mainnet one.
          examples:
            - tron
            - ethereum
            - bsc
            - bitcoin
            - solana
            - xrpl
            - evm-137
        family:
          type: string
          enum:
            - evm
            - tron
            - bitcoin
            - solana
            - xrpl
          description: |
            The family whose rules the network follows: its address format, its
            tokens, and what a payout's `destination` may carry, such as a `tag`
            on `xrpl` and a `wallet_owner` for a token on `solana`.
        name:
          type: string
          minLength: 1
          description: The network's name for people, a test network's own name included.
          examples:
            - TRON Nile
            - Ethereum
            - Bitcoin Signet
        native_symbol:
          type: string
          minLength: 1
          description: The symbol of the coin the network's fees are paid in.
          example: TRX
        testnet:
          type: boolean
          description: True on a test network, whose coins have no value.
        explorer_tx_url:
          type:
            - string
            - "null"
          description: |
            A transaction's page on a block explorer, `{tx_hash}` standing for
            the transaction's `tx_hash`; null when the operator set none.
          example: https://nile.tronscan.org/#/transaction/{tx_hash}
        confirmations:
          $ref: "#/components/schemas/NetworkConfirmations"
        address_type:
          allOf:
            - $ref: "#/components/schemas/AddressType"
          description: |
            The type of every customer address this install issues on the
            network: on Bitcoin the install's one type, `p2tr` by default.
    NetworkConfirmations:
      type: object
      additionalProperties: false
      required:
        - required
      properties:
        required:
          type: integer
          minimum: 1
          description: |
            The blocks that must include or follow a payment before it is
            confirmed and credited; a transaction's `confirmations.required`.
          example: 19
    NetworkPage:
      type: object
      additionalProperties: false
      required:
        - data
        - next_cursor
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Network"
        next_cursor:
          type:
            - string
            - "null"
          description: Pass it back as `cursor` for the next page; null on the last page.
    AssetStandard:
      type: string
      enum:
        - native
        - evm_erc20
        - tron_trc20
        - solana_spl
        - xrpl_issued
    Asset:
      type: object
      additionalProperties: false
      required:
        - id
        - code
        - network
        - network_id
        - standard
        - decimals
        - onchain_identity
        - name
        - symbol
        - logo_url
        - capabilities
      properties:
        id:
          type: string
          format: uuid
          description: The asset's identity; two assets of one network can share a `code`.
        code:
          type: string
          minLength: 1
          description: |
            The coin's code, the same on every network that carries it, and the
            code `listRates` keys its rate by. Requests compare it without
            regard to case.
          example: usdt
        network:
          type: string
          minLength: 1
          description: The `code` of the asset's network.
          example: tron
        network_id:
          type: string
          format: uuid
        standard:
          $ref: "#/components/schemas/AssetStandard"
        symbol:
          type: string
          minLength: 1
        name:
          type: string
          minLength: 1
          example: Tether USD
        logo_url:
          type:
            - string
            - "null"
          description: A path on the install's own origin, such as `/static/btc.svg`; null when the coin has no logo.
        decimals:
          type:
            - integer
            - "null"
          minimum: 0
          maximum: 255
          description: |
            The decimal places an amount of the asset may have. Null only for
            an XRPL issued currency, whose amounts are decimals of their own.
        onchain_identity:
          oneOf:
            - $ref: "#/components/schemas/AssetIdentity"
            - type: "null"
          description: Null for a network's native coin.
        capabilities:
          $ref: "#/components/schemas/AssetCapabilities"
    AssetIdentity:
      description: The token on chain, by its `standard`.
      oneOf:
        - type: object
          additionalProperties: false
          required:
            - contract_address
          description: An `evm_erc20` or `tron_trc20` token's contract.
          properties:
            contract_address:
              type: string
              minLength: 1
        - type: object
          additionalProperties: false
          required:
            - token_program_id
            - mint
          description: A `solana_spl` token's mint and the program that owns it.
          properties:
            token_program_id:
              type: string
              minLength: 1
            mint:
              type: string
              minLength: 1
        - type: object
          additionalProperties: false
          required:
            - currency
            - issuer
          description: An `xrpl_issued` currency and its issuer.
          properties:
            currency:
              type: string
              minLength: 1
            issuer:
              type: string
              minLength: 1
    AssetCapabilities:
      type: object
      additionalProperties: false
      description: What the asset can be used for now, on this install.
      required:
        - deposit
        - payout
      properties:
        deposit:
          type: boolean
          description: A payment of it to a customer address is credited.
        payout:
          type: boolean
          description: A payout can send it.
    AssetPage:
      type: object
      additionalProperties: false
      required:
        - data
        - next_cursor
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Asset"
        next_cursor:
          type:
            - string
            - "null"
          description: Pass it back as `cursor` for the next page; null on the last page.
    CreateWalletRequest:
      type: object
      additionalProperties: false
      required:
        - network
        - external_id
        - asset_ids
      properties:
        network:
          type: string
          minLength: 1
          maxLength: 100
          description: |
            The network's `code`, in any case, or its `id`, from `listNetworks`.
            A code is the network this install runs for it; one that names none
            answers `400` with `error.field`, an unknown `id` `404`. The address's
            `network_id` is the network's `id` either way, and a replay may name
            the network either way.
          examples:
            - bitcoin
            - 3a6a1d9d-e8ec-4808-a296-d6be30c8fdd3
        external_id:
          type: string
          minLength: 1
          maxLength: 255
          description: Your reference for the customer, unique per network. Control, format (such as bidirectional or zero-width) and line separator characters are refused.
        asset_ids:
          type: array
          uniqueItems: true
          minItems: 1
          maxItems: 100
          description: |
            The assets this address accepts; only these are credited. Each must
            have `capabilities.deposit` set on this network.
          items:
            type: string
            format: uuid
    AddressType:
      type: string
      enum:
        - p2sh
        - bech32
        - p2tr
        - evm_hex
        - tron_base58check
        - solana_base58
        - xrpl_classic
    Wallet:
      type: object
      additionalProperties: false
      required:
        - id
        - external_id
        - network_id
        - address
        - asset_ids
        - created_at
      properties:
        id:
          type: string
          format: uuid
        external_id:
          type: string
          minLength: 1
          maxLength: 255
        network_id:
          type: string
          format: uuid
        address:
          type: string
          minLength: 1
          description: The customer's address; its type is the network's `address_type`.
        asset_ids:
          type: array
          uniqueItems: true
          items:
            type: string
            format: uuid
        created_at:
          type: string
          format: date-time
    WalletPage:
      type: object
      additionalProperties: false
      required:
        - data
        - next_cursor
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Wallet"
        next_cursor:
          type:
            - string
            - "null"
          description: Pass it back as `cursor` for the next page; null on the last page.
    ProjectBalance:
      type: object
      additionalProperties: false
      required:
        - network_id
        - asset_id
        - confirmed
        - held
        - available
        - spendable
      properties:
        network_id:
          type: string
          format: uuid
          description: The network this balance is on.
        asset_id:
          type: string
          format: uuid
          description: The asset, within `network_id`.
        confirmed:
          allOf:
            - $ref: "#/components/schemas/SignedExactAmountString"
          description: "Confirmed money in minus money out, for the whole install: every customer address and the treasury together."
        held:
          allOf:
            - $ref: "#/components/schemas/ExactAmountString"
          description: Held by payouts and sweep fees in progress.
        available:
          allOf:
            - $ref: "#/components/schemas/ExactAmountString"
          description: "What payouts can use: `confirmed` minus `held`. For native XRP and SOL it also leaves out what the treasury must keep: the XRPL treasury's observed account reserve, or Solana's 890,880-lamport rent-exempt minimum. On XRP it also leaves out the base reserve that each deposit address paid in XRP keeps, since no sweep can move it. `0` while `spendable` is `false`."
        spendable:
          type: boolean
          description: "`false` while payouts cannot draw on this balance: before its first confirmed movement; while a reorganisation undoes a payout, or a sweep on any network but Bitcoin; while the network's scanner has stopped (stale, halted or failing) or is at least its confirmation count behind; while a database restore's recovery waits for the operator to accept it; or while `confirmed` minus `held` is below the treasury's floor. On XRPL it is also `false` until the treasury's reserve has been observed."
    ProjectBalances:
      type: object
      additionalProperties: false
      required:
        - network_id
        - balances
      properties:
        network_id:
          type: string
          format: uuid
          description: The network you asked for.
        balances:
          type: array
          description: Every balance on the network, sorted by `asset_id`; not a page.
          items:
            $ref: "#/components/schemas/ProjectBalance"
    TransactionAmount:
      type: object
      additionalProperties: false
      required:
        - asset_id
        - amount
      properties:
        asset_id:
          type: string
          format: uuid
          description: The asset, within the transaction's `network_id`.
        amount:
          allOf:
            - $ref: "#/components/schemas/SignedExactAmountString"
          description: |-
            The signed change to your install's funds in this asset: positive credits the install, negative debits it. A payment reads positive, a payout negative.
            A move between your own addresses, such as a sweep into the treasury, nets out. On an account-model chain it reads `0`; on a UTXO chain it reads minus the miner fee.
            A network fee recorded on its own is not in `amount`; it is `fee`. Summed over a page, `amount` moves `confirmed` by the same total, less the fees your install paid. `fee` does not say who paid it.
    TransactionWallet:
      type: object
      additionalProperties: false
      required:
        - wallet_id
        - external_id
        - amounts
      properties:
        wallet_id:
          type: string
          format: uuid
          description: The customer address, as `getWallet` reads it.
        external_id:
          type: string
          description: Your reference for the customer, as you sent it to `createWallet`.
        amounts:
          type: array
          description: What the customer was paid at this address, one row per asset, sorted by `asset_id`. Always above zero. The network fee is not included.
          items:
            type: object
            additionalProperties: false
            required:
              - asset_id
              - amount
            properties:
              asset_id:
                type: string
                format: uuid
                description: The asset, within the transaction's `network_id`.
              amount:
                allOf:
                  - $ref: "#/components/schemas/ExactAmountString"
                description: What this address received in this asset.
    TransactionSource:
      type: string
      enum:
        - deposit
        - withdrawal
        - sweep
        - manual
    TransactionStatus:
      type: string
      enum:
        - detected
        - confirming
        - confirmed
        - reverted
    Transaction:
      type: object
      additionalProperties: false
      required:
        - id
        - network_id
        - tx_hash
        - amounts
        - wallets
        - sources
        - status
        - inclusion
        - confirmations
        - fee
        - raw_fee
        - sender_address
        - recipient_address
        - confirmed_at
        - reverted_at
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        network_id:
          type: string
          format: uuid
        tx_hash:
          type: string
          minLength: 1
          maxLength: 512
        amounts:
          type: array
          description: |-
            What this transaction moved for your install, one signed row per asset, sorted by `asset_id`. It covers your customer addresses, plus the treasury's side of a sweep or payout, or of a move from a customer address into the treasury that your install did not make, by the same rule as the ledger behind `listBalances`.
            A payment shows its amount from detection on. The network fee is not included (see `fee`), except on Bitcoin, where a sweep's amounts include the fee its inputs paid. A reverted transaction, or a failed payout whose amount was released, adds nothing, and a payout whose transaction failed or moved none of its asset adds nothing, at the latest from the moment its transaction confirms. Empty when nothing your install owns moved.
          items:
            $ref: "#/components/schemas/TransactionAmount"
        wallets:
          type: array
          description: "The customers this transaction paid: one entry per customer address that received money from outside your install, sorted by `wallet_id`. A transaction sent by one of your own addresses pays no customer, even where it credits a customer address: a sweep, a gas top-up, or a payout from your treasury. A Bitcoin transaction names no sender, so one that spends from any of your own addresses pays no customer. A transaction anyone else sends pays no customer in an asset it takes, on balance, from one of your own addresses, such as a token issuer's transfer out of your treasury. Empty when the transaction paid no customer, and once it is reverted."
          items:
            $ref: "#/components/schemas/TransactionWallet"
        sources:
          type: array
          minItems: 1
          uniqueItems: true
          description: Every role this transaction plays for your install, in the order deposit, withdrawal, sweep, manual. A payout into one of your own customer addresses has two.
          items:
            $ref: "#/components/schemas/TransactionSource"
        status:
          $ref: "#/components/schemas/TransactionStatus"
        inclusion:
          oneOf:
            - $ref: "#/components/schemas/TransactionInclusion"
            - type: "null"
        confirmations:
          $ref: "#/components/schemas/Confirmation"
        fee:
          oneOf:
            - $ref: "#/components/schemas/ExactAmountString"
            - type: "null"
          description: The transaction's network fee, when it can be read as an amount.
        raw_fee:
          type:
            - string
            - "null"
          description: The fee as the chain reports it, when it cannot be read as an amount.
        sender_address:
          type:
            - string
            - "null"
        recipient_address:
          type:
            - string
            - "null"
        confirmed_at:
          type:
            - string
            - "null"
          format: date-time
        reverted_at:
          type:
            - string
            - "null"
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    TransactionPage:
      type: object
      additionalProperties: false
      required:
        - data
        - next_cursor
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Transaction"
        next_cursor:
          type:
            - string
            - "null"
          description: Pass it back as `cursor` for the next page; null on the last page.
    TransactionInclusion:
      type: object
      additionalProperties: false
      required:
        - position
        - hash
      properties:
        position:
          type:
            - integer
            - "null"
          minimum: 0
          description: Block height, Solana slot, or XRPL ledger index.
        hash:
          type:
            - string
            - "null"
          description: The hash of the block or ledger that holds the transaction, when known.
    CreatePayoutRequest:
      type: object
      additionalProperties: false
      required:
        - source
        - asset_id
        - amount
        - destination
        - fee_policy
        - external_id
      properties:
        source:
          $ref: "#/components/schemas/PayoutSource"
        asset_id:
          type: string
          format: uuid
          description: |
            The asset to pay, which also picks the network; there is no
            `network_id`. One that is unknown or not active answers `422` with
            `asset_unavailable`.
        destination:
          $ref: "#/components/schemas/PayoutDestinationRequest"
        amount:
          $ref: "#/components/schemas/PositiveExactAmountString"
        fee_policy:
          $ref: "#/components/schemas/FeePolicy"
        external_id:
          type: string
          minLength: 1
          maxLength: 255
          description: |
            Your reference for the payout, unique across the install for good.
            A repeat with the same `external_id` and body returns the first
            response at any age; with another body it answers `409`. Control,
            format (such as bidirectional or zero-width) and line separator
            characters are refused.
    PayoutSource:
      type: string
      enum:
        - treasury
      description: Every payout leaves from your treasury.
    FeePolicy:
      type: string
      enum:
        - slow
        - normal
        - fast
    PayoutDestinationRequest:
      type: object
      additionalProperties: false
      required:
        - address
      properties:
        type:
          type: string
          enum:
            - address
            - wallet_owner
          default: address
          description: |
            `wallet_owner` for a Solana token payout, `address` for everything
            else. Send an owner's address, never a token account: the token
            account is derived from the owner.
        address:
          type: string
          minLength: 1
          maxLength: 512
          description: |
            The receiver's address, in the network's own format: Bitcoin P2PKH,
            P2SH, Bech32 or P2TR; EIP-55 checksummed on EVM chains; TRON
            Base58Check; a Solana public key; an XRPL classic address. Known
            burn addresses are refused. Two spellings of one address are the
            same request.

            For a Solana token payout, send the owner's address. Its token
            account is derived and checked on chain before signing.
        tag:
          type:
            - integer
            - "null"
          minimum: 0
          maximum: 4294967295
          description: The XRPL destination tag, when the receiver needs one.
        memo:
          type:
            - string
            - "null"
          description: Refused unless null; no network takes a memo yet.
    PayoutDestination:
      type: object
      additionalProperties: false
      required:
        - address
        - type
        - tag
        - memo
      properties:
        address:
          type: string
          minLength: 1
          maxLength: 512
        type:
          type: string
          enum:
            - address
            - wallet_owner
        tag:
          type:
            - integer
            - "null"
          minimum: 0
          maximum: 4294967295
        memo:
          type:
            - string
            - "null"
          minLength: 1
          maxLength: 1024
    PayoutStatus:
      type: string
      description: The payout's status. While a reorganisation undoes its transaction it reads `reorged`.
      enum:
        - queued
        - signing
        - broadcast
        - confirming
        - confirmed
        - failed
        - reorged
    PayoutWaitingReason:
      type: string
      enum:
        - treasury_underfunded
        - treasury_busy
        - treasury_nonce_drift
        - network_unavailable
        - reorg_in_progress
        - set_aside
        - retry_scheduled
      description: "Why a `queued` payout waits; each ends without you, and only `retry_scheduled` follows an attempt that counted. `treasury_underfunded`: your balance covers the payout, but the treasury cannot fund it yet. It stays `queued` until the treasury can. `treasury_busy`: on EVM the treasury sends one transaction at a time, and this payout waits for an earlier payout to confirm or for a sweep's gas top-up. `treasury_nonce_drift`: on EVM the treasury sent a transaction this gateway did not sign, or the network's node reports the treasury's transactions out of date, and payouts wait until that transaction is final, up to about 26 minutes on Ethereum, or until the node reports them correctly again. `network_unavailable`: the gateway cannot use the network now. Its scanner is behind its node or stopped, its node did not answer or will not take the payout yet, or the network fee is above the gateway's ceiling on EVM or Tron, or above the fee it pays on XRPL. On XRPL it also waits so while its node's validated ledger has not moved since the payout was signed. A stop, or a slow database, that cuts the payout's signing short also leaves it here until its next attempt. `reorg_in_progress`: a reorg is being resolved on the network, and `spendable` is `false` meanwhile. `set_aside`: the payout failed the same way several times and waits for an operator, who returns it to the line or fails it with `failed_by_operator`. It also waits so when a treasury transaction the gateway did not send already moved the payout's amount of its asset to its destination: the operator fails it, so it is not paid twice, or releases it once that transaction proves to pay something else. `retry_scheduled`: an attempt ended without paying, and the payout is tried again shortly. Each such attempt counts, and when none is left it fails with `failure.code` `attempts_exhausted`. While the operator recovers the gateway's database after a restore, or holds every payout's send for a planned backup, a queued payout waits as `network_unavailable` until it ends."
    Payout:
      type: object
      additionalProperties: false
      description: A payout from your treasury. While it waits in `queued`, `waiting_reason` says why.
      required:
        - id
        - network_id
        - asset_id
        - source
        - amount
        - destination
        - fee_policy
        - external_id
        - status
        - waiting_reason
        - chain_transaction_id
        - tx_hash
        - transaction
        - failure
        - created_at
        - updated_at
        - completed_at
      properties:
        id:
          type: string
          format: uuid
        network_id:
          type: string
          format: uuid
          description: The network of `asset_id`.
        source:
          $ref: "#/components/schemas/PayoutSource"
        asset_id:
          type: string
          format: uuid
        destination:
          $ref: "#/components/schemas/PayoutDestination"
        amount:
          $ref: "#/components/schemas/ExactAmountString"
        fee_policy:
          $ref: "#/components/schemas/FeePolicy"
        external_id:
          type:
            - string
            - "null"
          description: Your reference for the payout, as you sent it; null without one.
        status:
          $ref: "#/components/schemas/PayoutStatus"
        waiting_reason:
          oneOf:
            - $ref: "#/components/schemas/PayoutWaitingReason"
            - type: "null"
          description: Why a `queued` payout waits; null while nothing holds it, in any other status, and in the `202` of `createPayout`.
        chain_transaction_id:
          type:
            - string
            - "null"
          format: uuid
          description: The `id` of the payout's transaction, once linked.
        tx_hash:
          type:
            - string
            - "null"
          description: The transaction hash, once sent.
        transaction:
          oneOf:
            - $ref: "#/components/schemas/Transaction"
            - type: "null"
          description: The linked transaction, as `getTransaction` returns it.
        failure:
          oneOf:
            - $ref: "#/components/schemas/AsyncFailure"
            - type: "null"
          examples:
            - code: failed_by_operator
              message: An operator failed this payout because it could not be paid; nothing was sent, and its amount and fee are available again.
              retryable: false
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        completed_at:
          type:
            - string
            - "null"
          format: date-time
    ExactAmountString:
      type: string
      pattern: ^(?:0|[1-9][0-9]*)(?:\.[0-9]*[1-9])?$
      description: |
        Canonical non-negative plain decimal output with no exponent, sign,
        leading zeroes, or insignificant trailing fractional zeroes. Thus an
        accepted input `125.500000` is returned and idempotently stored as
        `125.5`.
      examples:
        - "0"
        - "19"
        - "0.000001"
        - "125.5"
    SignedExactAmountString:
      type: string
      pattern: ^(?:0|-?(?:(?:[1-9][0-9]*)(?:\.[0-9]*[1-9])?|0\.[0-9]*[1-9]))$
      description: |
        Canonical signed plain decimal output. Zero has no sign; non-zero
        values have no exponent, leading zeroes, or insignificant trailing
        fractional zeroes. Balance deficits are represented exactly instead
        of being clamped to zero.
      examples:
        - "0"
        - "19"
        - "-2.5"
        - "0.000001"
        - "-0.000001"
    PositiveExactAmountString:
      type: string
      pattern: ^(?:[1-9][0-9]*(?:\.[0-9]+)?|0\.[0-9]*[1-9][0-9]*)$
      description: |
        A decimal string greater than zero. Trailing zeroes are accepted, as in
        `125.500000`, and dropped: the payout stores and returns `125.5`. JSON
        numbers and exponent notation are refused.
      examples:
        - "1"
        - "0.000001"
        - "125.500000"
    Confirmation:
      type: object
      additionalProperties: false
      required:
        - current
        - required
        - remaining
        - progress_percent
        - inclusion_position
        - processed_position
        - required_position
        - policy_id
        - policy_version
        - calculated_at
        - scanner_stale
        - scanner_lag
      properties:
        current:
          type:
            - integer
            - "null"
          minimum: 0
        required:
          type:
            - integer
            - "null"
          minimum: 1
        remaining:
          type:
            - integer
            - "null"
          minimum: 0
        progress_percent:
          type:
            - integer
            - "null"
          minimum: 0
          maximum: 100
        inclusion_position:
          type:
            - integer
            - "null"
          minimum: 0
        processed_position:
          type:
            - integer
            - "null"
          minimum: 0
        required_position:
          type:
            - integer
            - "null"
          minimum: 0
        policy_id:
          type: string
          format: uuid
        policy_version:
          type: integer
          minimum: 1
        calculated_at:
          type: string
          format: date-time
        scanner_stale:
          type: boolean
        scanner_lag:
          type:
            - integer
            - "null"
          minimum: 0
      examples:
        - current: 5
          required: 19
          remaining: 14
          progress_percent: 26
          inclusion_position: 67123450
          processed_position: 67123454
          required_position: 67123468
          policy_id: 8295bd60-2dba-4a52-a48a-7cd8a7c3ed7b
          policy_version: 3
          calculated_at: "2026-07-11T20:10:00Z"
          scanner_stale: false
          scanner_lag: 0
    AsyncFailure:
      type: object
      additionalProperties: false
      required:
        - code
        - message
        - retryable
      properties:
        code:
          type: string
          pattern: ^[a-z][a-z0-9_]*$
        message:
          type: string
          minLength: 1
          description: A message for people; never a provider's response, a secret or a stack trace.
        retryable:
          type: boolean
    ErrorCode:
      type: string
      enum:
        - internal_error
        - authentication_required
        - invalid_request
        - unsupported_media_type
        - resource_not_found
        - resource_conflict
        - idempotency_key_required
        - idempotency_key_conflict
        - asset_unavailable
        - invalid_amount_precision
        - amount_below_dust_limit
        - permission_denied
        - rates_unavailable
        - service_unavailable
        - webhook_endpoint_limit_reached
        - webhook_endpoint_disabled
        - webhook_delivery_not_failed
      x-enum-descriptions:
        internal_error: The install failed; retry later, and give the operator the `request_id`.
        authentication_required: The key is missing or unknown; send a key the operator issued.
        invalid_request: A field, query parameter or cursor is malformed or unknown; fix the request.
        unsupported_media_type: The body was not sent as JSON; send it with `Content-Type` set to `application/json`.
        resource_not_found: Nothing has this id; check it.
        resource_conflict: The resource's state refuses the call, such as a second address for one `external_id`, or a payout `external_id` used with another body.
        idempotency_key_required: The call has no `Idempotency-Key`; send one.
        idempotency_key_conflict: The key was used with another body of this call; use a new key.
        asset_unavailable: The asset cannot be used for this call; check its `capabilities`.
        invalid_amount_precision: The amount has more decimal places than the asset allows; round it.
        amount_below_dust_limit: A Bitcoin payout is below its destination's dust limit, which no node relays; send at least 546 sat to a P2PKH address, 540 to P2SH, 294 to P2WPKH or 330 to P2TR.
        permission_denied: The key lacks the scope this call needs; ask the operator for one.
        rates_unavailable: Stored rates could not be read; retry later.
        service_unavailable: Something the call needs, such as a network's node, did not answer; retry later.
        webhook_endpoint_limit_reached: The install has as many active webhook endpoints as it allows; disable one first.
        webhook_endpoint_disabled: The webhook endpoint is disabled, and a disabled one stays so; register its URL again for a new endpoint.
        webhook_delivery_not_failed: Only a `failed` delivery can be replayed; wait for it to end, or replay the one that failed.
    ErrorBody:
      type: object
      additionalProperties: false
      required:
        - code
        - message
      properties:
        code:
          $ref: "#/components/schemas/ErrorCode"
        message:
          type: string
          minLength: 1
          description: For people. Branch on `code`, never on `message`.
        field:
          type: string
          minLength: 1
          description: |
            The request field the error is about, when one is: a body member's
            path, such as `destination.address`, or a parameter's name.
    WebhookEndpointStatus:
      type: string
      enum:
        - active
        - disabled
    WebhookEventType:
      type: string
      description: An event type an endpoint can choose. The event catalog documents each.
      enum:
        - wallet.deposit_credited
        - transaction.detected
        - transaction.confirmed
        - transaction.reverted
        - payout.queued
        - payout.broadcast
        - payout.confirming
        - payout.confirmed
        - payout.failed
        - payout.reorg_detected
        - payout.reorg_resolved
    WebhookDeliveryEventType:
      description: An event type an endpoint can choose, or `endpoint.test`, which `sendWebhookTestEvent` sends.
      anyOf:
        - $ref: "#/components/schemas/WebhookEventType"
        - type: string
          const: endpoint.test
    WebhookEvents:
      description: "The event types the endpoint receives, each once; `null` for every type, one a later release adds included. An empty list answers `400`: disable the endpoint instead."
      oneOf:
        - type: array
          minItems: 1
          uniqueItems: true
          items:
            $ref: "#/components/schemas/WebhookEventType"
        - type: "null"
    WebhookEndpoint:
      type: object
      additionalProperties: false
      required:
        - id
        - url
        - description
        - status
        - events
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        url:
          type: string
          format: uri
          description: The scheme it was registered with, `http` or `https`.
        description:
          oneOf:
            - type: string
              maxLength: 255
            - type: "null"
        status:
          $ref: "#/components/schemas/WebhookEndpointStatus"
        events:
          $ref: "#/components/schemas/WebhookEvents"
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
          description: Moves on each change, a rotation and a disable included.
    WebhookEndpointWithSecret:
      type: object
      additionalProperties: false
      required:
        - id
        - url
        - description
        - status
        - events
        - created_at
        - updated_at
        - secret
      properties:
        id:
          type: string
          format: uuid
        url:
          type: string
          format: uri
          description: The scheme it was registered with, `http` or `https`.
        description:
          oneOf:
            - type: string
              maxLength: 255
            - type: "null"
        status:
          $ref: "#/components/schemas/WebhookEndpointStatus"
        events:
          $ref: "#/components/schemas/WebhookEvents"
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
          description: Moves on each change, a rotation and a disable included.
        secret:
          type: string
          pattern: ^whsec_[A-Za-z0-9+/]{43}=$
          description: |
            Signs every event sent to this endpoint, as Standard Webhooks
            defines: `whsec_` and the base64 of the 32 key bytes, so the
            official libraries take it as it is. Only the registration that
            creates the endpoint and a rotation return it: the install derives
            it and never stores it.
    WebhookEndpointPage:
      type: object
      additionalProperties: false
      required:
        - data
        - next_cursor
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/WebhookEndpoint"
        next_cursor:
          type:
            - string
            - "null"
          description: Pass it back as `cursor` for the next page; null on the last page.
    WebhookDeliveryStatus:
      type: string
      enum:
        - pending
        - delivering
        - delivered
        - failed
        - superseded
      description: "`delivered`, `failed` and `superseded` are final. `failed` is the dead-letter list: those deliveries are never retried on their own. `superseded` is a `transaction.detected` that was never sent, because a later `transaction.confirmed` or `transaction.reverted` of its payment came first to the same endpoint and carries its state; it is not replayed."
    WebhookDeliveryErrorCode:
      type: string
      enum:
        - endpoint_unreachable
        - endpoint_rejected
        - endpoint_gone
        - delivery_lease_expired
        - envelope_encode_failed
        - signature_unavailable
      x-enum-descriptions:
        endpoint_unreachable: No answer came back, such as a refused connection, a timeout or a certificate your server must renew; check the endpoint can be reached.
        endpoint_rejected: Your endpoint answered with a status other than `2xx` or `410`; fix your handler.
        endpoint_gone: Your endpoint answered `410`, which ends the delivery at once; replay it once the handler is back.
        delivery_lease_expired: The install's own sender stopped before the attempt was recorded; it is retried, and the operator can look at the install.
        envelope_encode_failed: The install could not build the event's body; tell the operator.
        signature_unavailable: The install could not sign the event; tell the operator.
    WebhookDeliveryEvent:
      type: object
      additionalProperties: false
      required:
        - id
        - type
        - occurred_at
      properties:
        id:
          type: string
          format: uuid
          description: The event's `id`, also sent as the `webhook-id` header. An event has one delivery per endpoint, and one per replay.
        type:
          $ref: "#/components/schemas/WebhookDeliveryEventType"
        occurred_at:
          type: string
          format: date-time
          description: When the event happened, not when it was delivered.
    WebhookDelivery:
      type: object
      additionalProperties: false
      required:
        - id
        - endpoint_id
        - event
        - status
        - attempt_count
        - last_status_code
        - last_error_code
        - last_attempt_at
        - next_attempt_at
        - completed_at
        - replayed_from_delivery_id
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        endpoint_id:
          type: string
          format: uuid
        event:
          $ref: "#/components/schemas/WebhookDeliveryEvent"
        status:
          $ref: "#/components/schemas/WebhookDeliveryStatus"
        attempt_count:
          type: integer
          minimum: 0
          description: Attempts made; the 12th that fails moves the delivery to `failed`.
        last_status_code:
          oneOf:
            - type: integer
              minimum: 100
              maximum: 599
            - type: "null"
          description: Your endpoint's last HTTP status. Its body is never stored.
        last_error_code:
          oneOf:
            - $ref: "#/components/schemas/WebhookDeliveryErrorCode"
            - type: "null"
          description: Why the last attempt failed, never text from a response body; null once delivered.
        last_attempt_at:
          oneOf:
            - type: string
              format: date-time
            - type: "null"
        next_attempt_at:
          oneOf:
            - type: string
              format: date-time
            - type: "null"
          description: Set only while `pending`; each retry waits twice as long as the last.
        completed_at:
          oneOf:
            - type: string
              format: date-time
            - type: "null"
          description: When the delivery ended, as `status` says; null until then.
        replayed_from_delivery_id:
          oneOf:
            - type: string
              format: uuid
            - type: "null"
          description: The delivery this replay came from, which is never changed; null on a first delivery.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    WebhookDeliveryWithEvent:
      type: object
      additionalProperties: false
      required:
        - id
        - endpoint_id
        - event
        - status
        - attempt_count
        - last_status_code
        - last_error_code
        - last_attempt_at
        - next_attempt_at
        - completed_at
        - replayed_from_delivery_id
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        endpoint_id:
          type: string
          format: uuid
        event:
          type: object
          additionalProperties: false
          required:
            - id
            - type
            - aggregate_type
            - aggregate_id
            - schema_version
            - occurred_at
            - data
          description: The body each attempt sends, as the event catalog documents it.
          properties:
            id:
              type: string
              format: uuid
            type:
              $ref: "#/components/schemas/WebhookDeliveryEventType"
            aggregate_type:
              type: string
              enum:
                - deposit_wallet
                - chain_transaction
                - withdrawal
                - webhook_endpoint
            aggregate_id:
              type: string
              format: uuid
            schema_version:
              type: integer
              const: 1
            occurred_at:
              type: string
              format: date-time
            data:
              type: object
        status:
          $ref: "#/components/schemas/WebhookDeliveryStatus"
        attempt_count:
          type: integer
          minimum: 0
          description: Attempts made; the 12th that fails moves the delivery to `failed`.
        last_status_code:
          oneOf:
            - type: integer
              minimum: 100
              maximum: 599
            - type: "null"
          description: Your endpoint's last HTTP status. Its body is never stored.
        last_error_code:
          oneOf:
            - $ref: "#/components/schemas/WebhookDeliveryErrorCode"
            - type: "null"
          description: Why the last attempt failed, never text from a response body; null once delivered.
        last_attempt_at:
          oneOf:
            - type: string
              format: date-time
            - type: "null"
        next_attempt_at:
          oneOf:
            - type: string
              format: date-time
            - type: "null"
          description: Set only while `pending`; each retry waits twice as long as the last.
        completed_at:
          oneOf:
            - type: string
              format: date-time
            - type: "null"
          description: When the delivery ended, as `status` says; null until then.
        replayed_from_delivery_id:
          oneOf:
            - type: string
              format: uuid
            - type: "null"
          description: The delivery this replay came from, which is never changed; null on a first delivery.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    WebhookDeliveryPage:
      type: object
      additionalProperties: false
      required:
        - data
        - next_cursor
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/WebhookDelivery"
        next_cursor:
          type:
            - string
            - "null"
          description: Pass it back as `cursor` for the next page; null on the last page.
    RegisterWebhookEndpointRequest:
      type: object
      additionalProperties: false
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          maxLength: 2048
          pattern: ^https?://
          description: |
            Must be `http` or `https`, with no credentials and no fragment;
            over `http` the event bodies cross the network in clear text. It
            must reach a public address, or a private one the install's
            operator allows: each delivery checks the address it connects to.
            A private address literal the operator does not allow, a port
            outside 1 to 65535, a `.` or `..` path segment or a malformed
            escape answers `400` naming `url` and why.
        description:
          type: string
          maxLength: 255
          description: Sent again with an active endpoint's URL, it sets the description; `""` clears it.
        events:
          $ref: "#/components/schemas/WebhookEvents"
    UpdateWebhookEndpointRequest:
      type: object
      additionalProperties: false
      minProperties: 1
      properties:
        description:
          type: string
          maxLength: 255
          description: The new description; `""` clears it.
        events:
          $ref: "#/components/schemas/WebhookEvents"
    ErrorEnvelope:
      type: object
      additionalProperties: false
      required:
        - error
        - request_id
      properties:
        error:
          $ref: "#/components/schemas/ErrorBody"
        request_id:
          type: string
          minLength: 1
          maxLength: 128
          pattern: ^[A-Za-z0-9._-]+$
          description: The same ID as the `X-Request-ID` response header.
      examples:
        - error:
            code: invalid_request
            message: "invalid request field: amount"
            field: amount
          request_id: 9481da45-9ae5-4fce-a252-0190235a8f45
    EventEnvelope:
      type: object
      additionalProperties: false
      required:
        - id
        - type
        - aggregate_type
        - aggregate_id
        - schema_version
        - occurred_at
        - data
      properties:
        id:
          type: string
          format: uuid
          description: The event's id. Deduplicate on it.
        type:
          type: string
          description: The event type, such as payout.confirmed.
        aggregate_type:
          type: string
          enum:
            - deposit_wallet
            - chain_transaction
            - withdrawal
            - webhook_endpoint
        aggregate_id:
          type: string
          format: uuid
          description: The id of that customer address, payment, payout or webhook endpoint.
        schema_version:
          type: integer
          const: 1
          description: The version of data.
        occurred_at:
          type: string
          format: date-time
          description: "When the change happened, not when it was sent: UTC to the microsecond, trailing zeros dropped, so compare parsed times, never the text. The install writes each event at least a millisecond after every event of the same aggregate it had already saved, moving the event's time forward when it has to, so changes made together read in the order they were made even to a reader that keeps milliseconds. Changes saved at the same moment by separate processes can be closer than a millisecond or share a time; read the aggregate's current state when two tie."
        data:
          type: object
    EventAmount:
      type: object
      additionalProperties: false
      required:
        - asset_id
        - amount
      properties:
        asset_id:
          type: string
          format: uuid
        amount:
          type: string
          pattern: ^-?[0-9]+(\.[0-9]+)?$
          description: A decimal string in the asset's own units.
    EventWallet:
      type: object
      additionalProperties: false
      required:
        - wallet_id
        - external_id
        - amounts
      properties:
        wallet_id:
          type: string
          format: uuid
          description: The customer address, as getWallet reads it.
        external_id:
          type: string
          description: Your reference for the customer, as you sent it to createWallet.
        amounts:
          type: array
          items:
            type: object
            additionalProperties: false
            required:
              - asset_id
              - amount
            properties:
              asset_id:
                type: string
                format: uuid
              amount:
                type: string
                pattern: ^(?:[1-9][0-9]*(?:\.[0-9]+)?|0\.[0-9]*[1-9][0-9]*)$
                description: A decimal string in the asset's own units, above zero.
          description: What the customer was paid at this address per asset, network fee excluded.
    WalletEvent:
      allOf:
        - $ref: "#/components/schemas/EventEnvelope"
        - properties:
            aggregate_type:
              const: deposit_wallet
            data:
              $ref: "#/components/schemas/WalletEventData"
    WalletEventData:
      type: object
      additionalProperties: false
      required:
        - wallet_id
        - network_id
      properties:
        wallet_id:
          type: string
          format: uuid
          description: The customer address, the same as aggregate_id.
        network_id:
          type: string
          format: uuid
          description: The network's id, as listNetworks reports it.
        external_id:
          type: string
          description: Only in wallet.deposit_credited.
        credit_id:
          type: string
          format: uuid
          description: The operator's credit. Only in wallet.deposit_credited; apply each credit_id once.
        amounts:
          type: array
          items:
            type: object
            additionalProperties: false
            required:
              - asset_id
              - amount
            properties:
              asset_id:
                type: string
                format: uuid
              amount:
                type: string
                pattern: ^(?:[1-9][0-9]*(?:\.[0-9]+)?|0\.[0-9]*[1-9][0-9]*)$
                description: A decimal string in the asset's own units, above zero.
          description: What the operator credited to the customer per asset. Only in wallet.deposit_credited.
        tx_hash:
          type: string
          minLength: 1
          description: The transaction the money came in, when the operator found it. Only in wallet.deposit_credited, and not always there.
    EndpointEvent:
      allOf:
        - $ref: "#/components/schemas/EventEnvelope"
        - properties:
            aggregate_type:
              const: webhook_endpoint
            data:
              $ref: "#/components/schemas/EndpointEventData"
    EndpointEventData:
      type: object
      additionalProperties: false
      required:
        - endpoint_id
      properties:
        endpoint_id:
          type: string
          format: uuid
          description: The endpoint the test was sent to, the same as aggregate_id.
    TransactionEvent:
      allOf:
        - $ref: "#/components/schemas/EventEnvelope"
        - properties:
            aggregate_type:
              const: chain_transaction
            data:
              $ref: "#/components/schemas/TransactionEventData"
    TransactionEventData:
      type: object
      additionalProperties: false
      required:
        - transaction_id
        - network_id
        - tx_hash
        - status
        - canonicality_generation
      properties:
        transaction_id:
          type: string
          format: uuid
          description: The transaction, the same as aggregate_id.
        network_id:
          type: string
          format: uuid
          description: The network's id, as listNetworks reports it.
        tx_hash:
          type: string
          minLength: 1
        status:
          type: string
          enum:
            - detected
            - confirming
            - confirmed
            - reverted
          description: The payment's status as the event leaves it. transaction.detected is detected or confirming, as getTransaction reports it then.
        amounts:
          type: array
          items:
            $ref: "#/components/schemas/EventAmount"
          description: The signed change to the install's funds per asset, as getTransaction reports it. The network fee is excluded, except on Bitcoin, where a sweep's amounts include the fee its inputs paid. Negative is money leaving the install. Absent when nothing the install owns moved. A repeated confirmation states it whole again. transaction.reverted states the amounts of the newest confirmation it takes back, which getTransaction does not report for a reverted transaction, and none when it takes back none. transaction.detected states what the payment would move if it confirmed as it stands; nothing has moved yet.
        wallets:
          type: array
          items:
            $ref: "#/components/schemas/EventWallet"
          description: "The customers the transaction paid, sorted by wallet_id: each customer address that received money from outside the install, with what it received per asset. A transaction sent by one of the install's own addresses pays no customer: a sweep, a gas top-up, or a payout from the treasury. A Bitcoin transaction names no sender, so one that spends from any of the install's own addresses pays none. One anyone else sends pays no customer in an asset it takes, on balance, from one of the install's own addresses, such as a token issuer's transfer out of the treasury. A repeated transaction.confirmed lists every customer again, so set each credit and never add to it. transaction.reverted names every customer the confirmations it takes back named. transaction.detected names the customers its confirmation would pay, and none of them is credited before that. Absent when the transaction paid no customer. Each customer paid in one asset adds about 200 bytes to the event with a 36-character external_id, and up to about 1.7 KB with one of 255 characters; only the chain limits how many one transaction pays, so accept bodies as large as your largest payment's event."
        inclusion_block_hash:
          type: string
          minLength: 1
          description: The block that includes the transaction. Only in transaction.detected and transaction.confirmed.
        confirmations:
          type: object
          additionalProperties: false
          required:
            - current
            - required
            - remaining
            - progress_percent
          description: "How far the payment is from its network's confirmation policy when it was detected, as getTransaction reports it. Only in transaction.detected, which is not repeated as the count grows: read getTransaction for the current figure. Each count is null on a network whose policy is a phase rather than a number of blocks."
          properties:
            current:
              type:
                - integer
                - "null"
              minimum: 0
              description: The blocks that include the payment or follow its block.
            required:
              type:
                - integer
                - "null"
              minimum: 1
              description: The count the payment's policy asks for.
            remaining:
              type:
                - integer
                - "null"
              minimum: 0
            progress_percent:
              type:
                - integer
                - "null"
              minimum: 0
              maximum: 100
        former_inclusion_block_hash:
          type: string
          minLength: 1
          description: The block the reorganisation removed. Only in transaction.reverted.
        canonicality_generation:
          type: integer
          minimum: 1
          description: Counts the transaction's moves into confirmed or reverted. A repeated confirmation keeps its generation, so order events by canonicality_generation and then occurred_at. transaction.detected carries the generation its payment's next transaction.confirmed or transaction.reverted will, and comes before it.
        reorg_generation:
          type: integer
          minimum: 1
          description: The reorganisation case of a payout's transaction, when it had one.
    PayoutEvent:
      allOf:
        - $ref: "#/components/schemas/EventEnvelope"
        - properties:
            aggregate_type:
              const: withdrawal
            data:
              $ref: "#/components/schemas/PayoutEventData"
    PayoutEventData:
      type: object
      additionalProperties: false
      description: "Part of what getPayout returns, with the same meanings: payout_id is its id, transaction_id its chain_transaction_id, and failure leaves out retryable. network and asset add the codes of network_id and asset_id."
      required:
        - payout_id
        - network_id
        - network
        - asset_id
        - asset
        - amount
        - status
      properties:
        payout_id:
          type: string
          format: uuid
          description: The payout's id, as getPayout takes it; the same as aggregate_id.
        external_id:
          type: string
          minLength: 1
          description: Your reference for the payout, as you sent it to createPayout; in every event of that payout.
        network_id:
          type: string
          format: uuid
          description: The network's id, as listNetworks reports it.
        network:
          type: string
          minLength: 1
          description: The network's code, such as tron.
        asset_id:
          type: string
          format: uuid
          description: The asset's id, as listAssets reports it.
        asset:
          type: string
          minLength: 1
          description: The asset's code, such as usdt. Two assets of one network can share a code; asset_id names the one.
        amount:
          type: string
          pattern: ^(?:[1-9][0-9]*(?:\.[0-9]+)?|0\.[0-9]*[1-9][0-9]*)$
          description: The payout's amount, a decimal string in the asset's own units.
        status:
          type: string
          enum:
            - queued
            - broadcast
            - confirming
            - confirmed
            - failed
            - reorged
          description: The payout's status after this event. No event announces signing.
        transaction_id:
          type: string
          format: uuid
          description: The id of the payout's transaction, once linked.
        tx_hash:
          type: string
          minLength: 1
          description: The payout's transaction hash, once broadcast.
        failure:
          type: object
          additionalProperties: false
          required:
            - code
            - message
          description: Why the payout failed, while it is failed, and under reorged for a payout that had failed.
          properties:
            code:
              type: string
              pattern: ^[a-z][a-z0-9_]*$
              description: Such as insufficient_balance, or attempts_exhausted when every attempt was spent.
            message:
              type: string
              minLength: 1
              description: For people; branch on code.
webhooks:
  wallet.deposit_credited:
    post:
      summary: Deposit credited by an operator
      description: An operator credited money the address holds on chain that no payment event reported; add it to the customer once per credit_id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WalletEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a15
              type: wallet.deposit_credited
              aggregate_type: deposit_wallet
              aggregate_id: 1080986a-b3b8-458c-a9cb-855f77f0189a
              schema_version: 1
              occurred_at: "2026-10-06T08:14:52.031447Z"
              data:
                wallet_id: 1080986a-b3b8-458c-a9cb-855f77f0189a
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                external_id: customer-42
                credit_id: 4f0b8d2e-6a71-4c95-8e3d-1b2a9c7f5e60
                amounts:
                  - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    amount: "0.25"
                tx_hash: "0x9c1d2e3f4a5b6c7d8e9f00112233445566778899aabbccddeeff001122334455"
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  transaction.detected:
    post:
      summary: Payment detected, not credited
      description: A transaction paying one of your customer addresses is on chain and waits for its network's confirmation policy. Nothing is credited, so never credit, ship or release anything on this event; only transaction.confirmed is money in. When it is the newest event of the payment you have, set each of the payment's credits to 0 and show its wallets as pending, since a newer canonicality_generation means every earlier credit was taken back. It is sent for a payment of any amount, dust included; an endpoint whose events leave it out receives none. It is sent once a canonicality_generation, at the install's first check of the payment, with the canonicality_generation its transaction.confirmed or transaction.reverted will carry; a payment that already meets its policy at that check sends none, as every payment does on Solana and XRPL under their default policy of one confirmation, since their scanners read only final data. If the operator raises the policy there, each payment, already final on chain, sends one until it reaches that policy. One not yet sent to an endpoint when a later transaction.confirmed or transaction.reverted of its payment exists for that endpoint is never sent there, and its delivery ends superseded; an endpoint that does not receive the outcome gets the detection. A transaction.reverted of the same canonicality_generation means the payment left the chain before it confirmed.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransactionEvent"
            examples:
              confirming:
                summary: In a block, waiting for more
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a28
                  type: transaction.detected
                  aggregate_type: chain_transaction
                  aggregate_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
                  schema_version: 1
                  occurred_at: "2026-09-24T09:28:01.511873Z"
                  data:
                    transaction_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    tx_hash: "0x4a8f1c2d3e5b6a7980c1d2e3f4a5b6c7d8e9f00112233445566778899aabbcc"
                    status: confirming
                    amounts:
                      - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                        amount: "0.015"
                    wallets:
                      - wallet_id: 1080986a-b3b8-458c-a9cb-855f77f0189a
                        external_id: customer-42
                        amounts:
                          - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                            amount: "0.015"
                    confirmations:
                      current: 1
                      required: 12
                      remaining: 11
                      progress_percent: 8
                    inclusion_block_hash: "0x000000000000000a3c2b1f0e9d8c7b6a5f4e3d2c1b0a99887766554433221100"
                    canonicality_generation: 1
              detected:
                summary: Found before the scanner reached its block
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a29
                  type: transaction.detected
                  aggregate_type: chain_transaction
                  aggregate_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
                  schema_version: 1
                  occurred_at: "2026-09-24T09:28:01.511873Z"
                  data:
                    transaction_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    tx_hash: "0x4a8f1c2d3e5b6a7980c1d2e3f4a5b6c7d8e9f00112233445566778899aabbcc"
                    status: detected
                    amounts:
                      - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                        amount: "0.015"
                    wallets:
                      - wallet_id: 1080986a-b3b8-458c-a9cb-855f77f0189a
                        external_id: customer-42
                        amounts:
                          - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                            amount: "0.015"
                    confirmations:
                      current: 0
                      required: 12
                      remaining: 12
                      progress_percent: 0
                    inclusion_block_hash: "0x000000000000000a3c2b1f0e9d8c7b6a5f4e3d2c1b0a99887766554433221100"
                    canonicality_generation: 1
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  transaction.confirmed:
    post:
      summary: Payment confirmed
      description: The transaction met its network's confirmation policy; a reorganisation can still revert it. A later change to its amounts or customers repeats it with the same canonicality_generation, such as a customer credit that posts late, or a sweep whose send timed out and that the install recognises as its own only after it confirmed. On EVM, and on TRON, Solana, XRPL and Bitcoin for a payout to one of the install's customer addresses, a payout's transaction is announced once the payout's outcome is known; an EVM payout whose send timed out sends its first transaction.confirmed once the install recognises it, and one whose transfer the chain leaves short or unclear once it settles, after an operator's ruling where it needs one. On TRON, Solana, XRPL and Bitcoin, a payout's transaction that a reorganisation reported as reverted is announced again once it confirms again and the payout has settled.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransactionEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a13
              type: transaction.confirmed
              aggregate_type: chain_transaction
              aggregate_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
              schema_version: 1
              occurred_at: "2026-09-24T09:31:48.204519Z"
              data:
                transaction_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                tx_hash: "0x4a8f1c2d3e5b6a7980c1d2e3f4a5b6c7d8e9f00112233445566778899aabbcc"
                status: confirmed
                amounts:
                  - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    amount: "0.015"
                wallets:
                  - wallet_id: 1080986a-b3b8-458c-a9cb-855f77f0189a
                    external_id: customer-42
                    amounts:
                      - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                        amount: "0.015"
                inclusion_block_hash: "0x000000000000000a3c2b1f0e9d8c7b6a5f4e3d2c1b0a99887766554433221100"
                canonicality_generation: 1
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  transaction.reverted:
    post:
      summary: Payment reverted
      description: A reorganisation removed the transaction from the chain; it can confirm again later. It takes back the transaction.confirmed events one canonicality_generation below its own, restating the newest one's amounts and every customer they named, and carries neither when none was sent, as for a transaction that had not confirmed or whose confirmation waited for its payout. It also ends the transaction.detected of its own canonicality_generation, if one was sent; that payment left the chain before it confirmed, so clear what you showed as pending for it.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TransactionEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a14
              type: transaction.reverted
              aggregate_type: chain_transaction
              aggregate_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
              schema_version: 1
              occurred_at: "2026-09-24T09:40:02.718335Z"
              data:
                transaction_id: 8d4e1f22-0c9a-4b3e-9d17-5a6b7c8d9e0f
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                tx_hash: "0x4a8f1c2d3e5b6a7980c1d2e3f4a5b6c7d8e9f00112233445566778899aabbcc"
                status: reverted
                amounts:
                  - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    amount: "0.015"
                wallets:
                  - wallet_id: 1080986a-b3b8-458c-a9cb-855f77f0189a
                    external_id: customer-42
                    amounts:
                      - asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                        amount: "0.015"
                former_inclusion_block_hash: "0x000000000000000a3c2b1f0e9d8c7b6a5f4e3d2c1b0a99887766554433221100"
                canonicality_generation: 2
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  payout.queued:
    post:
      summary: Payout queued
      description: createPayout accepted the payout.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PayoutEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a15
              type: payout.queued
              aggregate_type: withdrawal
              aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
              schema_version: 1
              occurred_at: "2026-09-24T10:00:00.102936Z"
              data:
                payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                external_id: payout-48291
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                network: tron
                asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                asset: usdt
                amount: "0.01"
                status: queued
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  payout.broadcast:
    post:
      summary: Payout broadcast
      description: A node accepted the signed transaction, which tx_hash names.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PayoutEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a17
              type: payout.broadcast
              aggregate_type: withdrawal
              aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
              schema_version: 1
              occurred_at: "2026-09-24T10:00:03.905512Z"
              data:
                payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                external_id: payout-48291
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                network: tron
                asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                asset: usdt
                amount: "0.01"
                status: broadcast
                tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  payout.confirming:
    post:
      summary: Payout confirming
      description: The transaction is on chain and matched to the payout; payout.confirmed, or payout.failed if it moved nothing, reverted or an operator rules it undelivered, follows once it meets the network's confirmation policy and settles. A transfer the chain leaves unclear settles only once an operator rules on it.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PayoutEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a18
              type: payout.confirming
              aggregate_type: withdrawal
              aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
              schema_version: 1
              occurred_at: "2026-09-24T10:01:12.660048Z"
              data:
                payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                external_id: payout-48291
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                network: tron
                asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                asset: usdt
                amount: "0.01"
                status: confirming
                transaction_id: 3b5d7f9a-1c2e-4a6b-8d0f-2a4c6e8a0b1d
                tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  payout.confirmed:
    post:
      summary: Payout confirmed
      description: The payout arrived. This status is final unless a reorganisation includes the payout's transaction again and it fails there; payout.failed then follows.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PayoutEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a19
              type: payout.confirmed
              aggregate_type: withdrawal
              aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
              schema_version: 1
              occurred_at: "2026-09-24T10:12:30.477191Z"
              data:
                payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                external_id: payout-48291
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                network: tron
                asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                asset: usdt
                amount: "0.01"
                status: confirmed
                transaction_id: 3b5d7f9a-1c2e-4a6b-8d0f-2a4c6e8a0b1d
                tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  payout.failed:
    post:
      summary: Payout failed
      description: The amount did not leave, and failure.code says why, attempts_exhausted when every attempt was spent and failed_by_operator when an operator failed a payout that could never be paid. Create a new payout to try again. If a reorganisation includes a failed payout's transaction again and it succeeds there, payout.confirmed follows.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PayoutEvent"
            examples:
              refused:
                summary: Refused before anything was sent
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a20
                  type: payout.failed
                  aggregate_type: withdrawal
                  aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                  schema_version: 1
                  occurred_at: "2026-09-24T10:00:01.338470Z"
                  data:
                    payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                    external_id: payout-48291
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    network: tron
                    asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    asset: usdt
                    amount: "0.01"
                    status: failed
                    failure:
                      code: insufficient_balance
                      message: insufficient confirmed balance for the payout
              exhausted:
                summary: Every attempt was spent
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a21
                  type: payout.failed
                  aggregate_type: withdrawal
                  aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                  schema_version: 1
                  occurred_at: "2026-09-24T11:03:55.019834Z"
                  data:
                    payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                    external_id: payout-48291
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    network: tron
                    asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    asset: usdt
                    amount: "0.01"
                    status: failed
                    failure:
                      code: attempts_exhausted
                      message: every delivery attempt was spent before a transaction was signed
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  payout.reorg_detected:
    post:
      summary: Payout reorganised out
      description: A reorganisation removed the payout's transaction; the payout shows reorged until that transaction confirms again, or until the case ends without it (the send proven absent and the payout sent again or failed, another version of a Bitcoin payout settling it, or an operator closing the case), when the payout shows its own status. No event says the case ended, but a step that also settles or fails the payout sends payout.confirmed or payout.failed as usual. A settled payout whose transaction confirms again with the other outcome takes it, and payout.failed or payout.confirmed says so.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PayoutEvent"
            example:
              id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a23
              type: payout.reorg_detected
              aggregate_type: withdrawal
              aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
              schema_version: 1
              occurred_at: "2026-09-24T10:20:44.391026Z"
              data:
                payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                external_id: payout-48291
                network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                network: tron
                asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                asset: usdt
                amount: "0.01"
                status: reorged
                transaction_id: 3b5d7f9a-1c2e-4a6b-8d0f-2a4c6e8a0b1d
                tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  payout.reorg_resolved:
    post:
      summary: Payout back on chain
      description: After a reorganisation, the payout's transaction is on chain again with the outcome it had, and status says where the payout stands, as before the reorganisation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PayoutEvent"
            examples:
              broadcast:
                summary: The payout was broadcast
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a27
                  type: payout.reorg_resolved
                  aggregate_type: withdrawal
                  aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                  schema_version: 1
                  occurred_at: "2026-09-24T10:31:09.556271Z"
                  data:
                    payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                    external_id: payout-48291
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    network: tron
                    asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    asset: usdt
                    amount: "0.01"
                    status: broadcast
                    transaction_id: 3b5d7f9a-1c2e-4a6b-8d0f-2a4c6e8a0b1d
                    tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
              confirming:
                summary: The payout was confirming
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a26
                  type: payout.reorg_resolved
                  aggregate_type: withdrawal
                  aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                  schema_version: 1
                  occurred_at: "2026-09-24T10:31:09.556271Z"
                  data:
                    payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                    external_id: payout-48291
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    network: tron
                    asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    asset: usdt
                    amount: "0.01"
                    status: confirming
                    transaction_id: 3b5d7f9a-1c2e-4a6b-8d0f-2a4c6e8a0b1d
                    tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
              confirmed:
                summary: The payout had confirmed
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a24
                  type: payout.reorg_resolved
                  aggregate_type: withdrawal
                  aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                  schema_version: 1
                  occurred_at: "2026-09-24T10:31:09.556271Z"
                  data:
                    payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                    external_id: payout-48291
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    network: tron
                    asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    asset: usdt
                    amount: "0.01"
                    status: confirmed
                    transaction_id: 3b5d7f9a-1c2e-4a6b-8d0f-2a4c6e8a0b1d
                    tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
              failed:
                summary: The payout had failed on chain
                value:
                  id: 6b1e0c52-3f4a-4c8e-9a17-0d2b5e8f1a25
                  type: payout.reorg_resolved
                  aggregate_type: withdrawal
                  aggregate_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                  schema_version: 1
                  occurred_at: "2026-09-24T10:31:09.556271Z"
                  data:
                    payout_id: c17401b0-2256-438c-b9fd-4b860c9216a7
                    external_id: payout-48291
                    network_id: 7845483d-e3b5-4754-bcec-cc6c2019ad89
                    network: tron
                    asset_id: 311d52dc-f56b-40b3-b77d-b68fab806e29
                    asset: usdt
                    amount: "0.01"
                    status: failed
                    transaction_id: 3b5d7f9a-1c2e-4a6b-8d0f-2a4c6e8a0b1d
                    tx_hash: 7d2e4f6a8b0c1d3e5f7a9b0c2d4e6f8a0b1c3d5e7f9a0b2c4d6e8f0a1b3c5d7e
                    failure:
                      code: protocol_execution_failed
                      message: the Tron transaction was included but its contract result was not SUCCESS
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
  endpoint.test:
    post:
      summary: Test event
      description: Sent by sendWebhookTestEvent to the one endpoint it names, whatever the endpoint's events, signed and retried like every event. It says nothing about money; answer 2xx once your signature check passes.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EndpointEvent"
            example:
              id: 2c7e9a41-5b3d-4f08-9e6a-1d4b8c2f7a30
              type: endpoint.test
              aggregate_type: webhook_endpoint
              aggregate_id: 0b6f3a52-7c1d-4a8e-9f10-2d3c4b5a6e7f
              schema_version: 1
              occurred_at: "2026-09-24T09:00:05.183920Z"
              data:
                endpoint_id: 0b6f3a52-7c1d-4a8e-9f10-2d3c4b5a6e7f
      responses:
        2XX:
          $ref: "#/components/responses/Delivered"
