Wallet Endpoints
Query wallet UTXOs and balances directly from Anvil's indexed blockchain data.
Query wallet data server-side without a browser wallet. Returns data ready for the Anvil transaction builder.
/wallets/utxos
GET
Fetch UTXOs for transaction building
/wallets/balance
GET
Get aggregated balance (ADA + native assets)
GET /wallets/utxos
/wallets/utxosReturns hex-encoded CBOR UTXOs ready for transaction building—same format as CIP-30 getUtxos().
Parameters:
address
string
One required
Bech32 payment address
stakeAddress
string
One required
Bech32 stake address (queries all derived addresses)
withScripts
boolean
No
Include reference scripts
includeMempool
boolean
No
Include UTXOs from pending transactions
const API_BASE = 'https://preprod.api.ada-anvil.app/v2/services';
// Fetch UTXOs by payment address
const response = await fetch(`${API_BASE}/wallets/utxos?address=addr_test1qz...`, {
headers: { 'X-Api-Key': 'YOUR_API_KEY' }
});
const utxos = await response.json(); // string[]
// Use directly in transaction building
await fetch(`${API_BASE}/transactions/build`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-Api-Key': 'YOUR_API_KEY' },
body: JSON.stringify({
changeAddress: 'addr_test1qz...',
utxos, // Ready to use!
outputs: [{ address: 'addr_test1qy...', lovelace: 5_000_000 }]
})
});GET /wallets/balance
/wallets/balanceReturns aggregated balance as hex-encoded CBOR Value (lovelace + native assets).
Parameters:
address
string
One required
Bech32 payment address
stakeAddress
string
One required
Bech32 stake address
When to Use
Building transactions
/wallets/utxos — exact format for transactions/build
Displaying wallet balance
/wallets/balance — single aggregated value
Checking for specific asset
/wallets/utxos — inspect individual UTXOs
Query entire stake account
Either with stakeAddress parameter
Related: Selecting UTXOs · Wallet CLI
Last updated
Was this helpful?

