Create a crypto swap
curl --request POST \
--url https://api-prod.blaaiz.com/api/external/crypto/swaps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"from_wallet": "btc-wallet-id",
"to_wallet": "eth-wallet-id",
"amount": "0.50000000"
}
'import requests
url = "https://api-prod.blaaiz.com/api/external/crypto/swaps"
payload = {
"from_wallet": "btc-wallet-id",
"to_wallet": "eth-wallet-id",
"amount": "0.50000000"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({from_wallet: 'btc-wallet-id', to_wallet: 'eth-wallet-id', amount: '0.50000000'})
};
fetch('https://api-prod.blaaiz.com/api/external/crypto/swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api-prod.blaaiz.com/api/external/crypto/swaps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_wallet\": \"btc-wallet-id\",\n \"to_wallet\": \"eth-wallet-id\",\n \"amount\": \"0.50000000\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-prod.blaaiz.com/api/external/crypto/swaps",
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([
'from_wallet' => 'btc-wallet-id',
'to_wallet' => 'eth-wallet-id',
'amount' => '0.50000000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"message": "Crypto swap processed successfully.",
"data": {
"type": "swap",
"from_wallet_id": "btc-wallet-id",
"to_wallet_id": "eth-wallet-id",
"from_amount": "0.500000000000000000",
"fee": "0.000000000000000000",
"rate": "15",
"to_amount": "7.500000000000000000",
"fiat_transaction_id": null,
"fiat_transaction": null,
"from_transaction_id": "swap-out-id",
"from_transaction": {
"id": "swap-out-id",
"wallet_id": "btc-wallet-id",
"type": "swap",
"direction": "out",
"status": "successful",
"currency": "BTC",
"amount": "0.500000000000000000"
},
"to_transaction_id": "swap-in-id",
"to_transaction": {
"id": "swap-in-id",
"wallet_id": "eth-wallet-id",
"type": "swap",
"direction": "in",
"status": "successful",
"currency": "ETH",
"amount": "7.500000000000000000"
}
}
}Crypto
Create a crypto swap
Swap crypto to crypto, crypto to fiat, or fiat to crypto. Both wallets must belong to your business. The request needs approved KYB and an Idempotency-Key. Required scope: crypto-swap:create.
POST
/
api
/
external
/
crypto
/
swaps
Create a crypto swap
curl --request POST \
--url https://api-prod.blaaiz.com/api/external/crypto/swaps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"from_wallet": "btc-wallet-id",
"to_wallet": "eth-wallet-id",
"amount": "0.50000000"
}
'import requests
url = "https://api-prod.blaaiz.com/api/external/crypto/swaps"
payload = {
"from_wallet": "btc-wallet-id",
"to_wallet": "eth-wallet-id",
"amount": "0.50000000"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({from_wallet: 'btc-wallet-id', to_wallet: 'eth-wallet-id', amount: '0.50000000'})
};
fetch('https://api-prod.blaaiz.com/api/external/crypto/swaps', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://api-prod.blaaiz.com/api/external/crypto/swaps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_wallet\": \"btc-wallet-id\",\n \"to_wallet\": \"eth-wallet-id\",\n \"amount\": \"0.50000000\"\n}"
response = http.request(request)
puts response.read_body<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-prod.blaaiz.com/api/external/crypto/swaps",
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([
'from_wallet' => 'btc-wallet-id',
'to_wallet' => 'eth-wallet-id',
'amount' => '0.50000000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"message": "Crypto swap processed successfully.",
"data": {
"type": "swap",
"from_wallet_id": "btc-wallet-id",
"to_wallet_id": "eth-wallet-id",
"from_amount": "0.500000000000000000",
"fee": "0.000000000000000000",
"rate": "15",
"to_amount": "7.500000000000000000",
"fiat_transaction_id": null,
"fiat_transaction": null,
"from_transaction_id": "swap-out-id",
"from_transaction": {
"id": "swap-out-id",
"wallet_id": "btc-wallet-id",
"type": "swap",
"direction": "out",
"status": "successful",
"currency": "BTC",
"amount": "0.500000000000000000"
},
"to_transaction_id": "swap-in-id",
"to_transaction": {
"id": "swap-in-id",
"wallet_id": "eth-wallet-id",
"type": "swap",
"direction": "in",
"status": "successful",
"currency": "ETH",
"amount": "7.500000000000000000"
}
}
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
A unique key for this swap request.
Maximum string length:
255Body
application/json
Was this page helpful?
⌘I

