Skip to main content
POST
/
deposit-address
Get deposit address (Chainflip / NEAR)
curl --request POST \
  --url https://api.leokit.dev/deposit-address \
  --header 'Api-Key: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
  "from_address": "bc1qsourceaddr...",
  "to_address": "0xRecipient..."
}
'
import requests

url = "https://api.leokit.dev/deposit-address"

payload = {
"quote_id": "01936b4a-7c8e-7890-abcd-ef1234567890",
"from_address": "bc1qsourceaddr...",
"to_address": "0xRecipient..."
}
headers = {
"Api-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
quote_id: '01936b4a-7c8e-7890-abcd-ef1234567890',
from_address: 'bc1qsourceaddr...',
to_address: '0xRecipient...'
})
};

fetch('https://api.leokit.dev/deposit-address', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.leokit.dev/deposit-address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'quote_id' => '01936b4a-7c8e-7890-abcd-ef1234567890',
'from_address' => 'bc1qsourceaddr...',
'to_address' => '0xRecipient...'
]),
CURLOPT_HTTPHEADER => [
"Api-Key: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.leokit.dev/deposit-address"

payload := strings.NewReader("{\n \"quote_id\": \"01936b4a-7c8e-7890-abcd-ef1234567890\",\n \"from_address\": \"bc1qsourceaddr...\",\n \"to_address\": \"0xRecipient...\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.leokit.dev/deposit-address")
.header("Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quote_id\": \"01936b4a-7c8e-7890-abcd-ef1234567890\",\n \"from_address\": \"bc1qsourceaddr...\",\n \"to_address\": \"0xRecipient...\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.leokit.dev/deposit-address")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"quote_id\": \"01936b4a-7c8e-7890-abcd-ef1234567890\",\n \"from_address\": \"bc1qsourceaddr...\",\n \"to_address\": \"0xRecipient...\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": 123,
  "data": {
    "deposit_address": "<string>",
    "amount": "<string>",
    "amount_raw": "<string>",
    "decimals": 123,
    "from_asset": "<string>",
    "to_asset": "<string>",
    "network": "<string>",
    "payment_uri": "<string>",
    "qr_url": "<string>",
    "chainflip_channel_id": 123,
    "expires_at": "2023-11-07T05:31:56Z"
  }
}
{
"message": "<string>",
"code": "<string>"
}

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

HeaderValue
Content-Typeapplication/json
Api-KeyYour API key

Body

FieldTypeRequiredDescription
quote_idstringYesQuote ID from /leokit/quote or /leokit/streaming-quotes
protocolstringNochainflip or near. If omitted, auto-selects the best offer
selected_protocolstringNoAlias for protocol
typestringNoSub-protocol variant (e.g. Chainflip DCA). Default: regular swap
from_addressstringNoOverride refund/source address (for wallet-less swaps)
to_addressstringNoOverride destination/recipient address (for wallet-less swaps)

Response

Success (200)

{
  "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

FieldDescription
deposit_addressAddress the user must send funds to
amountDecimal amount in source-asset units
amount_rawSame amount in base units (wei, sats, etc.) as a string
decimalsSource-asset decimals
networkSource chain code (BTC, ETH, THOR, etc.)
protocolSelected protocol (chainflip or near)
chainflip_channel_idChainflip swap-channel ID (Chainflip only — null for NEAR)
payment_uriWallet-scannable URI (BIP-21, EIP-681, Solana Pay, etc.)
qr_urlCDN URL of a PNG QR code encoding the payment_uri
expires_atISO-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:
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

StatusCodeDescription
400SELECTED_QUOTE_IS_NOT_SETquote_id missing or empty
400NO_DEPOSIT_ADDRESS_PROTOCOLAuto-selection failed: no chainflip/near quote in the offer set
400UNSUPPORTED_PROTOCOLprotocol is not chainflip or near
400ValidationQuote validation failed (expired, malformed, etc.)
401INVALID_API_KEYMissing or invalid API key
502MISSING_DEPOSIT_ADDRESSNEAR could not return a deposit address (live re-fetch failed)
See the error codes catalog for the full list.

See Also

Authorizations

Api-Key
string
header
required

Demo API-Key (Sandbox): 7037d2b3-9c76-4f62-b730-c544f7570fa4

Body

application/json

Request body for /deposit-address. If protocol is omitted, the best chainflip/near quote is auto-selected.

quote_id
string<uuid>
required
protocol
enum<string>

Optional. Auto-selected if omitted.

Available options:
chainflip,
near
selected_protocol
string

Alias for protocol.

type
string

Sub-protocol variant (e.g. Chainflip DCA).

from_address
string

Override refund/source address (wallet-less swap flows).

to_address
string

Override recipient/destination address (wallet-less swap flows).

Response

Deposit address with QR code and payment URI.

status
integer
required
data
object
required