> ## 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.

# Get the highest used index

> The highest client derivation index used by a stored swap for an xpub, or `-1` when none is found within the gap limit.



## OpenAPI

````yaml /openapi.json post /v2/swap/restore/index
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/index:
    post:
      tags:
        - Recovery
      summary: Get the highest used index
      description: >-
        The highest client derivation index used by a stored swap for an xpub,
        or `-1` when none is found within the gap limit.
      operationId: restore_index
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapRestoreRequest'
        required: true
      responses:
        '200':
          description: Highest matching client key index, or -1.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapRestoreIndexResponse'
        '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.
    SwapRestoreIndexResponse:
      type: object
      description: '`POST /v2/swap/restore/index` response.'
      required:
        - index
      properties:
        index:
          type: integer
          format: int64
          description: Highest matching client derivation index, or `-1` when none matched.
          minimum: -1
    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`.

````

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