Calculate Swap
GET /api-access/api/calculator/swap-calculator
Calculate currency swap fees and amounts.
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
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
from_currency | string | Yes | Source currency code (e.g., xof, cad) |
to_currency | string | Yes | Target currency code (e.g., cad, xof) |
amount | number | Yes | Amount to swap |
priority | string | Yes | Transaction priority (e.g., standard) |
mode | string | Yes | Transaction mode (e.g., send) |
Example Query:
?from_currency=xof&to_currency=cad&amount=10000&priority=standard&mode=sendResponse
Success Response (200):
json
{
"data": {
"our_fee": 0,
"total_fees": 0,
"we_convert": 0,
"partner_fee": 0,
"exchange_rate": 0,
"converted": 0,
"user_pays": 0,
"errors": [
{
"error_code": "OTP_ERROR",
"suggested_receive_amount": 0,
"suggested_receive_amount_currency": "xof",
"suggested_values": {
"our_fee": 0,
"total_fees": 0,
"we_convert": 0,
"partner_fee": 0,
"exchange_rate": 0,
"converted": 0,
"user_pays": 0
}
}
],
"quote_id": "string",
"enabled": true,
"mode": "string",
"priority": "string",
"market_rate": 0
},
"success": true,
"message": "string",
"detail": {}
}Response Fields:
| Field | Type | Description |
|---|---|---|
our_fee | number | Maraboo's fee |
total_fees | number | Total fees for the transaction |
we_convert | number | Amount converted by Maraboo |
partner_fee | number | Partner's fee |
exchange_rate | number | Exchange rate applied |
converted | number | Converted amount |
user_pays | number | Total amount user needs to pay |
errors | array | Array of error objects with suggestions |
quote_id | string | Unique quote identifier |
enabled | boolean | Whether the transaction is enabled |
mode | string | Transaction mode |
priority | string | Transaction priority |
market_rate | number | Current market exchange rate |
Example
bash
curl -X GET "https://sandbox.mara.boo/api-access/api/calculator/swap-calculator?from_currency=xof&to_currency=cad&amount=10000&priority=standard&mode=send" \
-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"javascript
const params = new URLSearchParams({
from_currency: 'xof',
to_currency: 'cad',
amount: '10000',
priority: 'standard',
mode: 'send'
});
const response = await fetch(`https://sandbox.mara.boo/api-access/api/calculator/swap-calculator?${params}`, {
method: 'GET',
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'
}
});
const data = await response.json();python
import requests
params = {
'from_currency': 'xof',
'to_currency': 'cad',
'amount': '10000',
'priority': 'standard',
'mode': 'send'
}
response = requests.get(
'https://sandbox.mara.boo/api-access/api/calculator/swap-calculator',
params=params,
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'
}
)
data = response.json()go
package main
import (
"net/http"
"io/ioutil"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://sandbox.mara.boo/api-access/api/calculator/swap-calculator?from_currency=xof&to_currency=cad&amount=10000&priority=standard&mode=send", nil)
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()
body, _ := ioutil.ReadAll(resp.Body)
}java
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://sandbox.mara.boo/api-access/api/calculator/swap-calculator?from_currency=xof&to_currency=cad&amount=10000&priority=standard&mode=send"))
.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")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());csharp
using System.Net.Http;
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://sandbox.mara.boo/api-access/api/calculator/swap-calculator?from_currency=xof&to_currency=cad&amount=10000&priority=standard&mode=send");
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");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
var response = await client.SendAsync(request);
var content = await response.Content.ReadAsStringAsync();Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid authentication |
| 403 | Forbidden - Missing required headers |
| 500 | Internal Server Error |