Create Swap
POST /api-access/transactions/client/sessions/swap
Create a new swap transaction to exchange currency between wallets or swap and send to a recipient.
Authentication
Required Headers:
Authorization: HMAC-SHA256 PUBLIC_KEY:PRIVATE_KEY
X-Origin: third-party-api
X-Timestamp: 2025-10-12T14:30:00.000Z
Content-Type: application/jsonRequest
Transaction Specification
You can specify the details of the swap in one of two ways:
- Using a Quote ID: Provide a
swap_quote_id(for a simple swap) or apayout_quote_id(for a swap-and-send) that you obtained from the Swap Calculator or Swap & Send Calculator. When using a quote ID, you do not need to provide thetransactionobject. - Using a Transaction Object: Provide a
transactionobject with the full details of the swap (amount, currencies, etc.). Use this method if you do not have a quote ID.
You must use one of these methods, but not both in the same request.
Body Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
description | string | No | Description of the swap |
swap_quote_id | string | Conditional | Swap quote ID from calculator. Required if transaction object is not provided. |
payout_quote_id | string | Conditional | Payout quote ID (for swap and send). Required if transaction object is not provided. |
transaction | object | Conditional | Transaction details object. Required if a quote ID is not provided. |
transaction.amount | number | Yes | Amount to swap |
transaction.from_currency | string | Yes | Source currency (e.g., xof, cad) |
transaction.to_currency | string | Yes | Target currency (e.g., xof, cad) |
transaction.country | string | Yes | Country code (e.g., bf, ca) |
transaction.priority | string | No | Priority level (e.g., standard) |
source_wallet | string | Yes | Source wallet ID |
destination_wallet | string | Conditional | Destination wallet ID (for wallet-to-wallet swap) |
session_type | string | Yes | Session type (e.g., swap_transaction, swap_and_send) |
recipient | object | Conditional | Recipient for swap source (if applicable) |
payout_recipient | object | Conditional | Payout recipient (required for swap and send) |
metadata | object | No | Additional metadata |
swap_type | string | Yes | Swap type (e.g., SWAP, SWAP_SEND) |
Recipient Objects:
See Create Recipient for full recipient field documentation.
Response
Success Response (200):
{
"data": {
"success": false,
"transaction_id": "string",
"transaction_reference": "string",
"message": "string",
"payment_link": "string",
"status": "string",
"http_status": 0,
"session_id": "string",
"extra": {}
},
"success": true,
"message": "string",
"detail": {}
}Examples
1. Wallet-to-Wallet Swap with Quote ID
This example shows how to perform a simple currency exchange between two of your wallets using a swap_quote_id from the calculator.
curl -X POST "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap" \
-H "Authorization: HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY" \
-H "X-Origin: third-party-api" \
-H "X-Timestamp: 2025-10-12T14:30:00.000Z" \
-H "Content-Type: application/json" \
-d '{
"description": "Currency exchange",
"swap_quote_id": "quote-swap-123",
"source_wallet": "wallet-xof-456",
"destination_wallet": "wallet-cad-789",
"session_type": "swap_transaction",
"metadata": {},
"swap_type": "SWAP"
}'const response = await fetch('https://sandbox.mara.boo/api-access/transactions/client/sessions/swap', {
method: 'POST',
headers: {
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: "Currency exchange",
swap_quote_id: "quote-swap-123",
source_wallet: "wallet-xof-456",
destination_wallet: "wallet-cad-789",
session_type: "swap_transaction",
metadata: {},
swap_type: "SWAP"
})
});import requests
response = requests.post(
'https://sandbox.mara.boo/api-access/transactions/client/sessions/swap',
headers={
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
json={
"description": "Currency exchange",
"swap_quote_id": "quote-swap-123",
"source_wallet": "wallet-xof-456",
"destination_wallet": "wallet-cad-789",
"session_type": "swap_transaction",
"metadata": {},
"swap_type": "SWAP"
}
)package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"description": "Currency exchange",
"swap_quote_id": "quote-swap-123",
"source_wallet": "wallet-xof-456",
"destination_wallet": "wallet-cad-789",
"session_type": "swap_transaction",
"metadata": map[string]interface{}{},
"swap_type": "SWAP",
}
jsonData, _ := json.Marshal(payload)
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
req.Header.Set("X-Origin", "third-party-api")
req.Header.Set("X-Timestamp", "2025-10-12T14:30:00.000Z")
req.Header.Set("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String jsonPayload = "{\"description\":\"Currency exchange\",\"swap_quote_id\":\"quote-swap-123\",\"source_wallet\":\"wallet-xof-456\",\"destination_wallet\":\"wallet-cad-789\",\"session_type\":\"swap_transaction\",\"metadata\":{},\"swap_type\":\"SWAP\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://sandbox.mara.boo/api-access/transactions/client/sessions/swap"))
.header("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
.header("X-Origin", "third-party-api")
.header("X-Timestamp", "2025-10-12T14:30:00.000Z")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());using System.Net.Http;
using System.Text;
using System.Text.Json;
var payload = new {
description = "Currency exchange",
swap_quote_id = "quote-swap-123",
source_wallet = "wallet-xof-456",
destination_wallet = "wallet-cad-789",
session_type = "swap_transaction",
metadata = new {},
swap_type = "SWAP"
};
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap");
request.Headers.Add("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY");
request.Headers.Add("X-Origin", "third-party-api");
request.Headers.Add("X-Timestamp", "2025-10-12T14:30:00.000Z");
var jsonContent = JsonSerializer.Serialize(payload);
request.Content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);2. Wallet-to-Wallet Swap with Transaction Object
This example shows how to perform the same swap by providing the transaction details directly.
curl -X POST "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap" \
-H "Authorization: HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY" \
-H "X-Origin: third-party-api" \
-H "X-Timestamp: 2025-10-12T14:30:00.000Z" \
-H "Content-Type: application/json" \
-d '{
"description": "Currency exchange",
"transaction": {
"amount": 50000,
"from_currency": "xof",
"to_currency": "cad",
"country": "bf",
"priority": "standard"
},
"source_wallet": "wallet-xof-456",
"destination_wallet": "wallet-cad-789",
"session_type": "swap_transaction",
"metadata": {},
"swap_type": "SWAP"
}'const response = await fetch('https://sandbox.mara.boo/api-access/transactions/client/sessions/swap', {
method: 'POST',
headers: {
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: "Currency exchange",
transaction: {
amount: 50000,
from_currency: "xof",
to_currency: "cad",
country: "bf",
priority: "standard"
},
source_wallet: "wallet-xof-456",
destination_wallet: "wallet-cad-789",
session_type: "swap_transaction",
metadata: {},
swap_type: "SWAP"
})
});import requests
response = requests.post(
'https://sandbox.mara.boo/api-access/transactions/client/sessions/swap',
headers={
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
json={
"description": "Currency exchange",
"transaction": {
"amount": 50000,
"from_currency": "xof",
"to_currency": "cad",
"country": "bf",
"priority": "standard"
},
"source_wallet": "wallet-xof-456",
"destination_wallet": "wallet-cad-789",
"session_type": "swap_transaction",
"metadata": {},
"swap_type": "SWAP"
}
)package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"description": "Currency exchange",
"transaction": map[string]interface{}{
"amount": 50000,
"from_currency": "xof",
"to_currency": "cad",
"country": "bf",
"priority": "standard",
},
"source_wallet": "wallet-xof-456",
"destination_wallet": "wallet-cad-789",
"session_type": "swap_transaction",
"metadata": map[string]interface{}{},
"swap_type": "SWAP",
}
jsonData, _ := json.Marshal(payload)
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
req.Header.Set("X-Origin", "third-party-api")
req.Header.Set("X-Timestamp", "2025-10-12T14:30:00.000Z")
req.Header.Set("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String jsonPayload = "{\"description\":\"Currency exchange\",\"transaction\":{\"amount\":50000,\"from_currency\":\"xof\",\"to_currency\":\"cad\",\"country\":\"bf\",\"priority\":\"standard\"},\"source_wallet\":\"wallet-xof-456\",\"destination_wallet\":\"wallet-cad-789\",\"session_type\":\"swap_transaction\",\"metadata\":{},\"swap_type\":\"SWAP\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://sandbox.mara.boo/api-access/transactions/client/sessions/swap"))
.header("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
.header("X-Origin", "third-party-api")
.header("X-Timestamp", "2025-10-12T14:30:00.000Z")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());using System.Net.Http;
using System.Text;
using System.Text.Json;
var payload = new {
description = "Currency exchange",
transaction = new {
amount = 50000,
from_currency = "xof",
to_currency = "cad",
country = "bf",
priority = "standard"
},
source_wallet = "wallet-xof-456",
destination_wallet = "wallet-cad-789",
session_type = "swap_transaction",
metadata = new {},
swap_type = "SWAP"
};
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap");
request.Headers.Add("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY");
request.Headers.Add("X-Origin", "third-party-api");
request.Headers.Add("X-Timestamp", "2025-10-12T14:30:00.000Z");
var jsonContent = JsonSerializer.Serialize(payload);
request.Content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);3. Swap and Send with Quote ID
This example shows how to swap currency and send it to an external recipient in a single transaction, using a payout_quote_id.
curl -X POST "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap" \
-H "Authorization: HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY" \
-H "X-Origin: third-party-api" \
-H "X-Timestamp: 2025-10-12T14:30:00.000Z" \
-H "Content-Type: application/json" \
-d '{
"description": "Send money to Canada",
"payout_quote_id": "quote-payout-456",
"source_wallet": "wallet-xof-123",
"payout_recipient": {
"id": "recipient-789"
},
"session_type": "swap_and_send",
"metadata": {},
"swap_type": "SWAP_SEND"
}'const response = await fetch('https://sandbox.mara.boo/api-access/transactions/client/sessions/swap', {
method: 'POST',
headers: {
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: "Send money to Canada",
payout_quote_id: "quote-payout-456",
source_wallet: "wallet-xof-123",
payout_recipient: {
id: "recipient-789"
},
session_type: "swap_and_send",
metadata: {},
swap_type: "SWAP_SEND"
})
});import requests
response = requests.post(
'https://sandbox.mara.boo/api-access/transactions/client/sessions/swap',
headers={
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
json={
"description": "Send money to Canada",
"payout_quote_id": "quote-payout-456",
"source_wallet": "wallet-xof-123",
"payout_recipient": {
"id": "recipient-789"
},
"session_type": "swap_and_send",
"metadata": {},
"swap_type": "SWAP_SEND"
}
)package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"description": "Send money to Canada",
"payout_quote_id": "quote-payout-456",
"source_wallet": "wallet-xof-123",
"payout_recipient": map[string]interface{}{
"id": "recipient-789",
},
"session_type": "swap_and_send",
"metadata": map[string]interface{}{},
"swap_type": "SWAP_SEND",
}
jsonData, _ := json.Marshal(payload)
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
req.Header.Set("X-Origin", "third-party-api")
req.Header.Set("X-Timestamp", "2025-10-12T14:30:00.000Z")
req.Header.Set("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String jsonPayload = "{\"description\":\"Send money to Canada\",\"payout_quote_id\":\"quote-payout-456\",\"source_wallet\":\"wallet-xof-123\",\"payout_recipient\":{\"id\":\"recipient-789\"},\"session_type\":\"swap_and_send\",\"metadata\":{},\"swap_type\":\"SWAP_SEND\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://sandbox.mara.boo/api-access/transactions/client/sessions/swap"))
.header("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
.header("X-Origin", "third-party-api")
.header("X-Timestamp", "2025-10-12T14:30:00.000Z")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());using System.Net.Http;
using System.Text;
using System.Text.Json;
var payload = new {
description = "Send money to Canada",
payout_quote_id = "quote-payout-456",
source_wallet = "wallet-xof-123",
payout_recipient = new {
id = "recipient-789"
},
session_type = "swap_and_send",
metadata = new {},
swap_type = "SWAP_SEND"
};
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap");
request.Headers.Add("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY");
request.Headers.Add("X-Origin", "third-party-api");
request.Headers.Add("X-Timestamp", "2025-10-12T14:30:00.000Z");
var jsonContent = JsonSerializer.Serialize(payload);
request.Content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);4. Swap and Send with Transaction Object
This example shows how to perform a swap-and-send by providing the transaction details directly.
curl -X POST "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap" \
-H "Authorization: HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY" \
-H "X-Origin: third-party-api" \
-H "X-Timestamp: 2025-10-12T14:30:00.000Z" \
-H "Content-Type: application/json" \
-d '{
"description": "Send money to Canada",
"transaction": {
"amount": 50000,
"from_currency": "xof",
"to_currency": "cad",
"country": "ca",
"priority": "standard"
},
"source_wallet": "wallet-xof-123",
"payout_recipient": {
"id": "recipient-789"
},
"session_type": "swap_and_send",
"metadata": {},
"swap_type": "SWAP_SEND"
}'const response = await fetch('https://sandbox.mara.boo/api-access/transactions/client/sessions/swap', {
method: 'POST',
headers: {
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
body: JSON.stringify({
description: "Send money to Canada",
transaction: {
amount: 50000,
from_currency: "xof",
to_currency: "cad",
country: "ca",
priority: "standard"
},
source_wallet: "wallet-xof-123",
payout_recipient: {
id: "recipient-789"
},
session_type: "swap_and_send",
metadata: {},
swap_type: "SWAP_SEND"
})
});import requests
response = requests.post(
'https://sandbox.mara.boo/api-access/transactions/client/sessions/swap',
headers={
'Authorization': 'HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY',
'X-Origin': 'third-party-api',
'X-Timestamp': '2025-10-12T14:30:00.000Z',
'Content-Type': 'application/json'
},
json={
"description": "Send money to Canada",
"transaction": {
"amount": 50000,
"from_currency": "xof",
"to_currency": "cad",
"country": "ca",
"priority": "standard"
},
"source_wallet": "wallet-xof-123",
"payout_recipient": {
"id": "recipient-789"
},
"session_type": "swap_and_send",
"metadata": {},
"swap_type": "SWAP_SEND"
}
)package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
payload := map[string]interface{}{
"description": "Send money to Canada",
"transaction": map[string]interface{}{
"amount": 50000,
"from_currency": "xof",
"to_currency": "cad",
"country": "ca",
"priority": "standard",
},
"source_wallet": "wallet-xof-123",
"payout_recipient": map[string]interface{}{
"id": "recipient-789",
},
"session_type": "swap_and_send",
"metadata": map[string]interface{}{},
"swap_type": "SWAP_SEND",
}
jsonData, _ := json.Marshal(payload)
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap", bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
req.Header.Set("X-Origin", "third-party-api")
req.Header.Set("X-Timestamp", "2025-10-12T14:30:00.000Z")
req.Header.Set("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
String jsonPayload = "{\"description\":\"Send money to Canada\",\"transaction\":{\"amount\":50000,\"from_currency\":\"xof\",\"to_currency\":\"cad\",\"country\":\"ca\",\"priority\":\"standard\"},\"source_wallet\":\"wallet-xof-123\",\"payout_recipient\":{\"id\":\"recipient-789\"},\"session_type\":\"swap_and_send\",\"metadata\":{},\"swap_type\":\"SWAP_SEND\"}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://sandbox.mara.boo/api-access/transactions/client/sessions/swap"))
.header("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY")
.header("X-Origin", "third-party-api")
.header("X-Timestamp", "2025-10-12T14:30:00.000Z")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());using System.Net.Http;
using System.Text;
using System.Text.Json;
var payload = new {
description = "Send money to Canada",
transaction = new {
amount = 50000,
from_currency = "xof",
to_currency = "cad",
country = "ca",
priority = "standard"
},
source_wallet = "wallet-xof-123",
payout_recipient = new {
id = "recipient-789"
},
session_type = "swap_and_send",
metadata = new {},
swap_type = "SWAP_SEND"
};
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://sandbox.mara.boo/api-access/transactions/client/sessions/swap");
request.Headers.Add("Authorization", "HMAC-SHA256 YOUR_PUBLIC_KEY:YOUR_PRIVATE_KEY");
request.Headers.Add("X-Origin", "third-party-api");
request.Headers.Add("X-Timestamp", "2025-10-12T14:30:00.000Z");
var jsonContent = JsonSerializer.Serialize(payload);
request.Content = new StringContent(jsonContent, Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);