A balance is how much of a token you can use right now. It leaves out amounts on hold, such as a withdrawal still being processed, and what sits inside your Boxes.
All of it can be swapped or spent. Withdrawing crypto is the one case where part of it may have to wait: see the 72-hour rule under Crypto withdrawals.
Your available balance of one token.
tokenstringRequiredToken symbol. IRT is the Toman.
amountMoneyRequiredAvailable balance. 0 when you hold none.
numberdecimal stringRequiredThe amount as a decimal string. Trailing zeros are dropped, so 0.5, not 0.50.
unitstringRequiredThe token symbol, such as USDT, TON or BTC. IRT is the Toman; USD marks a value in US dollars.
{
"token": "USDT",
"amount": {
"number": "1149.5",
"unit": "USDT"
}
}/v2/user/balanceReturns your balance of every supported token, plus the Toman (IRT). Tokens you don’t hold are included with 0, and the order is fixed, not sorted by value.
No parameters.
Returns an array of Balance objects in result.
curl https://swapwallet.app/api/v2/user/balance \
-H "Authorization: Bearer $SWAPWALLET_API_KEY"const response = await fetch('https://swapwallet.app/api/v2/user/balance', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SWAPWALLET_API_KEY}`,
},
});
const data = await response.json();
console.log(data.result);import os
import requests
response = requests.get(
"https://swapwallet.app/api/v2/user/balance",
headers={"Authorization": f"Bearer {os.environ['SWAPWALLET_API_KEY']}"},
)
print(response.json()["result"])<?php
$ch = curl_init('https://swapwallet.app/api/v2/user/balance');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SWAPWALLET_API_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/v2/user/balance", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SWAPWALLET_API_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": [
{
"token": "ETH",
"amount": {
"number": "0",
"unit": "ETH"
}
},
{
"token": "BNB",
"amount": {
"number": "0",
"unit": "BNB"
}
},
{
"token": "TON",
"amount": {
"number": "106.677",
"unit": "TON"
}
},
{
"token": "TRX",
"amount": {
"number": "340",
"unit": "TRX"
}
},
{
"token": "BTC",
"amount": {
"number": "0.00215",
"unit": "BTC"
}
},
{
"token": "USDT",
"amount": {
"number": "1149.5",
"unit": "USDT"
}
},
{
"token": "IRT",
"amount": {
"number": "48250000",
"unit": "IRT"
}
}
]
}/v2/user/balance/{token}Returns your balance of one token. Cheaper than listing every balance when you only need one.
tokenstringRequiredToken symbol, such as USDT, or IRT for the Toman.
Returns a Balance object in result.
INVALID_REQUEST_PARAMETERtoken isn’t a token SwapWallet knows.
curl https://swapwallet.app/api/v2/user/balance/USDT \
-H "Authorization: Bearer $SWAPWALLET_API_KEY"const response = await fetch('https://swapwallet.app/api/v2/user/balance/USDT', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SWAPWALLET_API_KEY}`,
},
});
const data = await response.json();
console.log(data.result);import os
import requests
response = requests.get(
"https://swapwallet.app/api/v2/user/balance/USDT",
headers={"Authorization": f"Bearer {os.environ['SWAPWALLET_API_KEY']}"},
)
print(response.json()["result"])<?php
$ch = curl_init('https://swapwallet.app/api/v2/user/balance/USDT');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('SWAPWALLET_API_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/v2/user/balance/USDT", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("SWAPWALLET_API_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": {
"token": "USDT",
"amount": {
"number": "1149.5",
"unit": "USDT"
}
}
}