Docs

wallet/getaccount - Get TRON Account Information

Get comprehensive TRON account information including TRX balance, resources, TRC20 tokens, and account permissions via Dwellir's optimized RPC endpoint.

Ultra-Fast Account Queries

Dwellir's TRON endpoints deliver account information in under 50ms with 99.9% uptime. Get comprehensive account data including balance, resources, and token holdings instantly.

Start building with free API access

Get comprehensive information about a TRON account including TRX balance, bandwidth, energy, TRC20 tokens, and account permissions.

When to Use This Method

wallet/getaccount is essential for:

  • Balance Checks - Display TRX balance in wallets and apps
  • Resource Monitoring - Track bandwidth and energy consumption
  • Token Holdings - View all TRC20/TRC721 tokens owned
  • Account Validation - Verify account exists and activation status
  • Permission Analysis - Check multi-signature and account permissions

Request Parameters

Request
addressstring

TRON address in Base58 format (starts with 'T') Example: `"TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF"`

visibleboolean

`true` - Use Base58 address format `false` - Use hex address format

Response Body

Response
addressstring

Account address in the format requested by the `visible` flag.

balanceinteger

TRX balance in SUN. Divide by 1,000,000 to display TRX.

create_timeinteger

Unix timestamp in milliseconds for when the account was created.

latest_opration_timeinteger

Unix timestamp in milliseconds for the latest account operation. TRON returns the field with this spelling.

account_resourceobject

Energy usage and delegated resource information for the account.

owner_permissionobject

Owner permission threshold and signer set for the account.

active_permissionarray

Active permission entries for operational policies such as multisig roles.

assetV2array

TRC10 and token-balance style holdings exposed by the node for this account.

Error Responses

Errors
Error 1

Malformed TRON address

Error 2

RPC connection failed

Error 3

Account doesn't exist

Implementation Examples

Bash
# Basic account query
curl -X POST "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getaccount" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
    "visible": true
  }'

# Query with hex address format
curl -X POST "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getaccount" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0",
    "visible": false
  }'

# Using jq to parse response
curl -s -X POST "https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/getaccount" \
  -H "Content-Type: application/json" \
  -d '{
    "address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
    "visible": true
  }' | jq '{
    address: .address,
    balance_trx: (.balance // 0) / 1000000,
    balance_sun: .balance // 0,
    free_bandwidth: .free_net_limit // 0,
    used_bandwidth: .free_net_used // 0
  }'

Response Examples

Successful Response (Active Account)

JSON
{
  "address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
  "balance": 1500000000,
  "create_time": 1547736132000,
  "latest_opration_time": 1734567890000,
  "free_net_usage": 0,
  "free_net_limit": 5000,
  "net_limit": 10000,
  "net_usage": 1234,
  "energy_limit": 50000,
  "energy_usage": 5000,
  "assetV2": [
    {
      "key": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
      "value": 100000000
    }
  ],
  "owner_permission": {
    "type": 0,
    "id": 0,
    "permission_name": "owner",
    "threshold": 1,
    "keys": [
      {
        "address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
        "weight": 1
      }
    ]
  },
  "active_permission": [
    {
      "type": 2,
      "id": 2,
      "permission_name": "active0",
      "threshold": 1,
      "operations": "7fff1fc0037e0000000000000000000000000000000000000000000000000000",
      "keys": [
        {
          "address": "TNPdqto8HiuMzoG7Vv9wyyYhWzCojLeHAF",
          "weight": 1
        }
      ]
    }
  ]
}

Empty Response (Non-existent Account)

JSON
{}

Common Use Cases

1. Wallet Balance Display

JavaScript
async function getWalletBalance(address) {
  const account = await getAccountInfo(address);
  
  if (!account.exists) {
    return {
      status: 'inactive',
      balance: 0,
      message: 'Account not activated. Send TRX to activate.'
    };
  }
  
  return {
    status: 'active',
    balance: account.balance.trx,
    freeTransactions: account.resources.freeNetLimit - account.resources.freeNetUsed,
    lastActive: new Date(account.timestamps.lastActive).toLocaleString()
  };
}

2. Account Validation

JavaScript
async function validateTronAddress(address) {
  // Basic format validation
  if (!address.startsWith('T') || address.length !== 34) {
    return { valid: false, reason: 'Invalid address format' };
  }
  
  try {
    const account = await getAccount(address);
    return {
      valid: true,
      exists: !!account.address,
      activated: !!account.balance || account.balance === 0
    };
  } catch (error) {
    return { valid: false, reason: 'Address lookup failed' };
  }
}

3. Resource Monitoring Dashboard

JavaScript
async function getResourceStatus(address) {
  const account = await getAccountInfo(address);
  
  if (!account.exists) {
    return { error: 'Account not found' };
  }
  
  const bandwidthUsage = (account.resources.freeNetUsed / account.resources.freeNetLimit) * 100;
  const energyUsage = account.resources.energy > 0 
    ? (account.resources.energyUsed / account.resources.energy) * 100 
    : 0;
  
  return {
    bandwidth: {
      used: account.resources.freeNetUsed,
      limit: account.resources.freeNetLimit,
      usage_percent: bandwidthUsage.toFixed(2),
      status: bandwidthUsage > 80 ? 'high' : bandwidthUsage > 50 ? 'medium' : 'low'
    },
    energy: {
      used: account.resources.energyUsed || 0,
      limit: account.resources.energy,
      usage_percent: energyUsage.toFixed(2),
      status: energyUsage > 80 ? 'high' : energyUsage > 50 ? 'medium' : 'low'
    },
    recommendations: generateResourceRecommendations(bandwidthUsage, energyUsage)
  };
}

function generateResourceRecommendations(bandwidthUsage, energyUsage) {
  const recommendations = [];
  
  if (bandwidthUsage > 80) {
    recommendations.push('Consider freezing TRX for bandwidth');
  }
  
  if (energyUsage > 80) {
    recommendations.push('Freeze TRX for energy or rent energy');
  }
  
  if (bandwidthUsage < 20 && energyUsage < 20) {
    recommendations.push('Resources are well managed');
  }
  
  return recommendations;
}

4. Multi-Signature Account Analysis

JavaScript
async function analyzeAccountPermissions(address) {
  const account = await getAccount(address);
  
  if (!account.address) {
    return { error: 'Account not found' };
  }
  
  const isMultiSig = account.owner_permission?.threshold > 1 || 
                     account.active_permission?.some(p => p.threshold > 1);
  
  return {
    address: account.address,
    isMultiSignature: isMultiSig,
    ownerPermission: {
      threshold: account.owner_permission?.threshold || 1,
      keyCount: account.owner_permission?.keys?.length || 1
    },
    activePermissions: account.active_permission?.map(p => ({
      id: p.id,
      name: p.permission_name,
      threshold: p.threshold,
      keyCount: p.keys?.length || 0
    })) || []
  };
}

Performance Tips

  1. Batch Requests - Query multiple accounts concurrently but respect rate limits
  2. Cache Results - Cache account data for 30-60 seconds to reduce API calls
  3. Selective Queries - Only fetch account data when needed, not on every page load
  4. Error Boundaries - Implement proper error handling for non-existent accounts
JavaScript
// Simple caching example
class AccountCache {
  constructor(ttl = 60000) { // 1 minute TTL
    this.cache = new Map();
    this.ttl = ttl;
  }
  
  async get(address) {
    const cached = this.cache.get(address);
    if (cached && Date.now() - cached.timestamp < this.ttl) {
      return cached.data;
    }
    
    const account = await getAccountInfo(address);
    this.cache.set(address, {
      data: account,
      timestamp: Date.now()
    });
    
    return account;
  }
}

Need help? Contact our support team or check the TRON documentation.