API Documentation
Learn how to integrate Web3 Crafter into your application
Overview
What's live? /balances, /allowances.
Coming next: NFT balances, decoded tx history, webhook notifications.
Web3 Crafter provides a unified API for accessing Web3 balances and allowances across multiple blockchains. Our API is designed to be simple to use and highly reliable.
All API endpoints are available at https://api.chainlens.com/v1
Authentication
All API requests require an API key. You can get an API key by signing up for an account.
Include your API key in the X-API-Key
header with all requests.
bashcurl -X GET \ https://api.chainlens.com/v1/balances?address=0x123... \ -H "X-API-Key: your_api_key_here"
GET /balances
Retrieve token balances for a specific address across multiple chains.
Parameters
address
- The wallet address to query (required)chains
- Comma-separated list of chain IDs (optional)tokens
- Comma-separated list of token addresses (optional)
bashcurl -X GET \ "https://api.chainlens.com/v1/balances?address=0x123...&chains=1,137" \ -H "X-API-Key: your_api_key_here"
Response
json{ "address": "0x123...", "balances": [ { "chain_id": 1, "token_address": "0x0000000000000000000000000000000000000000", "symbol": "ETH", "balance": "1000000000000000000", "decimals": 18, "usd_value": 3500.25 }, { "chain_id": 137, "token_address": "0x0000000000000000000000000000000000001010", "symbol": "MATIC", "balance": "5000000000000000000", "decimals": 18, "usd_value": 5.75 } ] }
GET /allowances
Retrieve token allowances for a specific address across multiple chains.
Parameters
address
- The wallet address to query (required)chains
- Comma-separated list of chain IDs (optional)tokens
- Comma-separated list of token addresses (optional)
bashcurl -X GET \ "https://api.chainlens.com/v1/allowances?address=0x123...&chains=1" \ -H "X-API-Key: your_api_key_here"
Response
json{ "address": "0x123...", "allowances": [ { "chain_id": 1, "token_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "symbol": "USDC", "spender": "0xdef...", "allowance": "1000000000", "decimals": 6, "usd_value": 1000.00 } ] }
Webhooks
Set up webhooks to receive notifications when balances or allowances change.
Creating a Webhook
bashcurl -X POST \ https://api.chainlens.com/v1/webhooks \ -H "X-API-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-server.com/webhook", "events": ["balance.changed", "allowance.changed"], "address": "0x123..." }'
Webhook Payload
json{ "event": "balance.changed", "address": "0x123...", "chain_id": 1, "token_address": "0x0000000000000000000000000000000000000000", "symbol": "ETH", "previous_balance": "1000000000000000000", "new_balance": "2000000000000000000", "timestamp": 1625097600 }