Getting Started
Welcome to Dwellir's API platform. This guide helps you create an API key and make your first request in minutes.
1. Sign Up and Create an API Key​
- Go to dashboard.dwellir.com and sign up
- Navigate to the API Keys section
- Click "Create API Key" to generate your first key
- Copy your API key (format:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
)
2. Choose a Network​
Select from 140+ supported networks. Popular choices include:
- Ethereum:
ethereum-mainnet
- Base:
base-mainnet
- Arbitrum:
arbitrum-one
- Polygon:
polygon-mainnet
- Polkadot:
polkadot
See the full list in Supported Chains.
3. Make Your First Request​
The API key is included directly in the URL. No Authorization header needed!
Using cURL​
curl -X POST \
-H "Content-Type: application/json" \
https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
Example with endpoint format​
curl -X POST \
-H "Content-Type: application/json" \
https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
4. Use an SDK​
Web3.js​
const Web3 = require('web3');
// API key is in the URL, no auth header needed
const web3 = new Web3('https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY');
// Make requests
const blockNumber = await web3.eth.getBlockNumber();
console.log('Latest block:', blockNumber);
// Get balance
const balance = await web3.eth.getBalance('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb');
console.log('Balance:', web3.utils.fromWei(balance, 'ether'), 'ETH');
Ethers.js​
import { JsonRpcProvider } from 'ethers';
// API key is in the URL, no auth header needed
const provider = new JsonRpcProvider(
'https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY'
);
// Make requests
const blockNumber = await provider.getBlockNumber();
console.log('Latest block:', blockNumber);
// Get balance
const balance = await provider.getBalance('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb');
console.log('Balance:', ethers.formatEther(balance), 'ETH');
WebSocket Connection​
const WebSocket = require('ws');
const ws = new WebSocket('wss://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY');
ws.on('open', () => {
// Subscribe to new blocks
ws.send(JSON.stringify({
jsonrpc: '2.0',
method: 'eth_subscribe',
params: ['newHeads'],
id: 1
}));
});
ws.on('message', (data) => {
const response = JSON.parse(data);
console.log('New block:', response);
});
5. Configure API Quotas​
Protect yourself from unexpected usage by setting quotas on your API keys:
- Go to dashboard.dwellir.com/api-keys
- Click the edit icon next to your API key
- In the Edit API key dialog:
- Name: Give your key a descriptive name
- Daily quota: Toggle and set daily request limit
- Monthly quota: Toggle and set monthly request limit
- Click "Update API Key" to save changes
When a quota is reached, the API will return a 429 error until the quota resets.
6. Monitor Your Usage​
Track your API usage in real-time:
- Go to dashboard.dwellir.com/usage
- View metrics:
- Total requests
- Requests by method
- Requests by network
- Response times
- Error rates
Set up alerts to notify you when approaching limits.
7. Best Practices​
Error Handling​
async function makeRequest() {
try {
const blockNumber = await web3.eth.getBlockNumber();
return blockNumber;
} catch (error) {
if (error.code === 429) {
console.log('Rate limit exceeded, retry after delay');
// Implement exponential backoff
} else {
console.error('Request failed:', error);
}
}
}
Connection Pooling​
// Reuse provider instances
const providers = {
ethereum: new Web3('https://api-ethereum-mainnet.n.dwellir.com/YOUR_API_KEY'),
polygon: new Web3('https://api-polygon-mainnet.n.dwellir.com/YOUR_API_KEY'),
arbitrum: new Web3('https://api-arbitrum-one.n.dwellir.com/YOUR_API_KEY')
};
// Use the same provider for multiple requests
async function getMultiChainData() {
const ethBlock = await providers.ethereum.eth.getBlockNumber();
const polyBlock = await providers.polygon.eth.getBlockNumber();
const arbBlock = await providers.arbitrum.eth.getBlockNumber();
return { ethBlock, polyBlock, arbBlock };
}
Batch Requests​
// Batch multiple calls into one request
const batch = new web3.BatchRequest();
batch.add(web3.eth.getBlockNumber.request((err, res) => {
console.log('Block number:', res);
}));
batch.add(web3.eth.getGasPrice.request((err, res) => {
console.log('Gas price:', res);
}));
batch.execute();
Quick Reference​
Endpoint Format​
https://api-{network}.n.dwellir.com/{YOUR_API_KEY}
wss://api-{network}.n.dwellir.com/{YOUR_API_KEY}
Common Networks​
- Ethereum:
api-ethereum-mainnet
- Base:
api-base-mainnet
- Arbitrum:
api-arbitrum-one
- Optimism:
api-optimism-mainnet
- Polygon:
api-polygon-mainnet
- BSC:
api-bsc-mainnet
- Avalanche:
api-avalanche-c-chain
Useful Links​
Need Help?​
- Check our documentation for network-specific details
- Join our Discord for community support
- Contact support@dwellir.com for technical assistance
Ready to scale? Upgrade your plan for higher rate limits and additional features.