The business balance holds payments your business has received, minus SwapWallet's fee, that haven't been settled to the owner's SwapWallet account yet.
By default a payment is settled the moment it arrives, so this balance is usually zero. If your business has a hold period (lockedHours on your business), each payment stays here until its hold period ends; SwapWallet settles everything whose hold period has ended once an hour.
Endpoints
What your business balance holds, per token and in total.
totalValueobjectThe whole balance valued in Toman and in US dollars.
availablearray of MoneySum of every token's available value: one entry in Toman (IRT), one in US dollars (USD).
numberdecimal stringThe amount as a decimal string, without trailing zeros.
unitstringCurrency or token code, such as USDT, IRT (Toman) or USD.
onHoldarray of MoneyAlways zero for a business balance.
numberdecimal stringThe amount as a decimal string, without trailing zeros.
unitstringCurrency or token code, such as USDT, IRT (Toman) or USD.
tokensarray of objectsOne entry for every crypto token SwapWallet supports, zero balances included, highest Toman value first.
namestringToken code, such as USDT.
availableobjectFunds not yet settled to the owner's account, including payments still in their hold period.
amountMoneyAmount in the token.
numberdecimal stringThe amount as a decimal string, without trailing zeros.
unitstringCurrency or token code, such as USDT, IRT (Toman) or USD.
valuesarray of MoneyThe amount valued in Toman (IRT) and in US dollars (USD), in that order.
numberdecimal stringThe amount as a decimal string, without trailing zeros.
unitstringCurrency or token code, such as USDT, IRT (Toman) or USD.
onHoldobjectAlways zero for a business balance.
amountMoneyAmount in the token.
numberdecimal stringThe amount as a decimal string, without trailing zeros.
unitstringCurrency or token code, such as USDT, IRT (Toman) or USD.
valuesarray of MoneyThe amount valued in Toman (IRT) and in US dollars (USD), in that order.
numberdecimal stringThe amount as a decimal string, without trailing zeros.
unitstringCurrency or token code, such as USDT, IRT (Toman) or USD.
marketDataarray of objectsThe token's markets against the Toman and against USDT, which values are priced from. Empty for a token that isn't traded.
sourcestringThe token being priced.
destinationstringQuote currency, IRT or USDT. For USDT against USDT every price is 1.
marketDataobjectPrices in destination per one unit of source.
bestSelldecimal stringBest sell price.
bestBuydecimal stringBest buy price.
latestPricedecimal stringPrice of the last trade.
dayChangedecimal stringPrice change over the last 24 hours, in percent.
volume24hdecimal stringTrading volume over the last 24 hours.
{
"totalValue": {
"available": [
{
"number": "4951251",
"unit": "IRT"
},
{
"number": "18.1764",
"unit": "USD"
}
],
"onHold": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"tokens": [
{
"name": "USDT",
"available": {
"amount": {
"number": "18.1764",
"unit": "USDT"
},
"values": [
{
"number": "4951251",
"unit": "IRT"
},
{
"number": "18.1764",
"unit": "USD"
}
]
},
"onHold": {
"amount": {
"number": "0",
"unit": "USDT"
},
"values": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"marketData": [
{
"source": "USDT",
"destination": "IRT",
"marketData": {
"bestSell": "272410",
"bestBuy": "272390",
"latestPrice": "272400",
"dayChange": "-0.08",
"volume24h": "418230.6"
}
},
{
"source": "USDT",
"destination": "USDT",
"marketData": {
"bestSell": "1",
"bestBuy": "1",
"latestPrice": "1",
"dayChange": "0.00",
"volume24h": "0"
}
}
]
},
{
"name": "TON",
"available": {
"amount": {
"number": "0",
"unit": "TON"
},
"values": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"onHold": {
"amount": {
"number": "0",
"unit": "TON"
},
"values": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"marketData": [
{
"source": "TON",
"destination": "IRT",
"marketData": {
"bestSell": "266320",
"bestBuy": "265980",
"latestPrice": "266144",
"dayChange": "1.89",
"volume24h": "5120.4"
}
},
{
"source": "TON",
"destination": "USDT",
"marketData": {
"bestSell": "0.9781",
"bestBuy": "0.9768",
"latestPrice": "0.977",
"dayChange": "1.98",
"volume24h": "8930.12"
}
}
]
}
]
}/v1/merchants/balanceRetrieves your business balance: what each token holds and what the whole balance is worth in Toman and in US dollars.
The response lists every supported token, most of them at zero, so read the tokens whose available.amount is above zero.
No parameters.
Returns the Balance object. The example shows two of the tokens.
curl https://swapwallet.app/api/v1/merchants/balance \
-H "Authorization: Bearer $SWAPWALLET_BUSINESS_KEY"const response = await fetch('https://swapwallet.app/api/v1/merchants/balance', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SWAPWALLET_BUSINESS_KEY}`,
},
});
const data = await response.json();
console.log(data.result);import os
import requests
response = requests.get(
"https://swapwallet.app/api/v1/merchants/balance",
headers={"Authorization": f"Bearer {os.environ['SWAPWALLET_BUSINESS_KEY']}"},
)
print(response.json()["result"])<?php
$ch = curl_init('https://swapwallet.app/api/v1/merchants/balance');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SWAPWALLET_BUSINESS_KEY'),
],
]);
$data = json_decode(curl_exec($ch), true);
print_r($data['result']);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://swapwallet.app/api/v1/merchants/balance", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SWAPWALLET_BUSINESS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
fmt.Println(string(data))
}{
"status": "OK",
"result": {
"totalValue": {
"available": [
{
"number": "4951251",
"unit": "IRT"
},
{
"number": "18.1764",
"unit": "USD"
}
],
"onHold": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"tokens": [
{
"name": "USDT",
"available": {
"amount": {
"number": "18.1764",
"unit": "USDT"
},
"values": [
{
"number": "4951251",
"unit": "IRT"
},
{
"number": "18.1764",
"unit": "USD"
}
]
},
"onHold": {
"amount": {
"number": "0",
"unit": "USDT"
},
"values": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"marketData": [
{
"source": "USDT",
"destination": "IRT",
"marketData": {
"bestSell": "272410",
"bestBuy": "272390",
"latestPrice": "272400",
"dayChange": "-0.08",
"volume24h": "418230.6"
}
},
{
"source": "USDT",
"destination": "USDT",
"marketData": {
"bestSell": "1",
"bestBuy": "1",
"latestPrice": "1",
"dayChange": "0.00",
"volume24h": "0"
}
}
]
},
{
"name": "TON",
"available": {
"amount": {
"number": "0",
"unit": "TON"
},
"values": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"onHold": {
"amount": {
"number": "0",
"unit": "TON"
},
"values": [
{
"number": "0",
"unit": "IRT"
},
{
"number": "0",
"unit": "USD"
}
]
},
"marketData": [
{
"source": "TON",
"destination": "IRT",
"marketData": {
"bestSell": "266320",
"bestBuy": "265980",
"latestPrice": "266144",
"dayChange": "1.89",
"volume24h": "5120.4"
}
},
{
"source": "TON",
"destination": "USDT",
"marketData": {
"bestSell": "0.9781",
"bestBuy": "0.9768",
"latestPrice": "0.977",
"dayChange": "1.98",
"volume24h": "8930.12"
}
}
]
}
]
}
}