Skip to main content

Get Balances – Solana API

Use this endpoint to fetch the SOL balance and all SPL token balances (both spl-token and spl-token-2022) for a wallet in a single request.

A small fee is charged from the privateKey.

Endpoint​

POST https://api.pumpapi.io

Request Body​

FieldRequiredDescription
actionYesMust be "getBalances"
privateKeyYes*Private key of the wallet that pays the fee. Not required if you pass apiKey instead.
apiKeyNo*Pass it instead of privateKey if you prefer not to send your private key. Generate one on the Trade API page (πŸ”‘ spoiler).
publicKeyNoWallet address whose balances you want to fetch. Defaults to the address derived from privateKey.

πŸ“¦ Code Examples​

import requests

url = "https://api.pumpapi.io"

data = {
"action": "getBalances",
"privateKey": "base58_private_key", # or use "apiKey": "your_api_key" instead β€” generate one at pumpapi.io/trade-api (πŸ”‘ spoiler)
# "publicKey": "optional_other_wallet_address",
}

response = requests.post(url, json=data)
print(response.json())

Example Response​

solBalance is a plain number in SOL. Each entry under tokenBalances is keyed by the token mint address, and balance. Tokens sitting in non-ATA accounts are skipped.

{
"solBalance": 0.4231,
"tokenBalances": {
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": {
"balance": 12.5,
"tokenProgram": "spl-token"
},
"H74CYmXgMkYHYuSRsZt6RJb4NYp2u72Vw8BS5huApump": {
"balance": 1000,
"tokenProgram": "spl-token-2022"
// "frozen": true // appears only if you hit a scam token that froze your account (you can still burn such tokens)
}
}
}

Need help? Join our Telegram group.