The following functionality exists for wallets reconstituted
server-side. More on Privy architecture
here
- REST API
- NodeJS
- Java
- Rust
Privy supports fetching wallet balances by the wallet ID.To do so, make a replacing The response might look like
GET request toReport incorrect code
Copy
Ask AI
https://api.privy.io/v1/wallets/<wallet_id>/balance
<wallet_id> with the ID of your desired wallet.Response
The wallet’s native token balance in the smallest denomination (e.g., wei for Ethereum). Returned
as a string to maintain precision.
The blockchain type (e.g., “ethereum”, “solana”).
The wallet’s public address.
Example
For example, your app might fetch a wallet’s balance using thecURL request below.Report incorrect code
Copy
Ask AI
$ curl --request GET https://api.privy.io/v1/wallets/<wallet_id>/balance \
-u "<your-privy-app-id>:<your-privy-app-secret>" \
-H "privy-app-id: <your-privy-app-id>" \
-H 'Content-Type: application/json'
Report incorrect code
Copy
Ask AI
{
"balances": [
{
"chain": "base",
"asset": "eth",
"raw_value": "1000000000000000000",
"raw_value_decimals": 18,
"display_values": {
"eth": "0.001",
"usd": "2.56"
}
}
]
}
Parameters and Returns
Check out the API reference for more details.To get a wallet’s balance using the NodeJS SDK, use the
getBalance method on the wallets() interface of the Privy client:Usage
Report incorrect code
Copy
Ask AI
import {PrivyClient} from '@privy-io/node';
const privy = new PrivyClient({
appId: 'insert-your-app-id',
appSecret: 'insert-your-app-secret'
});
const balance = await privy.wallets().balance.get('insert-wallet-id', {
asset: 'usdc',
chain: 'ethereum'
});
console.log(balance);
Parameters and Returns
Check out the API reference for more details.To get a wallet’s balance by ID, use the
getBalance method.Report incorrect code
Copy
Ask AI
try {
WalletBalanceResponse response = privyClient
.wallets()
.balance()
.walletId("insert-wallet-id")
.call();
if (response.object().isPresent()) {
WalletBalanceResponseBody balanceBody = response.object().get();
// The response contains a list of balances (one per chain/asset combination)
for (Balance balance : balanceBody.balances()) {
String rawValue = balance.rawValue();
double rawValueDecimals = balance.rawValueDecimals();
System.out.println("Balance: " + rawValue);
System.out.println("Balance (decimals): " + rawValueDecimals);
System.out.println("Chain: " + balance.chain());
System.out.println("Asset: " + balance.asset());
}
}
} catch (APIException e) {
String errorBody = e.bodyAsString();
System.err.println(errorBody);
} catch (Exception e) {
System.err.println(e.getMessage());
}
Parameters
The ID of the wallet to retrieve balance for
Returns
TheWalletBalanceResponse object contains balance information for the wallet.List of balance objects for different chain/asset combinations.
Hide child attributes
Hide child attributes
Balance value as a string in the smallest denomination to maintain precision.
Balance value as a decimal number.
The blockchain type (e.g., ETHEREUM, SOLANA, BASE, POLYGON).
The asset type (e.g., NATIVE, USDC, USDT).
Formatted display values for the balance in different currencies/formats.
To get a wallet’s balance using the Rust SDK, use the
get_balance method on the wallets() interface of the Privy client:Usage
Report incorrect code
Copy
Ask AI
use privy_rs::PrivyClient;
let client = PrivyClient::new(app_id, app_secret)?;
// For a Solana wallet
let balance = client
.wallets()
.balance()
.get(
"insert-wallet-id",
&GetWalletBalanceAsset::String(GetWalletBalanceAssetString::Sol),
&GetWalletBalanceChain::String(GetWalletBalanceChainString::Solana),
None, // optional: currency conversion (e.g., Some(GetWalletBalanceIncludeCurrency::Usd))
)
.await?;

