Get balance for a specific token
curl --request GET \
--url https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}', 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.soroswap.finance/balances/{walletAddress}/{tokenAddress}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"wallet": "GDMTVHLWJTHSUDMZVVMXXH6VJHA2ZV3HNG5LYNAZ6RTWB7GISM6PGTUV",
"network": "mainnet",
"balance": {
"asset": {
"code": "XLM",
"issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
"contract": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"name": "Stellar Lumens",
"icon": "https://example.com/xlm-icon.png",
"decimals": 7
},
"amount": "100.0000000",
"rawAmount": "1000000000",
"available": "97.5000000",
"availableRaw": "975000000"
},
"updatedAt": 1702483200000
}Market data
Get balance for a specific token
Retrieves the balance of a specific token for an address.
Supports both wallet addresses (G-prefixed) and smart contracts/accounts (C-prefixed).
Token address can be:
- Contract ID (C-prefixed, 56 characters)
- CODE:ISSUER format (e.g., USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN)
Example: GET /balances/GALAXYVOIDAOPZTDLHILAJQKCVVFMD4IKLXLSZV5YHO7VY74IWZILUTO/CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA?network=mainnet
GET
/
balances
/
{walletAddress}
/
{tokenAddress}
Get balance for a specific token
curl --request GET \
--url https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}', 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.soroswap.finance/balances/{walletAddress}/{tokenAddress}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.soroswap.finance/balances/{walletAddress}/{tokenAddress}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"wallet": "GDMTVHLWJTHSUDMZVVMXXH6VJHA2ZV3HNG5LYNAZ6RTWB7GISM6PGTUV",
"network": "mainnet",
"balance": {
"asset": {
"code": "XLM",
"issuer": "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN",
"contract": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
"name": "Stellar Lumens",
"icon": "https://example.com/xlm-icon.png",
"decimals": 7
},
"amount": "100.0000000",
"rawAmount": "1000000000",
"available": "97.5000000",
"availableRaw": "975000000"
},
"updatedAt": 1702483200000
}Authorizations
Path Parameters
Query Parameters
Response
Returns the token balance. If the token is not in the asset list, code is 'UNKNOWN' and decimals are read from the contract's decimals() (7 for a CODE:ISSUER classic asset, or when that read fails)