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

# Deposit Address

> Get a deposit address with QR code for Chainflip or NEAR protocols (auto-selected if not specified)

## Overview

`/leokit/deposit-address` returns a deposit address (plus payment URI and QR code) for protocols that don't require a signed transaction from the user — currently **Chainflip** and **NEAR**. The user simply sends funds to the address; the protocol handles the rest.

This endpoint is similar to `/leokit/deposit` but specialized for address-based protocols. It also accepts `from_address` and `to_address` overrides for **wallet-less swap flows** (e.g. paid-on-receipt apps where the user has no connected wallet).

If `protocol` is omitted, the best available chainflip/near quote is auto-selected by `expected_amount_out`.

## Endpoint

```
POST /leokit/deposit-address
```

## Request

### Headers

| Header         | Value              |
| -------------- | ------------------ |
| `Content-Type` | `application/json` |
| `Api-Key`      | Your API key       |

### Body

| Field               | Type   | Required | Description                                                      |
| ------------------- | ------ | -------- | ---------------------------------------------------------------- |
| `quote_id`          | string | Yes      | Quote ID from `/leokit/quote` or `/leokit/streaming-quotes`      |
| `protocol`          | string | No       | `chainflip` or `near`. If omitted, auto-selects the best offer   |
| `selected_protocol` | string | No       | Alias for `protocol`                                             |
| `type`              | string | No       | Sub-protocol variant (e.g. Chainflip DCA). Default: regular swap |
| `from_address`      | string | No       | Override refund/source address (for wallet-less swaps)           |
| `to_address`        | string | No       | Override destination/recipient address (for wallet-less swaps)   |

## Response

### Success (200)

```json theme={null}
{
  "data": {
    "deposit_address": "bc1q...",
    "amount": "0.01",
    "amount_raw": "1000000",
    "decimals": 8,
    "from_asset": "BTC.BTC",
    "to_asset": "ETH.ETH",
    "network": "BTC",
    "protocol": "chainflip",
    "chainflip_channel_id": 12345,
    "payment_uri": "bitcoin:bc1q...?amount=0.01",
    "qr_url": "https://cdn.leokit.dev/qr/01953c9a-....png",
    "expires_at": "2026-04-28T12:30:00.000Z"
  },
  "status": 200
}
```

### Field Reference

| Field                  | Description                                                  |
| ---------------------- | ------------------------------------------------------------ |
| `deposit_address`      | Address the user must send funds to                          |
| `amount`               | Decimal amount in source-asset units                         |
| `amount_raw`           | Same amount in base units (wei, sats, etc.) as a string      |
| `decimals`             | Source-asset decimals                                        |
| `network`              | Source chain code (`BTC`, `ETH`, `THOR`, etc.)               |
| `protocol`             | Selected protocol (`chainflip` or `near`)                    |
| `chainflip_channel_id` | Chainflip swap-channel ID (Chainflip only — `null` for NEAR) |
| `payment_uri`          | Wallet-scannable URI (BIP-21, EIP-681, Solana Pay, etc.)     |
| `qr_url`               | CDN URL of a PNG QR code encoding the `payment_uri`          |
| `expires_at`           | ISO-8601 timestamp after which the quote/channel expires     |

## Wallet-less Swap Flow

For applications without a connected wallet (e.g. embedded swap widgets), pass `from_address` and `to_address` directly:

```bash theme={null}
curl -X POST https://api.leokit.dev/leokit/deposit-address \
  -H "Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "quote_id": "01953c9a-...",
    "from_address": "bc1qsourceaddr...",
    "to_address": "0xRecipient..."
  }'
```

The user is then expected to send `amount` from the wallet of their choice to `deposit_address`.

## Errors

| Status | Code                          | Description                                                     |
| ------ | ----------------------------- | --------------------------------------------------------------- |
| `400`  | `SELECTED_QUOTE_IS_NOT_SET`   | `quote_id` missing or empty                                     |
| `400`  | `NO_DEPOSIT_ADDRESS_PROTOCOL` | Auto-selection failed: no chainflip/near quote in the offer set |
| `400`  | `UNSUPPORTED_PROTOCOL`        | `protocol` is not `chainflip` or `near`                         |
| `400`  | Validation                    | Quote validation failed (expired, malformed, etc.)              |
| `401`  | `INVALID_API_KEY`             | Missing or invalid API key                                      |
| `502`  | `MISSING_DEPOSIT_ADDRESS`     | NEAR could not return a deposit address (live re-fetch failed)  |

See the [error codes catalog](/reference/error-codes) for the full list.

## See Also

* [Generate Deposit](/api-reference/endpoint/generate-deposit) — for protocols that return unsigned transactions
* [Simple Swap](/api-reference/endpoint/simple) — single-call quote + deposit-address for chainflip/near
* [QR Code Enrichment](/api-reference/deposits#qr-code-enrichment-chainflip-near)


## OpenAPI

````yaml /api-reference/openapi.json POST /deposit-address
openapi: 3.0.3
info:
  title: Leokit API
  version: 1.0.0
  description: API reference for Leokit
servers:
  - url: https://api.leokit.dev
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /deposit-address:
    post:
      summary: Get deposit address (Chainflip / NEAR)
      description: >-
        Generate a deposit address for chainflip or near. If protocol is
        omitted, the best available offer is auto-selected. Supports wallet-less
        swap flows via from_address/to_address overrides.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepositAddressRequest'
            example:
              quote_id: 01936b4a-7c8e-7890-abcd-ef1234567890
              from_address: bc1qsourceaddr...
              to_address: 0xRecipient...
      responses:
        '200':
          description: Deposit address with QR code and payment URI.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DepositAddressResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  schemas:
    DepositAddressRequest:
      type: object
      description: >-
        Request body for /deposit-address. If protocol is omitted, the best
        chainflip/near quote is auto-selected.
      required:
        - quote_id
      properties:
        quote_id:
          type: string
          format: uuid
        protocol:
          type: string
          enum:
            - chainflip
            - near
          description: Optional. Auto-selected if omitted.
        selected_protocol:
          type: string
          description: Alias for protocol.
        type:
          type: string
          description: Sub-protocol variant (e.g. Chainflip DCA).
        from_address:
          type: string
          description: Override refund/source address (wallet-less swap flows).
        to_address:
          type: string
          description: Override recipient/destination address (wallet-less swap flows).
    DepositAddressResponse:
      type: object
      required:
        - data
        - status
      properties:
        status:
          type: integer
        data:
          type: object
          required:
            - deposit_address
            - amount
            - amount_raw
            - decimals
            - from_asset
            - to_asset
            - network
            - protocol
            - payment_uri
            - qr_url
          properties:
            deposit_address:
              type: string
            amount:
              type: string
            amount_raw:
              type: string
            decimals:
              type: integer
            from_asset:
              type: string
            to_asset:
              type: string
            network:
              type: string
            protocol:
              type: string
              enum:
                - chainflip
                - near
            chainflip_channel_id:
              type: integer
              nullable: true
            payment_uri:
              type: string
            qr_url:
              type: string
            expires_at:
              type: string
              format: date-time
              nullable: true
    Error:
      type: object
      description: Generic error payload.
      properties:
        message:
          type: string
        code:
          type: string
  responses:
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Api-Key
      description: 'Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4'

````