Introduction
This documentation provides a comprehensive reference for DeFi API endpoints related to user account management and portfolio tracking. The API enables developers to integrate decentralized finance functionality into their applications while maintaining full control over user assets.
Core Features
- Portfolio Tracking: Monitor user positions across multiple protocols
- Balance Management: Track token balances across supported networks
- Transaction History: Access redemption and investment records
- Position Analysis: View holdings at both protocol and asset levels
User Endpoint Categories
1. Portfolio Management
GET /personal/asset-platform-list
Retrieves a user's cross-platform position summaryGET /personal/asset-platform-detail
Provides protocol-specific position details
2. Balance Tracking
GET /personal/query-balance
Returns comprehensive balance information across all supported assetsGET /personal/invest-unstake-list
Lists all pending redemption requests
3. Position Analysis
GET /personal/query-position
Generates asset-level position reports with current valuations
Implementation Best Practices
- Authentication:
Ensure proper API key management and request signing - Rate Limiting:
Implement appropriate call intervals (recommended 1 request/sec) - Data Caching:
Cache responses where possible to reduce API calls - Error Handling:
Implement robust retry logic for failed requests
Sample Request Structure
{
"method": "GET",
"endpoint": "/personal/query-position",
"params": {
"wallet_address": "0x...",
"chain_id": 1,
"page_size": 50,
"page_number": 1
}
}FAQ Section
Q: How frequently should I poll for balance updates?
A: For most applications, polling every 5-10 minutes provides sufficient freshness without hitting rate limits.
Q: Can I filter positions by protocol?
A: Yes, use the /personal/asset-platform-detail endpoint with the protocol parameter.
Q: What's the maximum historical data available?
A: Currently 90 days of transaction history is available through the API.
Q: Are testnet endpoints available?
A: Yes, all endpoints support testnet environments with identical functionality.
๐ Explore DeFi API use cases
Technical Considerations
- Always verify response signatures
- Monitor API versioning for breaking changes
- Implement proper gas estimation for transaction endpoints
- Consider using webhooks for event-driven updates where available
Additional Resources
- API response code documentation
- Network status dashboard
- Rate limit monitoring tools
- Web3 security best practices guide
๐ Get started with OKX Web3 APIs
Conclusion
This API reference provides developers with powerful tools to build sophisticated DeFi applications while maintaining security and performance standards. For implementation assistance, consult our developer community forums or technical documentation portal.