Run Swap
curl --request POST \
--url https://api.yativo.com/api/v1/wallet/swap \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-Secret: <api-key>' \
--data '
{
"from_currency": "USD",
"to_currency": "USDC",
"amount": 1000,
"idempotency_key": "<string>"
}
'import requests
url = "https://api.yativo.com/api/v1/wallet/swap"
payload = {
"from_currency": "USD",
"to_currency": "USDC",
"amount": 1000,
"idempotency_key": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-Api-Key": "<api-key>",
"X-Api-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-Api-Key': '<api-key>',
'X-Api-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from_currency: 'USD',
to_currency: 'USDC',
amount: 1000,
idempotency_key: '<string>'
})
};
fetch('https://api.yativo.com/api/v1/wallet/swap', 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.yativo.com/api/v1/wallet/swap",
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_currency' => 'USD',
'to_currency' => 'USDC',
'amount' => 1000,
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"X-Api-Key: <api-key>",
"X-Api-Secret: <api-key>"
],
]);
$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.yativo.com/api/v1/wallet/swap"
payload := strings.NewReader("{\n \"from_currency\": \"USD\",\n \"to_currency\": \"USDC\",\n \"amount\": 1000,\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("X-Api-Secret", "<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.yativo.com/api/v1/wallet/swap")
.header("Idempotency-Key", "<idempotency-key>")
.header("X-Api-Key", "<api-key>")
.header("X-Api-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from_currency\": \"USD\",\n \"to_currency\": \"USDC\",\n \"amount\": 1000,\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yativo.com/api/v1/wallet/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["X-Api-Key"] = '<api-key>'
request["X-Api-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_currency\": \"USD\",\n \"to_currency\": \"USDC\",\n \"amount\": 1000,\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"status_code": 200,
"message": "Request successful",
"data": {
"reference": "9b1f0c52-3a8e-4f4e-b2a1-6f0e5d7c8a91",
"from_currency": "USD",
"to_currency": "USDC",
"from_amount": 1000,
"fee": 5,
"rate": 1,
"to_amount": 995,
"status": "completed",
"created_at": "2026-10-20T10:15:00+00:00"
}
}{
"status": "failed",
"status_code": 123,
"message": "Request failed.",
"data": {
"error": "<string>"
},
"error_details": {
"code": "validation_error",
"message": "The amount field is required.",
"http_status": 422,
"fields": {},
"retryable": false,
"retry_after": 123
}
}Currency Swap
Run Swap
Move balance from one of your wallets to another
POST
/
wallet
/
swap
Run Swap
curl --request POST \
--url https://api.yativo.com/api/v1/wallet/swap \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Api-Secret: <api-key>' \
--data '
{
"from_currency": "USD",
"to_currency": "USDC",
"amount": 1000,
"idempotency_key": "<string>"
}
'import requests
url = "https://api.yativo.com/api/v1/wallet/swap"
payload = {
"from_currency": "USD",
"to_currency": "USDC",
"amount": 1000,
"idempotency_key": "<string>"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"X-Api-Key": "<api-key>",
"X-Api-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
'X-Api-Key': '<api-key>',
'X-Api-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from_currency: 'USD',
to_currency: 'USDC',
amount: 1000,
idempotency_key: '<string>'
})
};
fetch('https://api.yativo.com/api/v1/wallet/swap', 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.yativo.com/api/v1/wallet/swap",
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_currency' => 'USD',
'to_currency' => 'USDC',
'amount' => 1000,
'idempotency_key' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>",
"X-Api-Key: <api-key>",
"X-Api-Secret: <api-key>"
],
]);
$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.yativo.com/api/v1/wallet/swap"
payload := strings.NewReader("{\n \"from_currency\": \"USD\",\n \"to_currency\": \"USDC\",\n \"amount\": 1000,\n \"idempotency_key\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("X-Api-Secret", "<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.yativo.com/api/v1/wallet/swap")
.header("Idempotency-Key", "<idempotency-key>")
.header("X-Api-Key", "<api-key>")
.header("X-Api-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"from_currency\": \"USD\",\n \"to_currency\": \"USDC\",\n \"amount\": 1000,\n \"idempotency_key\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yativo.com/api/v1/wallet/swap")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["X-Api-Key"] = '<api-key>'
request["X-Api-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_currency\": \"USD\",\n \"to_currency\": \"USDC\",\n \"amount\": 1000,\n \"idempotency_key\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"status_code": 200,
"message": "Request successful",
"data": {
"reference": "9b1f0c52-3a8e-4f4e-b2a1-6f0e5d7c8a91",
"from_currency": "USD",
"to_currency": "USDC",
"from_amount": 1000,
"fee": 5,
"rate": 1,
"to_amount": 995,
"status": "completed",
"created_at": "2026-10-20T10:15:00+00:00"
}
}{
"status": "failed",
"status_code": 123,
"message": "Request failed.",
"data": {
"error": "<string>"
},
"error_details": {
"code": "validation_error",
"message": "The amount field is required.",
"http_status": 422,
"fields": {},
"retryable": false,
"retry_after": 123
}
}Debits the source wallet and credits the destination wallet in one step. Keep the
See Currency Swap for the error messages.
reference from the response to look the swap up later.
Retrying with the same
Idempotency-Key returns the original swap. No second swap runs.Authorizations
Your API key (yativo_pk_...) from Developers → API Keys. Send together with X-Api-Secret.
Your API secret (yativo_sk_...), shown once when the key is created.
Headers
A unique string per request to ensure idempotent processing.
Body
application/json
Currency of the wallet to debit.
Example:
"USD"
Currency of the wallet to credit. Must differ from from_currency.
Example:
"USDC"
Amount to swap in from_currency, including the fee. Must be greater than 0.
Example:
1000
POST /wallet/swap only. Alternative to the Idempotency-Key header.
Maximum string length:
100
