Python (SDK)
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.earn.earn_balances(chain=models.V2EarnBalancesChain.BASE, owner="0x06A9aF046187895AcFc7258450B15397CAc67400")
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.earn.earnBalances({
chain: "base",
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v2/earn/balances \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v2/earn/balances', 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.compasslabs.ai/v2/earn/balances",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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.compasslabs.ai/v2/earn/balances"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.compasslabs.ai/v2/earn/balances")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/earn/balances")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"earn_account_address": "<string>",
"balances": {
"USDC": {
"balance": "70710737",
"balance_formatted": "70.710737",
"token_address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"token_decimals": 6,
"token_symbol": "USDC",
"transfers": [
{
"amount": "70710737",
"amount_formatted": "70.710737",
"block_number": 43830869,
"block_timestamp": "2026-03-25T15:04:45Z",
"direction": "in",
"from_address": "0x111111125421cA6dc452d289314280a0f8842A65",
"to_address": "0xA4Dc919c61fDAA100AC9aB8Fae4A2d725165C181",
"transaction_hash": "0x949969bf49c100beca5d05bebbc99a57608a6d1f7472c621f3b00a5987bb417a"
}
],
"usd_value": "70.77"
},
"WETH": {
"balance": "876484654169830",
"balance_formatted": "0.000876",
"token_address": "0x4200000000000000000000000000000000000006",
"token_decimals": 18,
"token_symbol": "WETH",
"transfers": [
{
"amount": "876484654169830",
"amount_formatted": "0.000876",
"block_number": 43482380,
"block_timestamp": "2026-03-17T13:28:27Z",
"direction": "in",
"from_address": "0xd4a0e0b9149bcee3c920d2e00b5de09138fd8bb7",
"to_address": "0xA4Dc919c61fDAA100AC9aB8Fae4A2d725165C181",
"transaction_hash": "0x4165f6f2185375050f39413833e7a77f33c9c4afd429acec0d867315d96b2ea4"
}
],
"usd_value": "1.80"
}
},
"total_usd_value": "72.57"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Earn
Get token balances
Get token balances and transfer history for an earn account.
Returns on-chain token balances for all tokens the earn account has interacted with, along with the complete transfer history for each token. Balances are keyed by token symbol for easy access.
Use this endpoint to display account balances, track token movements, or build transaction history interfaces.
GET
/
v2
/
earn
/
balances
Python (SDK)
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.earn.earn_balances(chain=models.V2EarnBalancesChain.BASE, owner="0x06A9aF046187895AcFc7258450B15397CAc67400")
# Handle response
print(res)import { CompassApiSDK } from "@compass-labs/api-sdk";
const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await compassApiSDK.earn.earnBalances({
chain: "base",
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v2/earn/balances \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v2/earn/balances', 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.compasslabs.ai/v2/earn/balances",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$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.compasslabs.ai/v2/earn/balances"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
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.compasslabs.ai/v2/earn/balances")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v2/earn/balances")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"earn_account_address": "<string>",
"balances": {
"USDC": {
"balance": "70710737",
"balance_formatted": "70.710737",
"token_address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"token_decimals": 6,
"token_symbol": "USDC",
"transfers": [
{
"amount": "70710737",
"amount_formatted": "70.710737",
"block_number": 43830869,
"block_timestamp": "2026-03-25T15:04:45Z",
"direction": "in",
"from_address": "0x111111125421cA6dc452d289314280a0f8842A65",
"to_address": "0xA4Dc919c61fDAA100AC9aB8Fae4A2d725165C181",
"transaction_hash": "0x949969bf49c100beca5d05bebbc99a57608a6d1f7472c621f3b00a5987bb417a"
}
],
"usd_value": "70.77"
},
"WETH": {
"balance": "876484654169830",
"balance_formatted": "0.000876",
"token_address": "0x4200000000000000000000000000000000000006",
"token_decimals": 18,
"token_symbol": "WETH",
"transfers": [
{
"amount": "876484654169830",
"amount_formatted": "0.000876",
"block_number": 43482380,
"block_timestamp": "2026-03-17T13:28:27Z",
"direction": "in",
"from_address": "0xd4a0e0b9149bcee3c920d2e00b5de09138fd8bb7",
"to_address": "0xA4Dc919c61fDAA100AC9aB8Fae4A2d725165C181",
"transaction_hash": "0x4165f6f2185375050f39413833e7a77f33c9c4afd429acec0d867315d96b2ea4"
}
],
"usd_value": "1.80"
}
},
"total_usd_value": "72.57"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Query Parameters
Available options:
arbitrum, base, bsc, ethereum, tempo The address of the owner of the earn account.
Response
Successful Response
Response containing earn account balances and transfer history.
The derived earn account address.
Example:
"0xA4Dc919c61fDAA100AC9aB8Fae4A2d725165C181"
Token balances keyed by token symbol.
Show child attributes
Show child attributes
Example:
{ "USDC": { "balance": "70710737", "balance_formatted": "70.710737", "token_address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "token_decimals": 6, "token_symbol": "USDC", "transfers": [ { "amount": "70710737", "amount_formatted": "70.710737", "block_number": 43830869, "block_timestamp": "2026-03-25T15:04:45Z", "direction": "in", "from_address": "0x111111125421cA6dc452d289314280a0f8842A65", "to_address": "0xA4Dc919c61fDAA100AC9aB8Fae4A2d725165C181", "transaction_hash": "0x949969bf49c100beca5d05bebbc99a57608a6d1f7472c621f3b00a5987bb417a" } ], "usd_value": "70.77" }, "WETH": { "balance": "876484654169830", "balance_formatted": "0.000876", "token_address": "0x4200000000000000000000000000000000000006", "token_decimals": 18, "token_symbol": "WETH", "transfers": [ { "amount": "876484654169830", "amount_formatted": "0.000876", "block_number": 43482380, "block_timestamp": "2026-03-17T13:28:27Z", "direction": "in", "from_address": "0xd4a0e0b9149bcee3c920d2e00b5de09138fd8bb7", "to_address": "0xA4Dc919c61fDAA100AC9aB8Fae4A2d725165C181", "transaction_hash": "0x4165f6f2185375050f39413833e7a77f33c9c4afd429acec0d867315d96b2ea4" } ], "usd_value": "1.80" } }
Total USD value of all balances (sum of available values).
Example:
"72.57"
Was this page helpful?
⌘I