Wallet Asset Valuation Guide: Total Value API for Web3 Developers

·

Overview

The Total Value API allows developers to retrieve comprehensive asset valuations for Web3 wallets, including tokens and DeFi positions. This powerful tool helps users track their entire portfolio value while filtering out unwanted assets like spam tokens.

Total Value API Endpoint

Request URL

GET `https://web3.okx.com/api/v5/wallet/asset/total-value`

Key Features

API Parameters

ParameterTypeRequiredDescription
accountIdStringYesUnique account identifier
chainsStringNoComma-separated chain filters (max 50)
assetTypeStringNoAsset filter: 0=All, 1=Tokens only, 2=DeFi only
excludeRiskTokenBooleanNoFilters risky airdrop tokens (default: true)

👉 Explore Web3 Wallet APIs

Response Structure

FieldTypeDescription
totalValueStringUSD-denominated total asset value

Implementation Example

curl --location --request GET 'https://web3.okx.com/api/v5/wallet/asset/total-value?accountId=e7dba4c2-666d-496a-ad92-768d29291fee&chains=' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'

Sample Response

{
 "code": "0",
 "msg": "success",
 "data": [
 {
 "totalValue": "1172.895057177065864522056725546579939398"
 }
 ]
}

👉 Build with Web3 Wallet API

Frequently Asked Questions

What types of assets does the Total Value API include?

The API calculates valuations for both fungible tokens and DeFi protocol positions across supported blockchains.

How often should I call this API for portfolio updates?

For most applications, polling every 5-15 minutes provides adequate refresh rates without exceeding rate limits.

Can I filter valuations by specific chains?

Yes, the chains parameter accepts comma-separated chain identifiers to scope valuation calculations.

Why would my total value fluctuate between calls?

Valuations change with market prices and network conditions. Large swings may indicate oracle updates or protocol activity.

How does the spam filter work?

Our risk engine identifies known scam tokens and questionable airdrops, excluding them from calculations when enabled.

Best Practices for Wallet Valuation Integration

  1. Cache Responses: Store valuation data locally to reduce API calls
  2. Error Handling: Implement retry logic for temporary failures
  3. User Education: Explain valuation methodologies to end users
  4. Performance Monitoring: Track API latency and success rates

For advanced wallet functionality, consider our complete 👉 Web3 API Suite.