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

# Restore swaps

> Find the swaps whose client keys derive from an xpub, with the details needed to claim or refund them. Pass the derivation path your keys use. Does not return `swapAuth`.



## OpenAPI

````yaml /openapi.json post /v2/swap/restore
openapi: 3.1.0
info:
  title: KaleidoSwap Maker API
  version: v2
  description: >-
    Public HTTP API of the KaleidoSwap maker. Wire-compatible with the Boltz
    `/v2` protocol for submarine, reverse, and chain swaps, with KaleidoSwap
    additions (RGB, atomic swaps, pay-through, LSPS1, swap credentials).
    Integrate through the Swap SDK where possible: it verifies every swap the
    maker proposes.
  contact:
    name: KaleidoSwap
    url: https://kaleidoswap.com
servers:
  - url: https://maker.signet.kaleidoswap.com
    description: Signet (Mutinynet)
security: []
tags:
  - name: Service
    description: Maker identity, version, and capabilities.
  - name: Pairs and quotes
    description: Routes the maker trades, their limits and fees, and quotes.
  - name: Submarine swaps
    description: On-chain → Lightning. You lock on chain; the maker pays your invoice.
  - name: Reverse swaps
    description: >-
      Lightning → on-chain. You pay a hold invoice; the maker locks on chain;
      you claim.
  - name: Chain swaps
    description: On-chain → on-chain. Both sides lock; you claim the maker's lockup.
  - name: Swap status
    description: Swap status over HTTP and WebSocket.
  - name: Recovery
    description: Restore swaps from an xpub and recover swap credentials.
  - name: Atomic RGB swaps
    description: BTC ↔ RGB asset swaps in a single transaction.
  - name: Pay-through
    description: Lightning payment → on-chain payout to any address.
  - name: Lightning channels (LSPS1)
    description: Buy inbound Lightning channels (LSPS1).
  - name: Chain data
    description: The maker's view of chain tips and fees.
paths:
  /v2/swap/restore:
    post:
      tags:
        - Recovery
      summary: Restore swaps
      description: >-
        Find the swaps whose client keys derive from an xpub, with the details
        needed to claim or refund them. Pass the derivation path your keys use.
        Does not return `swapAuth`.
      operationId: restore
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapRestoreRequest'
        required: true
      responses:
        '200':
          description: Matching swaps in deterministic creation order.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RestoredSwap'
        '400':
          description: Invalid XPUB, derivation path, or gap limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Recovery scan safety limit reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Database unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SwapRestoreRequest:
      type: object
      description: >-
        XPUB search accepted by `POST /v2/swap/restore` and `/restore/index`.
        Supports the XPUB variant used by the TypeScript bindings; explicit

        public-key and EVM-address variants are not supported.
      required:
        - xpub
      properties:
        derivationPath:
          type:
            - string
            - 'null'
          description: >-
            Child-key base path. Boltz defaults to `m/44/0/0/0`; SDK callers
            pass

            `m` when the supplied XPUB is already the swap-account key.
        gapLimit:
          type:
            - integer
            - 'null'
          format: int32
          description: |-
            Consecutive unused-key scan limit. Boltz defaults to 50 and accepts
            values in `1..=150`.
          maximum: 150
          minimum: 1
        xpub:
          type: string
          description: Extended public key from which client swap keys are derived.
    RestoredSwap:
      type: object
      description: One element returned by `POST /v2/swap/restore`.
      required:
        - id
        - type
        - status
        - createdAt
        - from
        - to
        - preimageHash
      properties:
        claimDetails:
          oneOf:
            - $ref: '#/components/schemas/RestoreClaimDetails'
            - type: 'null'
        createdAt:
          type: integer
          format: int64
          description: Unix creation timestamp in seconds.
          minimum: 0
        from:
          type: string
        id:
          type: string
        invoice:
          type:
            - string
            - 'null'
        preimageHash:
          type: string
          description: >-
            Canonical Boltz restore field. Older SDK bindings ignore this
            top-level

            field, while newer clients need it to reconstruct submarine refunds.
        refundDetails:
          oneOf:
            - $ref: '#/components/schemas/RestoreRefundDetails'
            - type: 'null'
        status:
          type: string
        to:
          type: string
        type:
          $ref: '#/components/schemas/RestoredSwapType'
    ErrorResponse:
      type: object
      description: Boltz-shaped error envelope.
      required:
        - error
      properties:
        details:
          type:
            - string
            - 'null'
          description: Optional human-readable detail. Present on 4xx; absent on 5xx.
        error:
          type: string
          description: Stable machine-readable error code, e.g. `pair_hash_mismatch`.
    RestoreClaimDetails:
      type: object
      description: Client-side claim material returned by swap restoration.
      required:
        - type
        - tree
        - keyIndex
        - lockupAddress
        - serverPublicKey
        - timeoutBlockHeight
        - preimageHash
      properties:
        amount:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        blindingKey:
          type:
            - string
            - 'null'
          description: |-
            Omitted for Liquid, whose lockups the maker mints **unconfidential**
            on purpose, so no output blinding key exists to return; and for
            Bitcoin, which has no such field.
        keyIndex:
          type: integer
          format: int32
          minimum: 0
        lockupAddress:
          type: string
        preimageHash:
          type: string
        serverPublicKey:
          type: string
        timeoutBlockHeight:
          type: integer
          format: int32
          minimum: 0
        transaction:
          oneOf:
            - $ref: '#/components/schemas/RestoreTransaction'
            - type: 'null'
        tree:
          $ref: '#/components/schemas/SwapTree'
        type:
          $ref: '#/components/schemas/RestoreDetailType'
    RestoreRefundDetails:
      type: object
      description: Client-side refund material returned by swap restoration.
      required:
        - type
        - tree
        - keyIndex
        - lockupAddress
        - serverPublicKey
        - timeoutBlockHeight
      properties:
        amount:
          type:
            - integer
            - 'null'
          format: int64
          minimum: 0
        blindingKey:
          type:
            - string
            - 'null'
          description: |-
            Omitted for Liquid, whose lockups the maker mints **unconfidential**
            on purpose, so no output blinding key exists to return; and for
            Bitcoin, which has no such field.
        keyIndex:
          type: integer
          format: int32
          minimum: 0
        lockupAddress:
          type: string
        serverPublicKey:
          type: string
        timeoutBlockHeight:
          type: integer
          format: int32
          minimum: 0
        transaction:
          oneOf:
            - $ref: '#/components/schemas/RestoreTransaction'
            - type: 'null'
        tree:
          $ref: '#/components/schemas/SwapTree'
        type:
          $ref: '#/components/schemas/RestoreDetailType'
    RestoredSwapType:
      type: string
      description: Swap kind in a restore result.
      enum:
        - submarine
        - reverse
        - chain
    RestoreTransaction:
      type: object
      description: Funding outpoint included once the relevant lockup exists.
      required:
        - id
        - vout
      properties:
        id:
          type: string
        vout:
          type: integer
          format: int32
          minimum: 0
    SwapTree:
      type: object
      description: '`swapTree` returned on every swap creation + status response.'
      required:
        - claimLeaf
        - refundLeaf
      properties:
        claimLeaf:
          $ref: '#/components/schemas/SwapLeaf'
        refundLeaf:
          $ref: '#/components/schemas/SwapLeaf'
    RestoreDetailType:
      type: string
      description: UTXO detail discriminator used by canonical Boltz restore responses.
      enum:
        - utxo
    SwapLeaf:
      type: object
      description: |-
        One tapscript leaf — leaf-version byte (`196` / `0xc4` for elements,
        `192` / `0xc0` for Bitcoin) plus the hex script.
      required:
        - version
        - output
      properties:
        output:
          type: string
          description: Hex-encoded leaf script.
        version:
          type: integer
          format: int32
          description: Tapscript leaf-version byte.
          minimum: 0

````

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