Get started with the Octav API and make your first request in minutes.
Your First Request
Let’s start by checking your remaining credits - this endpoint is free and perfect for testing authentication.
curl -X GET https://api.octav.fi/v1/credits \
-H "Authorization: Bearer YOUR_API_KEY"
Response
The credits endpoint returns a simple number indicating your remaining credit balance.
Success! If you see a number, your API key is working correctly.
Fetch a Portfolio
Now let’s retrieve portfolio data for a blockchain address.
curl -X GET "https://api.octav.fi/v1/portfolio?addresses=0x6426af179aabebe47666f345d69fd9079673f6cd" \
-H "Authorization: Bearer YOUR_API_KEY"
Response Structure
{
"address": "0x6426af179aabebe47666f345d69fd9079673f6cd",
"cashBalance": "0",
"dailyIncome": "0",
"dailyExpense": "0",
"fees": "0",
"feesFiat": "0",
"lastUpdated": "1715173392020",
"networth": "45231.89",
"assetByProtocols": {
"wallet": {
"key": "wallet",
"name": "Wallet",
"value": "12453.20",
"assets": [
{
"balance": "1.5",
"symbol": "ETH",
"price": "3200.50",
"value": "4800.75",
"chain": "ethereum"
}
]
},
"aave_v3": {
"key": "aave_v3",
"name": "Aave V3",
"value": "8934.12",
"assets": [...]
}
},
"chains": {
"ethereum": {
"value": "25123.45",
"protocols": [...]
},
"arbitrum": {
"value": "20108.44",
"protocols": [...]
}
}
}
Query Transaction History
Retrieve transaction history with pagination and filtering.
curl -X GET "https://api.octav.fi/v1/transactions?addresses=0x6426af179aabebe47666f345d69fd9079673f6cd&limit=10&offset=0&sort=DESC" \
-H "Authorization: Bearer YOUR_API_KEY"
Key Parameters
Comma-separated list of wallet addresses
Number of transactions per page (1-250)
Sort order: DESC (newest first) or ASC (oldest first)
Common Patterns
Environment Variables
Store your API key securely in environment variables:
OCTAV_API_KEY=your_api_key_here
Error Handling
Always handle errors gracefully:
async function fetchPortfolio(address) {
try {
const response = await fetch(
`https://api.octav.fi/v1/portfolio?addresses=${address}`,
{
headers: {
'Authorization': `Bearer ${apiKey}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(`API Error: ${error.message}`);
}
return await response.json();
} catch (error) {
console.error('Failed to fetch portfolio:', error);
throw error;
}
}
Rate Limit Handling
Respect rate limits with retry logic:
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || 60;
console.log(`Rate limited. Retrying after ${retryAfter}s...`);
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
continue;
}
return response;
}
throw new Error('Max retries exceeded');
}
Next Steps
Need Help?