openapi: 3.0.0
paths:
  /currencies:
    get:
      description: >-
        Returns every crypto currency the platform supports together with their
        network, decimal places, deposit / withdrawal minimums, the payer
        network fee added to each deposit, and the **effective** tenant-wide
        deposit commission. Optionally filterable by `network`.


        Required scope: `currencies.list`.
      operationId: listCurrencies
      parameters:
        - name: network
          required: false
          in: query
          description: >-
            Optional filter: only return currencies on this network (e.g. `Tron`
            to fetch only TRC-20 assets).
          schema:
            type: string
            enum:
              - Tron
              - Solana
              - Ethereum
              - BNB
              - BTC
              - Base
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantCurrencyListResponseDto'
        '400':
          description: Invalid `network` filter value.
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: List supported crypto currencies
      tags:
        - Currencies
      x-required-scope: currencies.list
  /currencies/fiat:
    get:
      description: >-
        Returns every fiat currency that can be used as `fiatCurrencyCode` on
        `POST /invoice`. Includes per-currency `minInvoiceAmount` so callers can
        validate their amounts client-side.


        Required scope: `currencies.list`.
      operationId: listFiatCurrencies
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantFiatCurrencyListResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: List supported fiat (settlement) currencies
      tags:
        - Currencies
      x-required-scope: currencies.list
  /withdrawal/quote:
    post:
      description: >-
        Estimates the on-chain fee for the supplied withdrawal and returns a
        short-lived `quoteId` plus a fee breakdown. The quote does not reserve
        any balance and expires in ~60s. Submit the `quoteId` to `POST
        /withdrawal/commit` to actually create the withdrawal.


        Required scope: `withdrawals.create`.
      operationId: createWithdrawalQuote
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WithdrawalQuoteRequestDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawalQuoteDataResponseDto'
        '400':
          description: >-
            Validation error, currency/address mismatch, or below-minimum
            amount.
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Quote a withdrawal
      tags:
        - Withdrawals
      x-required-scope: withdrawals.create
  /withdrawal/commit:
    post:
      description: >-
        Commits a previously-obtained `quoteId` and creates the withdrawal. The
        deduction currency, total deduction, and FX uplift were locked onto the
        quote at quote time; commit just locks that single balance, re-checks it
        still covers the locked total, and deducts inside a serializable
        transaction. If the locked balance has dropped below the locked total,
        commit returns `withdrawal.insufficientBalance` and the merchant must
        re-quote - commit does not retry against any other currency, even when
        cross-currency is enabled on the account.


        Required scope: `withdrawals.create`.
      operationId: commitWithdrawalQuote
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommitWithdrawalRequestDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawalDataResponseDto'
        '400':
          description: >-
            Validation error, expired/already-committed quote, the locked
            balance no longer covers the quote, or duplicate `orderId`.
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Commit a withdrawal quote
      tags:
        - Withdrawals
      x-required-scope: withdrawals.create
  /withdrawal/list:
    get:
      description: >-
        Returns withdrawals for the account bound to the API key, most recent
        first. Paginated.


        Required scope: `withdrawals.list`.
      operationId: listWithdrawals
      parameters:
        - name: page
          required: false
          in: query
          description: 1-indexed page number.
          schema:
            minimum: 1
            default: 1
            type: number
        - name: limit
          required: false
          in: query
          description: Items per page. Capped at 100.
          schema:
            minimum: 1
            maximum: 100
            default: 20
            type: number
        - name: status
          required: false
          in: query
          description: Filter by withdrawal status.
          schema:
            type: string
            enum:
              - created
              - processing
              - completed
              - failed
              - cancelled
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawalListResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: List withdrawals
      tags:
        - Withdrawals
      x-required-scope: withdrawals.list
  /withdrawal:
    get:
      description: >-
        Retrieves a single withdrawal by its `id` (UUID) or the merchant
        `orderId` on the account bound to the API key. At least one of the two
        query parameters must be supplied; if both are present, `id` takes
        precedence.


        Required scope: `withdrawals.list`.
      operationId: getWithdrawal
      parameters:
        - name: id
          required: false
          in: query
          description: >-
            Withdrawal ID (UUID) returned from `POST /withdrawal`. Mutually
            optional with `orderId`.
          schema:
            format: uuid
            type: string
        - name: orderId
          required: false
          in: query
          description: >-
            Merchant `orderId` supplied when the withdrawal was created.
            Mutually optional with `id`.
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WithdrawalDataResponseDto'
        '400':
          description: >-
            Neither `id` nor `orderId` was supplied, or a supplied value failed
            validation.
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '404':
          description: Withdrawal not found.
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Retrieve a withdrawal
      tags:
        - Withdrawals
      x-required-scope: withdrawals.list
  /webhooks/invoice.statusChanged:
    post:
      description: >-
        Reference schema for outbound webhooks Cryptonly POSTs to your
        configured HTTPS `webhookUrl`. Each delivery includes an
        `x-webhook-signature` header (HMAC-SHA256 over the raw JSON body). This
        route exists for Swagger documentation only; implement verification and
        handling on your own server.


        Required scope: `invoices.list`.
      operationId: webhookReferenceInvoiceStatusChanged
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceStatusChangedWebhookBodyDto'
            examples:
              default:
                summary: Sample invoice.statusChanged payload
                value:
                  event: invoice.statusChanged
                  data:
                    id: e118f6d5-d5cb-4ef1-b9f1-719115b1d728
                    accountId: 3fb3770e-60ed-48c1-a499-e88bee09972b
                    orderId: order_webhook_reference_001
                    amount: 49.99
                    fiatCurrencyCode: USD
                    items: []
                    status: paid
                    cryptoCurrencyCode: USDT_TRC20
                    cryptoAmountExpected: 50
                    cryptoAmountReceived: 50
                    settlement:
                      amountPaid: 50
                      amountPaidUsd: 50
                      commissionAmount: 0.5
                      commissionAmountUsd: 0.5
                      networkFeeAmount: 1
                      networkFeeAmountUsd: 0.1
                      networkFeeCurrencyCode: TRX
                      netAmount: 49.5
                      netAmountUsd: 49.5
                      completedAt: '2026-12-03T10:22:06.643Z'
                    description: Webhook reference example
                    expiresAt: '2026-12-03T10:22:06.642Z'
                    createdAt: '2026-12-03T10:22:06.642Z'
                    source: api
                    paymentPageUrl: https://payment.cryptonly.com/invoice/test-webhook-token
                    paidAt: '2026-12-03T10:22:06.643Z'
                  timestamp: '2026-01-01T12:00:00.000Z'
      responses:
        '200':
          description: Reference endpoint acknowledged.
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'Webhook reference: invoice.statusChanged'
      tags:
        - Webhooks
      x-required-scope: invoices.list
  /webhooks/deposit.statusChanged:
    post:
      description: >-
        Reference schema for outbound webhooks Cryptonly POSTs to your
        configured HTTPS `webhookUrl`. Each delivery includes an
        `x-webhook-signature` header (HMAC-SHA256 over the raw JSON body). This
        route exists for Swagger documentation only; implement verification and
        handling on your own server.


        Required scope: `deposits.list`.
      operationId: webhookReferenceDepositStatusChanged
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepositStatusChangedWebhookBodyDto'
            examples:
              default:
                summary: Sample deposit.statusChanged payload
                value:
                  event: deposit.statusChanged
                  data:
                    id: 51350160-7181-4d7e-bd63-ba0ad8cd7009
                    accountId: 280f7587-be11-4c97-ad7a-84433440dc44
                    orderId: order_webhook_reference_001
                    status: completed
                    cryptoCurrencyCode: USDT_TRC20
                    address: TJn22ewJPN89yNtrnBkagsunbrLnPyQCgs
                    expiresAt: '2026-12-03T10:22:06.643Z'
                    createdAt: '2026-12-03T10:22:06.643Z'
                    updatedAt: '2026-12-03T10:22:06.643Z'
                    previousStatus: processing
                    depositTransactionHash: >-
                      0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
                    actuallyReceivedAmount: 50
                    actuallyReceivedAmountUsd: 50
                  timestamp: '2026-01-01T12:00:00.000Z'
      responses:
        '200':
          description: Reference endpoint acknowledged.
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'Webhook reference: deposit.statusChanged'
      tags:
        - Webhooks
      x-required-scope: deposits.list
  /webhooks/withdrawal.statusChanged:
    post:
      description: >-
        Reference schema for outbound webhooks Cryptonly POSTs to your
        configured HTTPS `webhookUrl`. Each delivery includes an
        `x-webhook-signature` header (HMAC-SHA256 over the raw JSON body). This
        route exists for Swagger documentation only; implement verification and
        handling on your own server.


        Required scope: `withdrawals.list`.
      operationId: webhookReferenceWithdrawalStatusChanged
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WithdrawalStatusChangedWebhookBodyDto'
            examples:
              default:
                summary: Sample withdrawal.statusChanged payload
                value:
                  event: withdrawal.statusChanged
                  data:
                    id: c5346d2e-75b6-4857-be66-75751061c0f3
                    orderId: order_webhook_reference_001
                    accountId: b9f0f786-a3dd-4ed0-8017-f4113fee275d
                    cryptoCurrencyCode: ETH
                    address: '0x1111111111111111111111111111111111111111'
                    amount: 100
                    transactionHash: >-
                      0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                    status: completed
                    previousStatus: processing
                    convertId: null
                    feeAmount: 1
                    feeAmountUsd: 1
                    amountUsd: 100
                    debitedAmount: 101
                    createdAt: '2026-12-03T10:22:06.643Z'
                    updatedAt: '2026-12-03T10:22:06.643Z'
                    quoteId: 7a0bb0d2-3136-4c80-b671-9d234a53226e
                    transferId: ef814f0a-ace7-485b-8199-fd681f717d70
                    source: api
                  timestamp: '2026-01-01T12:00:00.000Z'
      responses:
        '200':
          description: Reference endpoint acknowledged.
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'Webhook reference: withdrawal.statusChanged'
      tags:
        - Webhooks
      x-required-scope: withdrawals.list
  /deposit:
    post:
      description: >-
        Returns a dedicated deposit address and QR code for a flexible crypto
        top-up. Requires `cryptoCurrencyCode` and merchant `orderId`. The
        account comes from the API key.


        Required scope: `deposits.create`.
      operationId: createDeposit
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDepositApiKeyRequestDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DepositCreatedResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '409':
          description: >-
            A deposit with the same `orderId` already exists in a terminal
            state.
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Create a crypto top-up deposit
      tags:
        - Deposits
      x-required-scope: deposits.create
    get:
      operationId: getDeposit
      parameters:
        - name: id
          required: false
          in: query
          schema:
            format: uuid
            type: string
        - name: orderId
          required: false
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantApiKeyDepositDataResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '404':
          description: Deposit not found.
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Retrieve a deposit
      tags:
        - Deposits
      x-required-scope: deposits.list
      description: 'Required scope: `deposits.list`.'
  /deposit/list:
    get:
      operationId: listDeposits
      parameters:
        - name: page
          required: false
          in: query
          description: 1-indexed page number.
          schema:
            minimum: 1
            default: 1
            type: number
        - name: limit
          required: false
          in: query
          description: Items per page. Capped at 100.
          schema:
            minimum: 1
            maximum: 100
            default: 20
            type: number
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - created
              - processing
              - completed
              - suspended
              - failed
              - expired
              - cancelled
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DepositListResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: List merchant top-up deposits
      tags:
        - Deposits
      x-required-scope: deposits.list
      description: 'Required scope: `deposits.list`.'
  /invoice:
    post:
      description: >-
        Creates a new invoice on the account bound to the API key. The response
        includes a hosted payment page URL your customer can use to complete
        payment in crypto.


        Required scope: `invoices.create`.
      operationId: createInvoice
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInvoiceApiKeyRequestDto'
      responses:
        '201':
          description: Invoice created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceCreatedResponseDto'
        '400':
          description: >-
            Validation error, missing fiat currency, amount below the configured
            minimum, or the referenced `customerId` is blocked
            (`exceptions.invoice.customerBlocked`).
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '409':
          description: An invoice with the supplied `orderId` already exists.
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Create an invoice
      tags:
        - Invoices
      x-required-scope: invoices.create
    get:
      description: >-
        Retrieves a single invoice by its `id` (UUID) or the merchant `orderId`
        on the account bound to the API key. At least one of `id` or `orderId`
        must be supplied; if both are present, `id` takes precedence. The
        response always includes `paymentPageUrl` for the hosted payment page.


        Required scope: `invoices.list`.
      operationId: getInvoice
      parameters:
        - name: id
          required: false
          in: query
          description: >-
            Invoice ID (UUID) returned from `POST /invoice`. Mutually optional
            with `orderId`.
          schema:
            format: uuid
            type: string
        - name: orderId
          required: false
          in: query
          description: >-
            Merchant `orderId` supplied when the invoice was created. Mutually
            optional with `id`.
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenantApiKeyInvoiceDataResponseDto'
        '400':
          description: >-
            Neither `id` nor `orderId` was supplied, or a supplied value failed
            validation.
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '404':
          description: Invoice not found.
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Retrieve an invoice
      tags:
        - Invoices
      x-required-scope: invoices.list
  /invoice/list:
    get:
      description: >-
        Returns invoices for the account bound to the API key, most recent
        first. Paginated. Each item includes `paymentPageUrl` for the hosted
        payment page.


        Required scope: `invoices.list`.
      operationId: listInvoices
      parameters:
        - name: page
          required: false
          in: query
          description: 1-indexed page number.
          schema:
            minimum: 1
            default: 1
            type: number
        - name: limit
          required: false
          in: query
          description: Items per page. Capped at 100.
          schema:
            minimum: 1
            maximum: 100
            default: 20
            type: number
        - name: status
          required: false
          in: query
          description: Filter by invoice status.
          schema:
            type: string
            enum:
              - created
              - processing
              - paid
              - partially_paid
              - overpaid
              - expired
              - cancelled
              - failed
              - suspended
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceListResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: List invoices
      tags:
        - Invoices
      x-required-scope: invoices.list
  /invoice/cancel:
    post:
      description: >-
        Cancels an invoice that has not been paid yet on the account bound to
        the API key. The invoice is identified by either `id` or merchant
        `orderId` - at least one is required. Returns 400 if the invoice has
        already been settled or cancelled.


        Required scope: `invoices.cancel`.
      operationId: cancelInvoice
      parameters:
        - name: id
          required: false
          in: query
          description: >-
            Invoice ID (UUID) returned from `POST /invoice`. Mutually optional
            with `orderId`.
          schema:
            format: uuid
            type: string
        - name: orderId
          required: false
          in: query
          description: >-
            Merchant `orderId` supplied when the invoice was created. Mutually
            optional with `id`.
          schema:
            type: string
      responses:
        '204':
          description: Invoice cancelled.
        '400':
          description: >-
            Invoice cannot be cancelled in its current status, or neither `id`
            nor `orderId` was supplied.
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '404':
          description: Invoice not found.
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Cancel an invoice
      tags:
        - Invoices
      x-required-scope: invoices.cancel
  /x402/supported:
    get:
      description: >-
        Schemes, networks and fee-payer signers this account may use. Empty
        `kinds` while x402 is off for the account. Request and response bodies
        follow the x402 v2 facilitator protocol. Protocol failures are HTTP 200
        with `isValid: false` / `success: false` and a reason code, so stock
        x402 clients can read them.


        Required scope: `x402.verify`.
      operationId: x402Supported
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SupportedResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'x402: supported payment kinds'
      tags:
        - x402
      x-required-scope: x402.verify
  /x402/config:
    get:
      description: >-
        Everything a seller needs to issue 402 responses for this account:
        `payTo`, accepted assets, paid resources and prices, fees and limits.
        `cryptonlyPaymentMiddleware` builds its routes from it.


        Required scope: `x402.verify`.
      operationId: getX402Config
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402ConfigResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'x402: account configuration'
      tags:
        - x402
      x-required-scope: x402.verify
  /x402/settlements:
    get:
      description: >-
        Settlements of this key's account, newest first. In wallet mode the
        token went to `payTo`; in balance mode (Base) it was credited to the
        account.


        Required scope: `x402.list`.
      operationId: listX402Settlements
      parameters:
        - name: page
          required: false
          in: query
          description: 1-indexed page number.
          schema:
            minimum: 1
            default: 1
            type: number
        - name: limit
          required: false
          in: query
          description: Items per page. Capped at 100.
          schema:
            minimum: 1
            maximum: 100
            default: 20
            type: number
        - name: accountId
          required: false
          in: query
          description: >-
            Dashboard only: one account of the tenant. The merchant API always
            uses the account of the API key.
          schema:
            format: uuid
            type: string
        - name: resourceId
          required: false
          in: query
          description: Payments for one resource.
          schema:
            format: uuid
            type: string
        - name: status
          required: false
          in: query
          schema:
            type: string
            enum:
              - submitted
              - confirmed
              - credited
              - failed
        - name: outcome
          required: false
          in: query
          description: >-
            `paid`: confirmed or credited. `pending`: submitted. `failed`:
            failed. Combines with `status` (both must match).
          schema:
            type: string
            enum:
              - paid
              - pending
              - failed
        - name: from
          required: false
          in: query
          description: Include settlements created at or after this instant.
          schema:
            format: date-time
            type: string
        - name: to
          required: false
          in: query
          description: Include settlements created at or before this instant.
          schema:
            format: date-time
            type: string
        - name: payer
          required: false
          in: query
          description: Payer address. Compared case-insensitively.
          schema:
            type: string
        - name: payTo
          required: false
          in: query
          description: Recipient address. Compared case-insensitively.
          schema:
            type: string
        - name: transaction
          required: false
          in: query
          description: Transaction hash, exact match.
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SettlementListResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: List x402 settlements
      tags:
        - x402
      x-required-scope: x402.list
  /x402/settlements/{id}:
    get:
      operationId: getX402Settlement
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SettlementDataResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '404':
          description: No settlement with this id belongs to the key's account.
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: Retrieve an x402 settlement
      tags:
        - x402
      x-required-scope: x402.list
      description: 'Required scope: `x402.list`.'
  /x402/verify:
    post:
      description: >-
        Checks a payment payload against its requirements and the account setup
        (registered `payTo`, accepted asset, limit) without broadcasting.
        Request and response bodies follow the x402 v2 facilitator protocol.
        Protocol failures are HTTP 200 with `isValid: false` / `success: false`
        and a reason code, so stock x402 clients can read them.


        Required scope: `x402.verify`.
      operationId: x402Verify
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/X402FacilitatorRequestDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402VerifyResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'x402: verify a payment'
      tags:
        - x402
      x-required-scope: x402.verify
  /x402/settle:
    post:
      description: >-
        Verifies the payment, then broadcasts it on Base or Solana with
        Cryptonly paying the network fee. Replaying the same payload returns the
        original transaction. Request and response bodies follow the x402 v2
        facilitator protocol. Protocol failures are HTTP 200 with `isValid:
        false` / `success: false` and a reason code, so stock x402 clients can
        read them.


        Required scope: `x402.settle`.
      operationId: x402Settle
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/X402FacilitatorRequestDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/X402SettleResponseDto'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'x402: settle a payment'
      tags:
        - x402
      x-required-scope: x402.settle
  /webhooks/x402.payment:
    post:
      description: >-
        Reference schema for x402 settlement events Cryptonly POSTs to the
        webhook URL set in the account's x402 settings. Each delivery has an
        `x-webhook-signature` header (HMAC-SHA256 over the raw JSON body with
        the account signing key). This route exists for documentation only.


        Required scope: `x402.list`.
      operationId: webhookReferenceX402Payment
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/X402PaymentWebhookBodyDto'
            examples:
              default:
                summary: Sample x402.payment.credited payload
                value:
                  event: x402.payment.credited
                  data:
                    id: 019a0000-0000-7000-8000-000000000001
                    status: credited
                    accountId: 019a0000-0000-7000-8000-0000000000aa
                    payoutMode: balance
                    origin: facilitator
                    network: eip155:8453
                    asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
                    amount: '1000000'
                    payer: '0x857b06519E91e3A54538791bDbb0E22373e36b66'
                    payTo: '0x209693Bc6afc0C5328bA36FaF03C514EF312287C'
                    transaction: >-
                      0xabababababababababababababababababababababababababababababababab
                    errorReason: null
                    fee: '2500'
                    feeCurrency: USDC_BASE
                    resourceUrl: https://api.example.com/weather
                    resourceId: 019a0000-0000-7000-8000-0000000000bb
                    createdAt: '2026-01-01T12:00:00.000Z'
                    confirmedAt: '2026-01-01T12:00:22.000Z'
                    creditedAt: '2026-01-01T12:00:22.000Z'
                  timestamp: '2026-01-01T12:00:23.000Z'
      responses:
        '200':
          description: Reference endpoint acknowledged.
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '401':
          description: >-
            Missing or invalid `x-tenant-api-key` header. Code:
            `exceptions.auth.invalidApiKey`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '403':
          description: >-
            Request origin IP is not on the tenant API allowlist
            (`exceptions.auth.ipNotAllowed`), or the API key is missing the
            scope required by this operation
            (`exceptions.auth.insufficientScope`), or the organization has been
            blocked; contact support@cryptonly.net
            (`exceptions.tenant.blocked`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
      security:
        - TENANT_API_KEY: []
      summary: 'Webhook reference: x402.payment.*'
      tags:
        - Webhooks
      x-required-scope: x402.list
  /x402/invoice/{publicToken}:
    get:
      description: >-
        An invoice's `x402Url`, for AI agents and other x402 clients. Without
        payment it answers `402 Payment Required`: the `PAYMENT-REQUIRED` header
        (base64 JSON, x402 v2) lists the price in each accepted stablecoin, USDC
        and EURC on Base, each to the invoice's own address. Retry the same
        request with a signed `PAYMENT-SIGNATURE`; Cryptonly relays the transfer
        and pays the gas. `200` means the transfer is on chain, `202` that it
        was sent but not yet mined. The invoice becomes `paid` once the deposit
        is confirmed, as with any payment: use its status or the
        `invoice.statusChanged` webhook, never the HTTP status alone. A browser
        is redirected to the payment page.


        No API key required.
      operationId: getInvoiceX402
      parameters:
        - name: publicToken
          required: true
          in: path
          description: The token in the invoice's `x402Url`.
          schema:
            type: string
        - name: PAYMENT-SIGNATURE
          in: header
          description: >-
            Base64 x402 v2 `PaymentPayload` signed for one of the `accepts`
            entries.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: >-
            The transfer is on chain (`PAYMENT-RESPONSE` has it), or the invoice
            was already paid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402PaidResponseDto'
        '202':
          description: >-
            The transfer was sent and is not mined yet, or a payment is being
            confirmed. Do not pay again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402PaidResponseDto'
        '302':
          description: 'A browser: redirected to the hosted payment page.'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '402':
          description: >-
            Payment required. `PAYMENT-REQUIRED` (base64) holds what the body
            shows. After a refused payment, `error` and `PAYMENT-RESPONSE` say
            why; nothing was paid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402PaymentRequiredDto'
        '404':
          description: Unknown invoice, or x402 is off for it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
        '409':
          description: >-
            Another payment attempt holds the invoice (`Retry-After` says until
            when).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
        '410':
          description: >-
            The invoice can no longer be paid: `invoice_expired`,
            `invoice_cancelled`, `invoice_partially_paid`, `invoice_failed` or
            `invoice_suspended`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '503':
          description: x402 payments are temporarily unavailable (`Retry-After`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
      security: []
      summary: 'x402: pay an invoice'
      tags:
        - x402
    post:
      description: >-
        An invoice's `x402Url`, for AI agents and other x402 clients. Without
        payment it answers `402 Payment Required`: the `PAYMENT-REQUIRED` header
        (base64 JSON, x402 v2) lists the price in each accepted stablecoin, USDC
        and EURC on Base, each to the invoice's own address. Retry the same
        request with a signed `PAYMENT-SIGNATURE`; Cryptonly relays the transfer
        and pays the gas. `200` means the transfer is on chain, `202` that it
        was sent but not yet mined. The invoice becomes `paid` once the deposit
        is confirmed, as with any payment: use its status or the
        `invoice.statusChanged` webhook, never the HTTP status alone. A browser
        is redirected to the payment page.


        No API key required.
      operationId: payInvoiceX402
      parameters:
        - name: publicToken
          required: true
          in: path
          description: The token in the invoice's `x402Url`.
          schema:
            type: string
        - name: PAYMENT-SIGNATURE
          in: header
          description: >-
            Base64 x402 v2 `PaymentPayload` signed for one of the `accepts`
            entries.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: >-
            The transfer is on chain (`PAYMENT-RESPONSE` has it), or the invoice
            was already paid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402PaidResponseDto'
        '202':
          description: >-
            The transfer was sent and is not mined yet, or a payment is being
            confirmed. Do not pay again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402PaidResponseDto'
        '302':
          description: 'A browser: redirected to the hosted payment page.'
        '400':
          description: Request validation failed (e.g. missing or malformed body / query).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '402':
          description: >-
            Payment required. `PAYMENT-REQUIRED` (base64) holds what the body
            shows. After a refused payment, `error` and `PAYMENT-RESPONSE` say
            why; nothing was paid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402PaymentRequiredDto'
        '404':
          description: Unknown invoice, or x402 is off for it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
        '409':
          description: >-
            Another payment attempt holds the invoice (`Retry-After` says until
            when).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
        '410':
          description: >-
            The invoice can no longer be paid: `invoice_expired`,
            `invoice_cancelled`, `invoice_partially_paid`, `invoice_failed` or
            `invoice_suspended`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
        '429':
          description: >-
            Rate limit exceeded for this endpoint. Retry after the window
            resets. Code: `exceptions.rateLimit.exceeded`. The
            `extension.msBeforeNext` field tells you how long to wait.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '500':
          description: >-
            Unexpected server error. Safe to retry idempotent operations after a
            backoff.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MerchantApiErrorResponseDto'
        '503':
          description: x402 payments are temporarily unavailable (`Retry-After`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceX402StateResponseDto'
      security: []
      summary: 'x402: pay an invoice (POST)'
      tags:
        - x402
info:
  title: Cryptonly Payments API
  description: >-
    Server-to-server Cryptonly Payments API.


    Each operation that needs an API key requires one scope on it. A key missing
    that scope receives 403 `exceptions.auth.insufficientScope`. 


    - `invoices.list`

    - `invoices.create`

    - `invoices.cancel`

    - `withdrawals.list`

    - `withdrawals.create`

    - `deposits.list`

    - `deposits.create`

    - `currencies.list`

    - `x402.verify`

    - `x402.settle`

    - `x402.list`
  version: '1.0'
  contact: {}
tags: []
servers:
  - url: '["https://api-merchant.cryptonly.net"'
  - url: '"https://sandbox-api-merchant.cryptonly.net"]'
components:
  securitySchemes:
    TENANT_API_KEY:
      type: apiKey
      in: header
      name: x-tenant-api-key
      description: Secret key from the merchant dashboard. Authenticates one account.
  schemas:
    MerchantCurrencyListResponseDto:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MerchantCurrencyDto'
      required:
        - data
    MerchantApiErrorResponseDto:
      type: object
      properties:
        code:
          type: string
          description: >-
            Stable machine-readable error code, namespaced under `exceptions.`.
            Always prefer branching on this value over `message`. See the
            per-route `description`s for the codes that route emits.
          example: exceptions.auth.invalidApiKey
        message:
          type: string
          description: >-
            Human-readable explanation. Subject to wording changes; for
            programmatic checks use `code` instead.
          example: Invalid or missing API key
        extension:
          type: object
          description: >-
            Optional structured payload accompanying the error. For
            `exceptions.rateLimit.exceeded` includes `msBeforeNext`; for
            validation errors includes the offending field info.
          additionalProperties: true
          nullable: true
      required:
        - code
        - message
    MerchantFiatCurrencyListResponseDto:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/MerchantFiatCurrencyDto'
      required:
        - data
    WithdrawalQuoteRequestDto:
      type: object
      properties:
        cryptoCurrencyCode:
          type: string
          description: Currency code.
          example: USDT_TRC20
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
        address:
          type: string
          description: Destination wallet address
        amount:
          type: number
          description: Withdrawal amount in `cryptoCurrencyCode`
          example: 100
        allowAutoConvert:
          type: boolean
          description: >-
            If true and the withdrawal-asset balance is short of amount +
            on-chain fee, the quote may add a `currency_conversion` to top up
            that balance (0.2% commission in the source asset; none for USDT <->
            USDC) before a normal same-currency withdrawal. Commit reuses the
            locked `currency_conversion` row.
          default: false
        orderId:
          type: string
          description: >-
            Merchant idempotency key, scoped to (tenant, account). Two quote
            requests sharing an `orderId` collapse to the same quote, and the
            pair `(orderId, account)` can ever back at most one committed
            withdrawal - re-quoting after commit fails with `409`.
      required:
        - cryptoCurrencyCode
        - address
        - amount
        - orderId
    WithdrawalQuoteDataResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/WithdrawalQuoteResponseDto'
      required:
        - data
    CommitWithdrawalRequestDto:
      type: object
      properties:
        quoteId:
          type: string
          description: Quote id from `POST /withdrawal/quote`.
          format: uuid
        customData:
          type: object
          description: Custom metadata
        webhookUrl:
          type: string
          description: >-
            HTTPS URL to receive webhook notifications. Must be a public,
            TLD-qualified HTTPS URL.
          example: https://merchant.example.com/webhooks/cryptonly/withdrawals
      required:
        - quoteId
    WithdrawalDataResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/WithdrawalDto'
      required:
        - data
    WithdrawalListResponseDto:
      type: object
      properties:
        total:
          type: number
          description: Total number of matching rows.
        page:
          type: number
          description: 1-indexed page number that was returned.
        limit:
          type: number
          description: Items per page that were returned.
        hasMore:
          type: boolean
          description: True if there is at least one more page after this one.
        data:
          type: array
          items:
            $ref: '#/components/schemas/WithdrawalDto'
      required:
        - total
        - page
        - limit
        - hasMore
        - data
    InvoiceStatusChangedWebhookBodyDto:
      type: object
      properties:
        event:
          type: string
          enum:
            - invoice.statusChanged
          example: invoice.statusChanged
        data:
          $ref: '#/components/schemas/InvoiceStatusChangedWebhookDataDto'
        timestamp:
          type: string
          description: ISO 8601 timestamp when Cryptonly signed and sent the webhook.
          example: '2026-01-01T12:00:00.000Z'
      required:
        - event
        - data
        - timestamp
    DepositStatusChangedWebhookBodyDto:
      type: object
      properties:
        event:
          type: string
          enum:
            - deposit.statusChanged
          example: deposit.statusChanged
        data:
          $ref: '#/components/schemas/DepositStatusChangedWebhookDataDto'
        timestamp:
          type: string
          description: ISO 8601 timestamp when Cryptonly signed and sent the webhook.
          example: '2026-01-01T12:00:00.000Z'
      required:
        - event
        - data
        - timestamp
    WithdrawalStatusChangedWebhookBodyDto:
      type: object
      properties:
        event:
          type: string
          enum:
            - withdrawal.statusChanged
          example: withdrawal.statusChanged
        data:
          $ref: '#/components/schemas/WithdrawalStatusChangedWebhookDataDto'
        timestamp:
          type: string
          description: ISO 8601 timestamp when Cryptonly signed and sent the webhook.
          example: '2026-01-01T12:00:00.000Z'
      required:
        - event
        - data
        - timestamp
    CreateDepositApiKeyRequestDto:
      type: object
      properties:
        cryptoCurrencyCode:
          type: string
          description: Crypto currency code.
          example: USDT_TRC20
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
        orderId:
          type: string
          description: Merchant idempotency key (unique per account).
        customerId:
          type: string
          description: Optional merchant customer reference.
        webhookUrl:
          type: string
          description: >-
            HTTPS webhook for deposit status events. Overrides tenant default
            deposit webhook.
          example: https://merchant.example.com/webhooks/cryptonly/deposits
      required:
        - cryptoCurrencyCode
        - orderId
    DepositCreatedResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/DepositCreateDataDto'
      required:
        - data
    TenantApiKeyDepositDataResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/TenantApiKeyDepositResponseDto'
      required:
        - data
    DepositListResponseDto:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/TenantApiKeyDepositResponseDto'
        total:
          type: number
        page:
          type: number
        limit:
          type: number
        hasMore:
          type: boolean
          description: True if there is at least one more page after this one.
      required:
        - data
        - total
        - page
        - limit
        - hasMore
    CreateInvoiceApiKeyRequestDto:
      type: object
      properties:
        amount:
          type: number
          description: >-
            Fiat amount charged by the invoice. If a positive `amount` is sent,
            it is the invoice total even when `items` are also sent. Provide at
            least one of `amount` or `items`.
          minimum: 0
          example: 49.99
        items:
          description: >-
            Optional line items shown on the payment page. Used to compute the
            total only when `amount` is omitted.
          type: array
          items:
            $ref: '#/components/schemas/InvoiceItemDto'
        fiatCurrencyCode:
          type: string
          description: ISO-4217 fiat currency code (e.g. `USD`, `EUR`).
          example: USD
        orderId:
          type: string
          description: >-
            Merchant-side idempotency key. Must be unique within your tenant.
            Retrying the request with the same `orderId` returns a 409.
          example: order_2026_04_001
          maxLength: 256
        description:
          type: string
          description: Free-form description shown on the payment page.
          maxLength: 512
        webhookUrl:
          type: string
          description: >-
            HTTPS URL to receive webhook notifications about this invoice. Must
            be a public, TLD-qualified HTTPS URL.
          example: https://merchant.example.com/webhooks/cryptonly
        returnUrl:
          type: string
          description: >-
            HTTP(S) URL for the "Return to merchant" CTA when the invoice is
            `cancelled` or `expired`. Accepts any http(s) URL, including local
            development hosts such as `http://localhost:8000/...`.
          example: https://merchant.example.com/orders/order_2026_04_001
          maxLength: 512
        successUrl:
          type: string
          description: >-
            HTTP(S) URL for the "Return to merchant" CTA when the invoice is
            `paid` or `overpaid`. Accepts any http(s) URL, including local
            development hosts such as `http://localhost:8000/...`.
          example: https://merchant.example.com/orders/order_2026_04_001/success
          maxLength: 512
        failedUrl:
          type: string
          description: >-
            HTTP(S) URL for the "Return to merchant" CTA when the invoice is
            `failed`, `suspended`, or `partially_paid`. Accepts any http(s) URL,
            including local development hosts such as
            `http://localhost:8000/...`.
          example: https://merchant.example.com/orders/order_2026_04_001/failed
          maxLength: 512
        expiresInMinutes:
          type: number
          description: >-
            Invoice expiry in minutes from creation. Clamped to a server-side
            maximum. Maximum is 30 days.
          minimum: 15
          maximum: 43200
        customerId:
          type: string
          description: Customer ID from your system.
          example: customer_1234567890
          maxLength: 52
        customPayload:
          type: string
          description: Custom payload to be sent to the webhook.
          example: '{"key1":"value1","key2":"value2"}'
          maxLength: 2048
        number:
          type: string
          maxLength: 256
          description: >-
            Optional reference shown to the customer on the payment page (e.g.
            order or invoice id). If empty - orderId is shown instead.
        x402Enabled:
          type: boolean
          description: >-
            Whether AI agents may pay the invoice over `x402Url`. Defaults to
            true; with false the invoice has no `x402Url`.
          default: true
      required:
        - fiatCurrencyCode
        - orderId
    InvoiceCreatedResponseDto:
      type: object
      properties:
        data:
          description: Invoice data (same shape as GET /invoice).
          allOf:
            - $ref: '#/components/schemas/InvoiceCreatedDataDto'
      required:
        - data
    TenantApiKeyInvoiceDataResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/TenantApiKeyInvoiceResponseDto'
      required:
        - data
    InvoiceListResponseDto:
      type: object
      properties:
        total:
          type: number
          description: Total number of matching rows.
        page:
          type: number
          description: 1-indexed page number that was returned.
        limit:
          type: number
          description: Items per page that were returned.
        hasMore:
          type: boolean
          description: True if there is at least one more page after this one.
        data:
          type: array
          items:
            $ref: '#/components/schemas/TenantApiKeyInvoiceResponseDto'
      required:
        - total
        - page
        - limit
        - hasMore
        - data
    X402SupportedResponseDto:
      type: object
      properties:
        kinds:
          type: array
          items:
            $ref: '#/components/schemas/X402SupportedKindDto'
        extensions:
          example: []
          type: array
          items:
            type: string
        signers:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            eip155:*:
              - '0x6C3A8A1a2c63d3e6b4B5E9D1c1F0ae4B7e8d2f10'
          description: Fee-payer addresses by CAIP-2 pattern.
      required:
        - kinds
        - extensions
        - signers
    X402ConfigResponseDto:
      type: object
      properties:
        account:
          $ref: '#/components/schemas/X402ConfigAccountDto'
        environment:
          type: string
          enum:
            - production
            - sandbox
        network:
          type: string
          example: eip155:84532
          description: Base network; see `networks` for every network.
        payTo:
          description: '`payTo` on Base.'
          allOf:
            - $ref: '#/components/schemas/X402ConfigPayToDto'
        networks:
          type: array
          items:
            $ref: '#/components/schemas/X402ConfigNetworkDto'
        assets:
          type: array
          items:
            $ref: '#/components/schemas/X402ConfigAssetDto'
        resources:
          type: array
          items:
            $ref: '#/components/schemas/X402ConfigResourceDto'
        fees:
          $ref: '#/components/schemas/X402FeePlanDto'
        limits:
          $ref: '#/components/schemas/X402ConfigLimitsDto'
      required:
        - account
        - environment
        - network
        - payTo
        - networks
        - assets
        - resources
        - fees
        - limits
    X402SettlementListResponseDto:
      type: object
      properties:
        total:
          type: number
          description: Total number of matching rows.
        page:
          type: number
          description: 1-indexed page number that was returned.
        limit:
          type: number
          description: Items per page that were returned.
        hasMore:
          type: boolean
          description: True if there is at least one more page after this one.
        data:
          type: array
          items:
            $ref: '#/components/schemas/X402SettlementDto'
      required:
        - total
        - page
        - limit
        - hasMore
        - data
    X402SettlementDataResponseDto:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/X402SettlementDto'
      required:
        - data
    X402FacilitatorRequestDto:
      type: object
      properties:
        x402Version:
          type: number
          example: 2
          enum:
            - 2
        paymentPayload:
          $ref: '#/components/schemas/X402PaymentPayloadDto'
        paymentRequirements:
          description: The requirements the seller is enforcing for this request.
          allOf:
            - $ref: '#/components/schemas/X402PaymentRequirementsDto'
      required:
        - paymentPayload
        - paymentRequirements
    X402VerifyResponseDto:
      type: object
      properties:
        isValid:
          type: boolean
          example: true
        invalidReason:
          description: Set when `isValid` is false.
          allOf:
            - $ref: '#/components/schemas/X402Reason'
        payer:
          type: string
          example: '0x857b06519E91e3A54538791bDbb0E22373e36b66'
          description: '`authorization.from`, once the payload parses.'
      required:
        - isValid
    X402SettleResponseDto:
      type: object
      properties:
        success:
          type: boolean
          example: true
        errorReason:
          description: >-
            Set when `success` is false. `settlement_pending` comes with a
            non-empty `transaction`.
          allOf:
            - $ref: '#/components/schemas/X402Reason'
        payer:
          type: string
          example: '0x857b06519E91e3A54538791bDbb0E22373e36b66'
        transaction:
          type: string
          example: '0xabababababababababababababababababababababababababababababababab'
          description: Transaction hash. Empty when nothing was broadcast.
        network:
          type: string
          example: eip155:84532
          description: CAIP-2 network id.
        amount:
          type: string
          example: '1000'
          description: Atomic units.
        extra:
          description: Set when `success` is true.
          allOf:
            - $ref: '#/components/schemas/X402SettleFeeDto'
      required:
        - success
        - transaction
        - network
    X402PaymentWebhookBodyDto:
      type: object
      properties:
        event:
          type: string
          enum:
            - x402.payment.settled
            - x402.payment.failed
            - x402.payment.credited
          example: x402.payment.settled
          description: >-
            `settled`: the payment confirmed on chain. `failed`: it will not
            settle. `credited` (balance mode): the payment, less the fee, is on
            the account balance.
        data:
          $ref: '#/components/schemas/X402SettlementDto'
        timestamp:
          type: string
          description: ISO 8601 timestamp when Cryptonly signed and sent the webhook.
          example: '2026-01-01T12:00:00.000Z'
      required:
        - event
        - data
        - timestamp
    InvoiceX402PaidResponseDto:
      type: object
      properties:
        error:
          type: string
          example: invoice_expired
          description: Set on 404, 409, 410 and 503.
        invoiceId:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - created
            - processing
            - paid
            - partially_paid
            - overpaid
            - expired
            - cancelled
            - failed
            - suspended
        amount:
          type: number
        fiatCurrencyCode:
          type: string
        expiresAt:
          type: string
          nullable: true
        paymentPageUrl:
          type: string
        payment:
          $ref: '#/components/schemas/InvoiceX402PaymentDto'
        paidAt:
          type: string
          description: Set once the invoice is paid.
    InvoiceX402PaymentRequiredDto:
      type: object
      properties:
        x402Version:
          type: number
          example: 2
        error:
          type: string
          description: >-
            `payment_required`, or why the last payment was refused (an x402
            reason code).
          example: payment_required
        resource:
          $ref: '#/components/schemas/InvoiceX402ResourceDto'
        accepts:
          description: >-
            One entry per stablecoin, the one pegged to the invoice currency
            first.
          type: array
          items:
            $ref: '#/components/schemas/InvoiceX402RequirementsDto'
        extensions:
          type: object
          description: >-
            `payment-identifier`: send an `id` (16-128 of `[A-Za-z0-9_-]`) to
            make retries idempotent.
          additionalProperties: true
      required:
        - x402Version
        - error
        - resource
        - accepts
        - extensions
    InvoiceX402StateResponseDto:
      type: object
      properties:
        error:
          type: string
          example: invoice_expired
          description: Set on 404, 409, 410 and 503.
        invoiceId:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - created
            - processing
            - paid
            - partially_paid
            - overpaid
            - expired
            - cancelled
            - failed
            - suspended
        amount:
          type: number
        fiatCurrencyCode:
          type: string
        expiresAt:
          type: string
          nullable: true
        paymentPageUrl:
          type: string
    MerchantCurrencyDto:
      type: object
      properties:
        code:
          type: string
          description: Currency code.
          example: USDT_TRC20
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
        name:
          type: string
          description: Human-readable currency name.
        network:
          type: string
          description: Blockchain network the currency lives on.
          enum:
            - Tron
            - Solana
            - Ethereum
            - BNB
            - BTC
            - Base
        tokenType:
          type: string
          description: >-
            Token standard (ERC20, TRC20, BEP20, ...) for non-native assets.
            Omitted for chain-native coins.
          enum:
            - erc20
            - trc20
            - bep20
            - spl
        decimalPlaces:
          type: number
          description: >-
            Number of decimal places. Use to format on-chain amounts for
            display.
        minDepositAmount:
          type: number
          description: >-
            Smallest accepted deposit amount in this currency, raised to cover
            the network fee. Deposits below this threshold are not credited.
        depositNetworkFee:
          nullable: true
          description: >-
            Current payer network fee; `null` while no live quote exists, in
            which case new deposits in this currency are temporarily refused.
          allOf:
            - $ref: '#/components/schemas/MerchantDepositNetworkFeeDto'
        minWithdrawalAmount:
          type: number
          description: Smallest accepted withdrawal amount in this currency.
        depositCommission:
          type: number
          description: >-
            Effective deposit commission for the authenticated tenant. Reflects
            the per-tenant override when configured, otherwise the system
            default.
          example: 0.005
        contractAddress:
          type: string
          description: >-
            Smart contract address for token currencies (`null` for native
            coins).
          nullable: true
        imageUrl:
          type: string
          description: Optional URL to a currency icon, suitable for UI display.
          nullable: true
        networkIconUrl:
          type: string
          description: >-
            Optional URL for the underlying chain / network icon (e.g. on
            multi-network stablecoin pickers).
          nullable: true
        addressMask:
          type: string
          description: >-
            Optional regex (as a string) merchants can run client-side to
            pre-validate destination addresses before calling `POST
            /withdrawal/quote`.
          nullable: true
      required:
        - code
        - name
        - network
        - decimalPlaces
        - minDepositAmount
        - depositNetworkFee
        - minWithdrawalAmount
        - depositCommission
        - contractAddress
        - imageUrl
        - addressMask
    MerchantFiatCurrencyDto:
      type: object
      properties:
        code:
          type: string
          description: ISO 4217-style currency code, e.g. `USD`, `EUR`, `RUB`.
          example: USD
        name:
          type: string
          description: Human-readable currency name.
        decimalPlaces:
          type: number
          description: Decimal places to use when formatting amounts (e.g. `2` for USD).
        minInvoiceAmount:
          type: number
          description: >-
            Smallest invoice amount accepted in this currency on `POST
            /invoice`.
      required:
        - code
        - name
        - decimalPlaces
        - minInvoiceAmount
    WithdrawalQuoteResponseDto:
      type: object
      properties:
        quoteId:
          type: string
          description: Opaque quote id; submit to `POST /withdrawal/commit` to commit.
        orderId:
          type: string
          description: >-
            Echo of the merchant `orderId` supplied at quote time. The merchant
            should persist this against their order so support tickets and
            webhooks correlate cleanly.
        cryptoCurrencyCode:
          type: string
          description: Currency code.
          example: USDT_TRC20
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
        address:
          type: string
          description: Echo of `address`
        amount:
          type: number
          description: >-
            Echo of `amount` - denominated in `cryptoCurrencyCode` (this is what
            reaches the destination address).
        autoConvert:
          description: >-
            When present, a virtual conversion is locked to top up the
            withdrawal asset before the withdrawal debit. `commissionAmount` is
            in `fromAssetCode`.
          nullable: true
          allOf:
            - $ref: '#/components/schemas/WithdrawalAutoConvertPreviewDto'
        totalDeduction:
          type: number
          description: >-
            Total to debit in `cryptoCurrencyCode` at commit (on-chain amount +
            on-chain fee component in the withdrawal asset).
        fee:
          $ref: '#/components/schemas/WithdrawalQuoteFeeBreakdownDto'
        expiresAt:
          type: string
          description: >-
            ISO timestamp after which the quote can no longer be committed.
            Re-issue a new quote if expired.
      required:
        - quoteId
        - orderId
        - cryptoCurrencyCode
        - address
        - amount
        - totalDeduction
        - fee
        - expiresAt
    WithdrawalDto:
      type: object
      properties:
        id:
          type: string
        orderId:
          type: string
        accountId:
          type: string
        cryptoCurrencyCode:
          type: string
          description: Currency code.
          example: USDT_TRC20
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
        address:
          type: string
          description: Destination wallet address
        transactionHash:
          type: string
          nullable: true
          description: On-chain transaction hash
        amount:
          type: number
          description: Withdrawal amount in `cryptoCurrencyCode`
        amountUsd:
          type: number
          description: Withdrawal amount in USD
        status:
          type: string
          enum:
            - created
            - processing
            - completed
            - failed
            - cancelled
        convertId:
          type: string
          nullable: true
          format: uuid
          description: >-
            Optional funding `currency_conversion` that topped up the withdrawal
            asset before this withdrawal debit (auto-convert).
        feeAmount:
          type: number
          description: >-
            Network fee debited from the user in `cryptoCurrencyCode` (same
            value used in `debitedAmount` = amount + this fee)
        feeAmountUsd:
          type: number
          description: Same fee, snapshotted to USD at commit time
        debitedAmount:
          type: number
          description: >-
            Exact total debited in `cryptoCurrencyCode` (on-chain amount +
            on-chain fee)
        customData:
          type: object
        webhookUrl:
          type: string
          nullable: true
        source:
          type: string
          enum:
            - api
            - admin_panel
          description: >-
            Commit channel; omitted when unknown (rows created before this
            metadata existed).
        createdAt:
          type: string
          description: ISO 8601 timestamp.
        updatedAt:
          type: string
          description: ISO 8601 timestamp.
        quoteId:
          type: string
          nullable: true
          format: uuid
          description: >-
            Opaque id from the quote phase; equals the committed network
            transfer id when set.
        transferId:
          type: string
          nullable: true
          format: uuid
          description: Network transfer backing this withdrawal once committed.
      required:
        - id
        - orderId
        - accountId
        - cryptoCurrencyCode
        - address
        - amount
        - amountUsd
        - status
        - feeAmount
        - feeAmountUsd
        - debitedAmount
        - createdAt
        - updatedAt
        - quoteId
        - transferId
    InvoiceStatusChangedWebhookDataDto:
      type: object
      properties:
        id:
          type: string
        accountId:
          type: string
          format: uuid
        orderId:
          type: string
        amount:
          type: number
        fiatCurrencyCode:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceItemDto'
        status:
          type: string
          enum:
            - created
            - processing
            - paid
            - partially_paid
            - overpaid
            - expired
            - cancelled
            - failed
            - suspended
        cryptoCurrencyCode:
          type: string
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
          example: USDT_TRC20
        cryptoAmountExpected:
          type: number
        cryptoAmountReceived:
          type: number
        address:
          type: string
        txHash:
          type: string
        settlement:
          $ref: '#/components/schemas/SettlementBreakdownDto'
        description:
          type: string
        number:
          type: string
          maxLength: 256
          description: >-
            Optional reference for the customer on the payment page, when set at
            creation.
        webhookUrl:
          type: string
        returnUrl:
          type: string
          description: >-
            Browser CTA URL for `cancelled` / `expired`, when provided at
            creation.
        successUrl:
          type: string
          description: Browser CTA URL for `paid` / `overpaid`, when provided at creation.
        failedUrl:
          type: string
          description: >-
            Browser CTA URL for `failed` / `suspended` / `partially_paid`, when
            provided at creation.
        expiresAt:
          type: string
          description: ISO 8601 timestamp.
        createdAt:
          type: string
          description: ISO 8601 timestamp.
        paidAt:
          type: string
          description: When payment settled (ISO 8601), if applicable.
        customerId:
          type: string
          description: Merchant-supplied customer reference when provided at creation.
        customPayload:
          type: string
          description: Opaque string from creation; echoed on webhooks when set.
        paymentPageUrl:
          type: string
          description: Hosted payment page URL for this invoice.
          example: https://payment.cryptonly.com/invoice/...
        x402Url:
          type: string
          description: >-
            x402 payment URL for AI agents. A request without payment answers
            `402 Payment Required` with a `PAYMENT-REQUIRED` header listing the
            price in each stablecoin; a retry with a signed `PAYMENT-SIGNATURE`
            pays the invoice. Treat the invoice status, not that HTTP 200, as
            the outcome. Omitted when x402 is off for the invoice.
          example: https://api-merchant.cryptonly.net/x402/invoice/...
        paymentChannel:
          type: string
          enum:
            - address
            - x402
          description: >-
            How the payer paid, once a payment was seen: `address` (a transfer
            to the deposit address) or `x402` (an agent paid `x402Url`).
        source:
          type: string
          enum:
            - api
            - admin_panel
          description: >-
            Creation channel; omitted when unknown (rows created before this
            metadata existed).
        previousStatus:
          type: string
          enum:
            - created
            - processing
            - paid
            - partially_paid
            - overpaid
            - expired
            - cancelled
            - failed
            - suspended
          description: Status immediately before this transition.
      required:
        - id
        - accountId
        - amount
        - fiatCurrencyCode
        - items
        - status
        - expiresAt
        - createdAt
        - paymentPageUrl
    DepositStatusChangedWebhookDataDto:
      type: object
      properties:
        id:
          type: string
        accountId:
          type: string
          format: uuid
        orderId:
          type: string
        customerId:
          type: string
        status:
          type: string
          enum:
            - created
            - processing
            - completed
            - suspended
            - failed
            - expired
            - cancelled
        cryptoCurrencyCode:
          type: string
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
          example: USDT_TRC20
        address:
          type: string
        expiresAt:
          type: string
        createdAt:
          type: string
        updatedAt:
          type: string
        settlement:
          $ref: '#/components/schemas/SettlementBreakdownDto'
        previousStatus:
          type: string
          enum:
            - created
            - processing
            - completed
            - suspended
            - failed
            - expired
            - cancelled
          description: Status immediately before this transition.
        depositTransactionHash:
          type: string
          nullable: true
        actuallyReceivedAmount:
          type: number
          nullable: true
        actuallyReceivedAmountUsd:
          type: number
          nullable: true
      required:
        - id
        - accountId
        - status
        - cryptoCurrencyCode
        - expiresAt
        - createdAt
        - updatedAt
    WithdrawalStatusChangedWebhookDataDto:
      type: object
      properties:
        id:
          type: string
        orderId:
          type: string
        accountId:
          type: string
        cryptoCurrencyCode:
          type: string
          description: Currency code.
          example: USDT_TRC20
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
        address:
          type: string
          description: Destination wallet address
        transactionHash:
          type: string
          nullable: true
          description: On-chain transaction hash
        amount:
          type: number
          description: Withdrawal amount in `cryptoCurrencyCode`
        amountUsd:
          type: number
          description: Withdrawal amount in USD
        status:
          type: string
          enum:
            - created
            - processing
            - completed
            - failed
            - cancelled
        convertId:
          type: string
          nullable: true
          format: uuid
          description: >-
            Optional funding `currency_conversion` that topped up the withdrawal
            asset before this withdrawal debit (auto-convert).
        feeAmount:
          type: number
          description: >-
            Network fee debited from the user in `cryptoCurrencyCode` (same
            value used in `debitedAmount` = amount + this fee)
        feeAmountUsd:
          type: number
          description: Same fee, snapshotted to USD at commit time
        debitedAmount:
          type: number
          description: >-
            Exact total debited in `cryptoCurrencyCode` (on-chain amount +
            on-chain fee)
        customData:
          type: object
        webhookUrl:
          type: string
          nullable: true
        source:
          type: string
          enum:
            - api
            - admin_panel
          description: >-
            Commit channel; omitted when unknown (rows created before this
            metadata existed).
        createdAt:
          type: string
          description: ISO 8601 timestamp.
        updatedAt:
          type: string
          description: ISO 8601 timestamp.
        quoteId:
          type: string
          nullable: true
          format: uuid
          description: >-
            Opaque id from the quote phase; equals the committed network
            transfer id when set.
        transferId:
          type: string
          nullable: true
          format: uuid
          description: Network transfer backing this withdrawal once committed.
        previousStatus:
          type: string
          enum:
            - created
            - processing
            - completed
            - failed
            - cancelled
          description: Status immediately before this transition.
      required:
        - id
        - orderId
        - accountId
        - cryptoCurrencyCode
        - address
        - amount
        - amountUsd
        - status
        - feeAmount
        - feeAmountUsd
        - debitedAmount
        - createdAt
        - updatedAt
        - quoteId
        - transferId
    DepositCreateDataDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        minimumAmount:
          type: number
        address:
          type: string
        createdAt:
          type: string
          description: ISO 8601 — when the deposit address window started.
        expiresAt:
          type: string
          description: ISO 8601 expiry for the deposit address.
        qrCode:
          type: string
          description: PNG QR code as a data URL (data:image/png;base64,...).
      required:
        - id
        - minimumAmount
        - address
        - createdAt
        - expiresAt
        - qrCode
    TenantApiKeyDepositResponseDto:
      type: object
      properties:
        id:
          type: string
        accountId:
          type: string
          format: uuid
        orderId:
          type: string
        customerId:
          type: string
        status:
          type: string
          enum:
            - created
            - processing
            - completed
            - suspended
            - failed
            - expired
            - cancelled
        cryptoCurrencyCode:
          type: string
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
          example: USDT_TRC20
        address:
          type: string
        expiresAt:
          type: string
        createdAt:
          type: string
        updatedAt:
          type: string
        settlement:
          $ref: '#/components/schemas/SettlementBreakdownDto'
      required:
        - id
        - accountId
        - status
        - cryptoCurrencyCode
        - expiresAt
        - createdAt
        - updatedAt
    InvoiceItemDto:
      type: object
      properties:
        name:
          type: string
        quantity:
          type: number
        cost:
          type: number
      required:
        - name
        - quantity
        - cost
    InvoiceCreatedDataDto:
      type: object
      properties:
        id:
          type: string
        accountId:
          type: string
          format: uuid
        orderId:
          type: string
        amount:
          type: number
        fiatCurrencyCode:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceItemDto'
        status:
          type: string
          enum:
            - created
            - processing
            - paid
            - partially_paid
            - overpaid
            - expired
            - cancelled
            - failed
            - suspended
        cryptoCurrencyCode:
          type: string
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
          example: USDT_TRC20
        cryptoAmountExpected:
          type: number
        cryptoAmountReceived:
          type: number
        address:
          type: string
        txHash:
          type: string
        settlement:
          $ref: '#/components/schemas/SettlementBreakdownDto'
        description:
          type: string
        number:
          type: string
          maxLength: 256
          description: >-
            Optional reference for the customer on the payment page, when set at
            creation.
        webhookUrl:
          type: string
        returnUrl:
          type: string
          description: >-
            Browser CTA URL for `cancelled` / `expired`, when provided at
            creation.
        successUrl:
          type: string
          description: Browser CTA URL for `paid` / `overpaid`, when provided at creation.
        failedUrl:
          type: string
          description: >-
            Browser CTA URL for `failed` / `suspended` / `partially_paid`, when
            provided at creation.
        expiresAt:
          type: string
          description: ISO 8601 timestamp.
        createdAt:
          type: string
          description: ISO 8601 timestamp.
        paidAt:
          type: string
          description: When payment settled (ISO 8601), if applicable.
        customerId:
          type: string
          description: Merchant-supplied customer reference when provided at creation.
        customPayload:
          type: string
          description: Opaque string from creation; echoed on webhooks when set.
        paymentPageUrl:
          type: string
          description: Hosted payment page URL for this invoice.
          example: https://payment.cryptonly.com/invoice/...
        x402Url:
          type: string
          description: >-
            x402 payment URL for AI agents. A request without payment answers
            `402 Payment Required` with a `PAYMENT-REQUIRED` header listing the
            price in each stablecoin; a retry with a signed `PAYMENT-SIGNATURE`
            pays the invoice. Treat the invoice status, not that HTTP 200, as
            the outcome. Omitted when x402 is off for the invoice.
          example: https://api-merchant.cryptonly.net/x402/invoice/...
        paymentChannel:
          type: string
          enum:
            - address
            - x402
          description: >-
            How the payer paid, once a payment was seen: `address` (a transfer
            to the deposit address) or `x402` (an agent paid `x402Url`).
        source:
          type: string
          enum:
            - api
            - admin_panel
          description: >-
            Creation channel; omitted when unknown (rows created before this
            metadata existed).
      required:
        - id
        - accountId
        - amount
        - fiatCurrencyCode
        - items
        - status
        - expiresAt
        - createdAt
        - paymentPageUrl
    TenantApiKeyInvoiceResponseDto:
      type: object
      properties:
        id:
          type: string
        accountId:
          type: string
          format: uuid
        orderId:
          type: string
        amount:
          type: number
        fiatCurrencyCode:
          type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceItemDto'
        status:
          type: string
          enum:
            - created
            - processing
            - paid
            - partially_paid
            - overpaid
            - expired
            - cancelled
            - failed
            - suspended
        cryptoCurrencyCode:
          type: string
          enum:
            - USDT_TRC20
            - USDT_ERC20
            - USDT_BEP20
            - USDC_ERC20
            - USDC_BEP20
            - USDC_BASE
            - EURC_BASE
            - LINK_ERC20
            - LINK_BEP20
            - ETH
            - TRX
            - BNB
            - BTC
            - ETH_BASE
            - SOL
            - USDC_SOL
            - USDT_SOL
          example: USDT_TRC20
        cryptoAmountExpected:
          type: number
        cryptoAmountReceived:
          type: number
        address:
          type: string
        txHash:
          type: string
        settlement:
          $ref: '#/components/schemas/SettlementBreakdownDto'
        description:
          type: string
        number:
          type: string
          maxLength: 256
          description: >-
            Optional reference for the customer on the payment page, when set at
            creation.
        webhookUrl:
          type: string
        returnUrl:
          type: string
          description: >-
            Browser CTA URL for `cancelled` / `expired`, when provided at
            creation.
        successUrl:
          type: string
          description: Browser CTA URL for `paid` / `overpaid`, when provided at creation.
        failedUrl:
          type: string
          description: >-
            Browser CTA URL for `failed` / `suspended` / `partially_paid`, when
            provided at creation.
        expiresAt:
          type: string
          description: ISO 8601 timestamp.
        createdAt:
          type: string
          description: ISO 8601 timestamp.
        paidAt:
          type: string
          description: When payment settled (ISO 8601), if applicable.
        customerId:
          type: string
          description: Merchant-supplied customer reference when provided at creation.
        customPayload:
          type: string
          description: Opaque string from creation; echoed on webhooks when set.
        paymentPageUrl:
          type: string
          description: Hosted payment page URL for this invoice.
          example: https://payment.cryptonly.com/invoice/...
        x402Url:
          type: string
          description: >-
            x402 payment URL for AI agents. A request without payment answers
            `402 Payment Required` with a `PAYMENT-REQUIRED` header listing the
            price in each stablecoin; a retry with a signed `PAYMENT-SIGNATURE`
            pays the invoice. Treat the invoice status, not that HTTP 200, as
            the outcome. Omitted when x402 is off for the invoice.
          example: https://api-merchant.cryptonly.net/x402/invoice/...
        paymentChannel:
          type: string
          enum:
            - address
            - x402
          description: >-
            How the payer paid, once a payment was seen: `address` (a transfer
            to the deposit address) or `x402` (an agent paid `x402Url`).
        source:
          type: string
          enum:
            - api
            - admin_panel
          description: >-
            Creation channel; omitted when unknown (rows created before this
            metadata existed).
      required:
        - id
        - accountId
        - amount
        - fiatCurrencyCode
        - items
        - status
        - expiresAt
        - createdAt
        - paymentPageUrl
    X402SupportedKindDto:
      type: object
      properties:
        x402Version:
          type: number
          example: 2
        scheme:
          type: string
          example: exact
        network:
          type: string
          example: eip155:84532
        extra:
          type: object
          additionalProperties: true
          example:
            feePayer: 7P6XktW1QSA9g7VN2pr77LPP5DVGf9qkwad41cxP81Tk
          description: >-
            Solana: `feePayer` is the address to name as fee payer (goes into
            `extra` of the payment requirements).
      required:
        - x402Version
        - scheme
        - network
    X402ConfigAccountDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
          example: Main
          description: Internal ledger name, for log lines.
        serviceName:
          type: string
          nullable: true
          example: Weather API
          description: >-
            The listing name: `resource.serviceName` in every 402. Null until
            set.
        iconUrl:
          type: string
          nullable: true
          description: >-
            `resource.iconUrl` in every 402: the checkout logo, when Bazaar
            accepts it.
        status:
          type: string
          enum:
            - active
            - tenant_blocked
            - suspended
            - tenant_not_verified
      required:
        - id
        - name
        - serviceName
        - iconUrl
        - status
    X402ConfigPayToDto:
      type: object
      properties:
        mode:
          allOf:
            - $ref: '#/components/schemas/X402PayoutMode'
        address:
          type: string
          nullable: true
          example: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC'
      required:
        - mode
        - address
    X402ConfigNetworkDto:
      type: object
      properties:
        network:
          type: string
          example: solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1
        payTo:
          $ref: '#/components/schemas/X402ConfigPayToDto'
      required:
        - network
        - payTo
    X402ConfigAssetDto:
      type: object
      properties:
        symbol:
          type: string
          example: USDC
        currencyCode:
          type: string
          example: USDC_BASE
        address:
          type: string
          example: '0x036CbD53842c5426634e7929541eC2318f3dCF7e'
        decimals:
          type: number
          example: 6
        methods:
          example:
            - eip3009
          type: array
          items:
            type: string
        minAmount:
          type: string
          example: '1000'
        network:
          type: string
          example: eip155:84532
          description: CAIP-2 network of the asset.
        payTo:
          type: string
          nullable: true
          example: '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC'
          description: '`payTo` on the asset''s network; null until set up there.'
        eip712:
          type: object
          example:
            name: USDC
            version: '2'
          description: 'EVM: EIP-712 domain; goes into `extra` of the payment requirements.'
        feePayer:
          type: string
          example: 7P6XktW1QSA9g7VN2pr77LPP5DVGf9qkwad41cxP81Tk
          description: 'Solana: fee payer; goes into `extra.feePayer`.'
      required:
        - symbol
        - currencyCode
        - address
        - decimals
        - methods
        - minAmount
        - network
        - payTo
    X402ConfigResourceDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        method:
          type: string
          example: GET
        path:
          type: string
          example: /weather/:city
          description: Path of the resource URL, the route key.
        prices:
          description: One per currency, in the order the 402 offers them; never empty.
          type: array
          items:
            $ref: '#/components/schemas/X402ConfigPriceDto'
        scheme:
          type: string
          example: exact
        maxTimeoutSeconds:
          type: number
          example: 300
        description:
          type: string
          nullable: true
        mimeType:
          type: string
          nullable: true
        tags:
          example:
            - weather
            - forecast
          description: '`resource.tags` in the 402.'
          type: array
          items:
            type: string
        discoverable:
          type: boolean
        inputSchema:
          type: object
          nullable: true
          additionalProperties: true
        outputSchema:
          type: object
          nullable: true
          additionalProperties: true
      required:
        - id
        - method
        - path
        - prices
        - scheme
        - maxTimeoutSeconds
        - description
        - mimeType
        - tags
        - discoverable
        - inputSchema
        - outputSchema
    X402FeePlanDto:
      type: object
      properties:
        charged:
          type: boolean
          description: 'False in sandbox: settlements there are free.'
        freeSettlementsPerMonth:
          type: number
          example: 100
        usedThisMonth:
          type: number
          example: 12
          description: Tenant-wide, this UTC month.
        freeRemainingThisMonth:
          type: number
          example: 88
        settlementFeeUsd:
          type: string
          example: '0.0025'
          description: >-
            Flat fee per confirmed settlement after the free tier: from x402
            credits (own wallet) or deducted at credit (Base balance mode).
        credits:
          description: The x402 credits own-wallet fees are paid from.
          allOf:
            - $ref: '#/components/schemas/X402CreditsStateDto'
      required:
        - charged
        - freeSettlementsPerMonth
        - usedThisMonth
        - freeRemainingThisMonth
        - settlementFeeUsd
        - credits
    X402ConfigLimitsDto:
      type: object
      properties:
        dailyGasUsd:
          type: number
          example: 1
          description: Gas Cryptonly pays for this tenant per UTC day.
      required:
        - dailyGasUsd
    X402SettlementDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          description: >-
            `credited` (balance mode only): confirmed and credited to the
            account balance.
          allOf:
            - $ref: '#/components/schemas/X402SettlementStatus'
        accountId:
          type: string
          format: uuid
          description: Account the payment belongs to.
        payoutMode:
          description: >-
            `wallet`: paid to a verified merchant wallet. `balance` (Base): paid
            to the account's settlement address and credited to its balance.
          allOf:
            - $ref: '#/components/schemas/X402PayoutMode'
        origin:
          description: >-
            `facilitator`: settled through `/x402/settle`. `chain`: a transfer
            to the settlement address that did not go through `/x402/settle`.
          allOf:
            - $ref: '#/components/schemas/X402SettlementOrigin'
        network:
          type: string
          example: eip155:84532
          description: CAIP-2 network id.
        asset:
          type: string
          example: '0x036CbD53842c5426634e7929541eC2318f3dCF7e'
          description: Token contract.
        amount:
          type: string
          example: '1000'
          description: Atomic units of `asset`.
        payer:
          type: string
          example: '0x857b06519E91e3A54538791bDbb0E22373e36b66'
        payTo:
          type: string
          example: '0x209693Bc6afc0C5328bA36FaF03C514EF312287C'
        transaction:
          type: string
          example: '0xabababababababababababababababababababababababababababababababab'
          description: Transaction hash. Empty until the settlement is broadcast.
        errorReason:
          type: string
          nullable: true
          example: null
          description: Set when `status` is `failed`.
        fee:
          type: string
          example: '2500'
          description: >-
            Cryptonly fee, atomic units of `feeCurrency`. `0` within the free
            tier.
        feeCurrency:
          type: string
          nullable: true
          example: USDC_BASE
          description: >-
            Own wallet: USDC, charged to the x402 credits. Balance mode: the
            settled asset, deducted at credit.
        resourceUrl:
          type: string
          nullable: true
          example: https://api.example.com/weather
          description: '`resource.url` from the payment.'
        resourceId:
          type: string
          format: uuid
          nullable: true
        createdAt:
          type: string
          format: date-time
        confirmedAt:
          type: string
          format: date-time
          nullable: true
        creditedAt:
          type: string
          format: date-time
          nullable: true
      required:
        - id
        - status
        - accountId
        - payoutMode
        - origin
        - network
        - asset
        - amount
        - payer
        - payTo
        - transaction
        - errorReason
        - fee
        - feeCurrency
        - resourceUrl
        - resourceId
        - createdAt
        - confirmedAt
        - creditedAt
    X402PaymentPayloadDto:
      type: object
      properties:
        x402Version:
          type: number
          example: 2
          enum:
            - 2
        resource:
          type: object
          additionalProperties: true
        accepted:
          description: The `accepts[]` entry the buyer chose.
          allOf:
            - $ref: '#/components/schemas/X402PaymentRequirementsDto'
        payload:
          $ref: '#/components/schemas/X402ExactEvmPayloadDto'
        extensions:
          type: object
          additionalProperties: true
      required:
        - x402Version
        - accepted
        - payload
    X402PaymentRequirementsDto:
      type: object
      properties:
        scheme:
          type: string
          example: exact
          description: Only `exact` is supported.
        network:
          type: string
          example: eip155:84532
          description: >-
            CAIP-2 network id. Must match this environment (`GET
            /x402/supported`).
        amount:
          type: string
          example: '1000'
          description: Price in atomic units of `asset` (USDC has 6 decimals).
        asset:
          type: string
          example: '0x036CbD53842c5426634e7929541eC2318f3dCF7e'
          description: ERC-20 contract of a registered asset.
        payTo:
          type: string
          example: '0x209693Bc6afc0C5328bA36FaF03C514EF312287C'
          description: The merchant's own address. The asset is transferred here.
        maxTimeoutSeconds:
          type: number
          example: 60
          minimum: 1
          maximum: 3600
        extra:
          type: object
          additionalProperties: true
          example:
            name: USDC
            version: '2'
            assetTransferMethod: eip3009
          description: >-
            EIP-712 domain of the token (`name`, `version`) and, optionally,
            `assetTransferMethod` (`eip3009` or `permit2`).
      required:
        - scheme
        - network
        - amount
        - asset
        - payTo
        - maxTimeoutSeconds
    X402Reason:
      type: string
      enum:
        - insufficient_funds
        - invalid_exact_evm_payload_authorization_valid_after
        - invalid_exact_evm_payload_authorization_valid_before
        - invalid_exact_evm_payload_authorization_value_mismatch
        - invalid_exact_evm_payload_signature
        - invalid_exact_evm_payload_recipient_mismatch
        - invalid_network
        - invalid_payload
        - invalid_payment_requirements
        - invalid_scheme
        - invalid_x402_version
        - invalid_transaction_state
        - unexpected_verify_error
        - unexpected_settle_error
        - settlement_pending
        - compliance_rejected
        - pay_to_rejected
        - authorization_already_used
        - settlement_disabled
        - gas_ceiling_exceeded
        - gas_budget_exhausted
        - tenant_gas_budget_exhausted
        - fee_payer_reserve_low
        - fee_payer_busy
        - permit2_allowance_required
        - fee_balance_insufficient
        - invalid_exact_svm_payload_transaction
        - invalid_exact_svm_payload_transaction_could_not_be_decoded
        - invalid_exact_svm_payload_transaction_instructions_length
        - >-
          invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction
        - >-
          invalid_exact_svm_payload_transaction_instructions_compute_limit_instruction_too_high
        - >-
          invalid_exact_svm_payload_transaction_instructions_compute_price_instruction
        - >-
          invalid_exact_svm_payload_transaction_instructions_compute_price_instruction_too_high
        - invalid_exact_svm_payload_no_transfer_instruction
        - invalid_exact_svm_fee_payer_mismatch
        - invalid_exact_svm_payload_transaction_fee_payer_transferring_funds
        - invalid_exact_svm_payload_mint_mismatch
        - invalid_exact_svm_payload_recipient_mismatch
        - invalid_exact_svm_payload_amount_mismatch
        - invalid_exact_svm_payload_unknown_optional_instruction
        - invalid_exact_svm_payload_excessive_signers
        - invalid_exact_svm_payload_signature_invalid
        - invalid_exact_svm_transaction_simulation_failed
        - invalid_exact_svm_transaction_failed
        - invalid_exact_svm_recipient_token_account_missing
        - invalid_exact_svm_recipient_token_account_frozen
        - invalid_exact_svm_recipient_token_account_invalid
      description: Set when `isValid` is false.
    X402SettleFeeDto:
      type: object
      properties:
        feeAtomic:
          type: string
          example: '2500'
          description: >-
            Atomic units of `feeAsset`. Expected fee until the payment confirms;
            the booked fee is on the settlement and its webhook. `0` when free.
        feeAsset:
          type: string
          example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
          description: >-
            Token the fee is in: USDC for own wallet (prepaid from the account
            balance), the paid token in balance mode (deducted at credit).
      required:
        - feeAtomic
        - feeAsset
    InvoiceX402PaymentDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - pending
            - confirmed
        network:
          type: string
          example: eip155:8453
        asset:
          type: string
        amount:
          type: string
          description: Atomic units.
        payer:
          type: string
        transaction:
          type: string
          nullable: true
      required:
        - status
        - network
        - asset
        - amount
        - payer
        - transaction
    InvoiceX402ResourceDto:
      type: object
      properties:
        url:
          type: string
          description: The invoice's `x402Url`.
        description:
          type: string
          example: 'Invoice INV-11: 49.99 USD'
        mimeType:
          type: string
          example: application/json
        serviceName:
          type: string
          description: The merchant's public name.
      required:
        - url
        - description
        - mimeType
    InvoiceX402RequirementsDto:
      type: object
      properties:
        scheme:
          type: string
          example: exact
        network:
          type: string
          description: CAIP-2 network.
          example: eip155:8453
        amount:
          type: string
          description: Atomic units of `asset`.
          example: '49990000'
        asset:
          type: string
          description: Token contract.
          example: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
        payTo:
          type: string
          description: The invoice's address on this network.
        maxTimeoutSeconds:
          type: number
          example: 300
        extra:
          type: object
          description: The token's EIP-712 `name` and `version`.
          additionalProperties: true
      required:
        - scheme
        - network
        - amount
        - asset
        - payTo
        - maxTimeoutSeconds
        - extra
    MerchantDepositNetworkFeeDto:
      type: object
      properties:
        amount:
          type: number
          description: >-
            Fee in the currency units; withheld from each deposit before the
            commission, and added on top of invoice amounts.
          example: 1.25
        quotedAt:
          type: string
          description: When the fee was quoted. Fees refresh every few minutes.
          format: date-time
      required:
        - amount
        - quotedAt
    WithdrawalAutoConvertPreviewDto:
      type: object
      properties:
        fromAssetCode:
          type: string
          description: Asset code.
          example: USDT
          enum:
            - USDT
            - USDC
            - EURC
            - LINK
            - ETH
            - TRX
            - BNB
            - BTC
            - SOL
        toAssetCode:
          type: string
          description: Asset code.
          example: USDT
          enum:
            - USDT
            - USDC
            - EURC
            - LINK
            - ETH
            - TRX
            - BNB
            - BTC
            - SOL
        fromAmount:
          type: number
        toAmount:
          type: number
        commissionAmount:
          type: number
          description: >-
            Conversion commission in `fromAssetCode`, included in `fromAmount`.
            0 for USDT <-> USDC; 0.2% of `fromAmount` for every other pair.
      required:
        - fromAssetCode
        - toAssetCode
        - fromAmount
        - toAmount
        - commissionAmount
    WithdrawalQuoteFeeBreakdownDto:
      type: object
      properties:
        feeNative:
          type: number
          description: Real on-chain fee, in network base currency (e.g. ETH/TRX/BNB/BTC)
        feeCurrency:
          type: string
          description: Network base currency symbol
        feeInCryptoCurrencyCode:
          type: number
          description: >-
            On-chain fee at quote time, expressed in the withdrawal
            `cryptoCurrencyCode`.
        feeUsd:
          type: number
          description: Fee snapshotted to USD at quote time
      required:
        - feeNative
        - feeCurrency
        - feeInCryptoCurrencyCode
        - feeUsd
    SettlementBreakdownDto:
      type: object
      properties:
        amountPaid:
          type: number
          description: >-
            Amount received on-chain, in `cryptoCurrencyCode` units (not the
            invoice fiat currency).
        amountPaidUsd:
          type: number
          description: '`amountPaid` in USD at the time of receipt.'
        commissionAmount:
          type: number
          description: Cryptonly commission, in `cryptoCurrencyCode` units.
        commissionAmountUsd:
          type: number
          description: '`commissionAmount` in USD.'
        networkFeeAmount:
          type: number
          description: >-
            Fee of the payer's inbound transaction, in `networkFeeCurrencyCode`
            units (informational, paid by the payer's wallet).
        networkFeeAmountUsd:
          type: number
          description: '`networkFeeAmount` in USD.'
        networkFeeCurrencyCode:
          type: string
          description: Currency of `networkFeeAmount`.
        netAmount:
          type: number
          description: >-
            Amount credited to the merchant balance, in `cryptoCurrencyCode`
            units.
        netAmountUsd:
          type: number
          description: '`netAmount` in USD.'
        txHash:
          type: string
        completedAt:
          type: string
      required:
        - amountPaid
        - amountPaidUsd
        - commissionAmount
        - commissionAmountUsd
        - networkFeeAmount
        - networkFeeAmountUsd
        - networkFeeCurrencyCode
        - netAmount
        - netAmountUsd
        - completedAt
    X402PayoutMode:
      type: string
      enum:
        - wallet
        - balance
    X402ConfigPriceDto:
      type: object
      properties:
        amount:
          type: string
          example: '1000'
          description: Atomic units.
        asset:
          type: string
          example: '0x036CbD53842c5426634e7929541eC2318f3dCF7e'
        currencyCode:
          type: string
          example: USDC_BASE
        network:
          type: string
          example: eip155:84532
      required:
        - amount
        - asset
        - currencyCode
        - network
    X402CreditsStateDto:
      type: object
      properties:
        balance:
          type: string
          example: '4200000'
        autoTopUp:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/X402AutoTopUpDto'
        usdcAvailable:
          type: string
          example: '120000000'
          description: USDC balance of the account, which top-ups draw from.
        blocked:
          type: boolean
          description: >-
            Free settlements are used up and credits (with auto top-up) do not
            cover one fee: `/settle` refuses with `fee_balance_insufficient`.
      required:
        - balance
        - autoTopUp
        - usdcAvailable
        - blocked
    X402SettlementStatus:
      type: string
      enum:
        - submitted
        - confirmed
        - credited
        - failed
      description: >-
        `credited` (balance mode only): confirmed and credited to the account
        balance.
    X402SettlementOrigin:
      type: string
      enum:
        - facilitator
        - chain
      description: >-
        `facilitator`: settled through `/x402/settle`. `chain`: a transfer to
        the settlement address that did not go through `/x402/settle`.
    X402ExactEvmPayloadDto:
      type: object
      properties:
        signature:
          type: string
          example: >-
            0x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
          description: 65-byte hex.
        authorization:
          $ref: '#/components/schemas/X402Eip3009AuthorizationDto'
        permit2Authorization:
          $ref: '#/components/schemas/X402Permit2AuthorizationDto'
      required:
        - signature
    X402AutoTopUpDto:
      type: object
      properties:
        threshold:
          type: string
          example: '1000000'
          description: When credits fall below this, USDC atomic units…
        amount:
          type: string
          example: '5000000'
          description: …move this much USDC from the balance into credits.
      required:
        - threshold
        - amount
    X402Eip3009AuthorizationDto:
      type: object
      properties:
        from:
          type: string
          example: '0x857b06519E91e3A54538791bDbb0E22373e36b66'
        to:
          type: string
          example: '0x209693Bc6afc0C5328bA36FaF03C514EF312287C'
        value:
          type: string
          example: '1000'
          description: Atomic units.
        validAfter:
          type: string
          example: '0'
          description: Unix seconds.
        validBefore:
          type: string
          example: '1790000000'
          description: Unix seconds.
        nonce:
          type: string
          example: '0xabababababababababababababababababababababababababababababababab'
          description: 32-byte hex.
      required:
        - from
        - to
        - value
        - validAfter
        - validBefore
        - nonce
    X402Permit2AuthorizationDto:
      type: object
      properties:
        permitted:
          $ref: '#/components/schemas/X402Permit2PermittedDto'
        from:
          type: string
          example: '0x857b06519E91e3A54538791bDbb0E22373e36b66'
        spender:
          type: string
          example: '0x402085c248EeA27D92E8b30b2C58ed07f9E20001'
          description: Canonical x402ExactPermit2Proxy.
        nonce:
          type: string
          example: '1'
          description: Permit2 nonce, decimal uint256.
        deadline:
          type: string
          example: '1790000000'
          description: Unix seconds.
        witness:
          $ref: '#/components/schemas/X402Permit2WitnessDto'
      required:
        - permitted
        - from
        - spender
        - nonce
        - deadline
        - witness
    X402Permit2PermittedDto:
      type: object
      properties:
        token:
          type: string
          example: '0x036CbD53842c5426634e7929541eC2318f3dCF7e'
        amount:
          type: string
          example: '1000'
          description: Atomic units.
      required:
        - token
        - amount
    X402Permit2WitnessDto:
      type: object
      properties:
        to:
          type: string
          example: '0x209693Bc6afc0C5328bA36FaF03C514EF312287C'
        validAfter:
          type: string
          example: '0'
          description: Unix seconds.
      required:
        - to
        - validAfter
security:
  - TENANT_API_KEY: []
