# Octav API > Octav is a cryptocurrency portfolio tracking and analytics REST API that provides real-time multi-chain portfolio data, transaction history, DeFi protocol positions, and historical snapshots across 65+ blockchain networks. It enables developers and AI agents to build crypto portfolio dashboards, tax tools, alert systems, and analytics applications. Octav API returns JSON and supports EVM (0x...) and Solana (base58) wallet addresses. Data endpoints are read-only; the only write surface is the address book and bundle management endpoints (`/v1/addressbook`, `/v1/bundles`), which manage your own saved addresses rather than chain data. The main surface — all 36 endpoints under `/v1/*` — is credit-based: every request requires a Bearer token and consumes credits (most endpoints cost 1 credit per call). A separate five-endpoint subset under `/v1/agent/*` is paid per call via x402 and takes no API key; see **Access methods** below. **Authentication** (REST API, `/v1/*`): Bearer token in the `Authorization` header. Get your API key at https://data.octav.fi — keys must be kept secret and never committed to version control. The `/v1/agent/*` x402 endpoints do not use this header. **Base URL**: `https://api.octav.fi` **Access methods**: There are two ways to call Octav, and they are not equivalent. 1. **REST API with an API key — this is the default. Use it unless told otherwise.** All **36 endpoints**, including transaction history, historical snapshots, token approvals, token overview, and address book and bundle management. Base path `/v1/*`. Requires an API key from https://data.octav.fi. 2. **x402 pay-per-call** — only **5 endpoints** (`/v1/agent/portfolio`, `/v1/agent/wallet`, `/v1/agent/nav`, `/v1/agent/status`, `/v1/agent/chains`), paid in USDC on Base at 0.025 USDC per call, no API key. **Which one to use.** Build on the REST API with an API key unless one of these is true: - the user explicitly asked for x402 or pay-per-call access, or - the agent holds its own funded wallet and has no API key available. In every other case use `/v1/*` with a Bearer token, and mention that x402 is also available if the user's situation fits one of the two cases above. Do not start from x402 by default. If you are building anything that reads **transaction history**, you must use the API-key REST API — `/v1/transactions` has no x402 equivalent. If you discovered Octav through the x402 Bazaar, the five `/v1/agent/*` endpoints are a small subset of the API; see the full endpoint list below. **Rate Limit**: 360 requests per minute per API key. Rate limit headers (`X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`) are returned on every response. **Pricing**: Credit-based ($0.020–$0.025 per credit depending on package). Credits never expire. Most endpoints cost 1 credit. Free endpoints: `/v1/credits` and `/v1/status`. Purchase credits at https://data.octav.fi **Prerequisites** (REST API, `/v1/*`): An Octav account, an API key, and purchased credits. Sign up at https://data.octav.fi. The `/v1/agent/*` x402 endpoints require none of these — only a wallet funded with USDC on Base. **Address Format**: Comma-separate multiple addresses in a single request to save credits (e.g. `?addresses=0x123,0x456`). **Caching**: Portfolio data is cached for 1 minute. Transaction data is cached for 10 minutes. ### Quick Code Example ```bash # Check your credits (free) curl https://api.octav.fi/v1/credits \ -H "Authorization: Bearer YOUR_API_KEY" # Get portfolio holdings (1 credit) curl "https://api.octav.fi/v1/portfolio?addresses=0xYOUR_ADDRESS" \ -H "Authorization: Bearer YOUR_API_KEY" # Get transaction history (1 credit) curl "https://api.octav.fi/v1/transactions?addresses=0xYOUR_ADDRESS&limit=50&offset=0&sort=DESC" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ```javascript // JavaScript example const API_KEY = process.env.OCTAV_API_KEY; const headers = { 'Authorization': `Bearer ${API_KEY}` }; // Get portfolio const portfolio = await fetch( 'https://api.octav.fi/v1/portfolio?addresses=0xYOUR_ADDRESS', { headers } ).then(r => r.json()); console.log('Net Worth:', portfolio[0].networth); console.log('Chains:', Object.keys(portfolio[0].chains)); console.log('Protocols:', Object.keys(portfolio[0].assetByProtocols)); ``` ```python # Python example import requests headers = {'Authorization': 'Bearer YOUR_API_KEY'} portfolio = requests.get( 'https://api.octav.fi/v1/portfolio', params={'addresses': '0xYOUR_ADDRESS'}, headers=headers ).json() print(f"Net Worth: {portfolio[0]['networth']}") ``` ### Error Handling Common HTTP error codes returned by the API: - **401 Unauthorized**: Invalid or missing API key. Verify your `Authorization: Bearer ` header. - **402 Payment Required**: Insufficient credits. Purchase more at https://data.octav.fi - **403 Forbidden**: Endpoint requires an Octav PRO subscription (e.g. Token Overview). - **429 Too Many Requests**: Rate limit exceeded. Read the `Retry-After` header and wait before retrying. Implement exponential backoff. - **404 Not Found**: Address not indexed. Addresses with >100k transactions are not auto-indexed — contact support. The address book and bundle endpoints (`/v1/addressbook`, `/v1/bundles`) answer domain failures with a typed envelope instead — `{"error": {"code", "message", ...extra}}`. Branch on `error.code`: - **400 `VALIDATION_ERROR`**: malformed/unsupported address, or the same address repeated in one request. (Request-schema failures keep the API-wide `{"error": "Validation Failed", "details": [...]}` shape.) - **404**: `ADDRESSBOOK_ENTRY_NOT_FOUND`, `BUNDLE_NOT_FOUND`, `DELEGATE_NOT_FOUND` - **409**: `ADDRESSBOOK_ENTRY_NOT_DELETABLE`, `BUNDLE_NAME_TAKEN` (+`name`), `BUNDLE_MEMBERS_ALREADY_BUNDLED` (+`bundleId`) - **422**: `ADDRESSBOOK_QUOTA_REACHED` (+`quota`, `current`), `BUNDLE_QUOTA_REACHED` (+`quota`), `BUNDLE_SIZE_LIMIT_EXCEEDED` (+`limit`), `BUNDLE_EMPTY`, `BUNDLE_ADDRESS_NOT_IN_ADDRESS_BOOK` (+`addresses`) - **500 `INTERNAL_ERROR`** Per-account limits behind those 422s: 50 address book entries without an active paid plan, 5 bundles, 10 addresses per bundle (defaults; configurable per account). Bundle membership is drawn only from the address book, a bundle can never be empty, bundle names are unique per account (case-sensitive), and no two bundles may hold exactly the same members. Implement retry logic for rate limits: ```javascript 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; await new Promise(r => setTimeout(r, retryAfter * 1000)); continue; } if (!response.ok) { const error = await response.json(); throw new Error(`API Error ${response.status}: ${error.message}`); } return response; } throw new Error('Max retries exceeded'); } ``` ## Getting Started - [Introduction](https://docs.octav.fi/api/introduction): API overview, base URL, core capabilities, and endpoint summary - [Authentication](https://docs.octav.fi/api/authentication): API key creation, Bearer token usage, security best practices, and error responses - [Quickstart](https://docs.octav.fi/api/quickstart): First API calls with examples in cURL, JavaScript, Python, and TypeScript - [Pricing](https://docs.octav.fi/api/pricing): Credit packages ($100–$20,000), per-endpoint costs, and cost optimization tips ## API Reference - [Portfolio](https://docs.octav.fi/api/endpoints/portfolio): GET /v1/portfolio — Multi-chain holdings across wallets and DeFi protocols (1 credit) - [Portfolio At Block](https://docs.octav.fi/api/endpoints/portfolio-at-block): GET /v1/portfolio/at-block — Single-address portfolio valued at a specific historical block on ethereum, linea or monad, requires the Portfolio at Block add-on enabled per API key (set monthly fee + 1 credit per call, 100 req/min dedicated rate limit) - [Virtual Users](https://docs.octav.fi/api/endpoints/virtual-users): GET /v1/virtual-users — List virtual users belonging to your account, requires Pro (1 credit) - [Virtual Users Portfolio](https://docs.octav.fi/api/endpoints/virtual-users): GET /v1/virtual-users/portfolio — Portfolio holdings for virtual users, same schema as /portfolio, requires Pro (1 credit per address) - [Address Book](https://docs.octav.fi/api/endpoints/addressbook): GET /v1/addressbook — List saved addresses; entries are keyed by address and carry `{address, label, plan, expiresAt, isPaid}` (1 credit) - [Address Book — Add](https://docs.octav.fi/api/endpoints/addressbook): POST /v1/addressbook — Add up to 100 `{address, label?}` entries; an address already in the book keeps its existing label; returns the whole book (1 credit) - [Address Book — Rename](https://docs.octav.fi/api/endpoints/addressbook): PATCH /v1/addressbook/{address} — Set an entry's `label`; 404 if the address is not saved (1 credit) - [Address Book — Remove](https://docs.octav.fi/api/endpoints/addressbook): DELETE /v1/addressbook/{address} — 204; entries on a paid plan or authorized by the wallet owner return 409 (1 credit) - [Bundles](https://docs.octav.fi/api/endpoints/bundles): GET /v1/bundles — List bundles, each `{id, name, addresses[]}` (1 credit) - [Bundles — Create](https://docs.octav.fi/api/endpoints/bundles): POST /v1/bundles — Create from `{name, addresses[]}`, min 1 max 100 addresses, returns 201; addresses must already be in the address book, names unique per account (1 credit) - [Bundles — Get](https://docs.octav.fi/api/endpoints/bundles): GET /v1/bundles/{bundleId} — Fetch one bundle (1 credit) - [Bundles — Rename](https://docs.octav.fi/api/endpoints/bundles): PATCH /v1/bundles/{bundleId} — Set `name`; 409 on a name collision (1 credit) - [Bundles — Delete](https://docs.octav.fi/api/endpoints/bundles): DELETE /v1/bundles/{bundleId} — 204; addresses stay in the address book (1 credit) - [Bundles — Add Address](https://docs.octav.fi/api/endpoints/bundles): POST /v1/bundles/{bundleId}/addresses — Add `{address}`, returns the updated bundle; 422 if the address is not in the address book (1 credit) - [Bundles — Remove Address](https://docs.octav.fi/api/endpoints/bundles): DELETE /v1/bundles/{bundleId}/addresses/{address} — Returns the updated bundle with **200, not 204**; removing the last member is rejected with 422 BUNDLE_EMPTY (1 credit) - [Nav](https://docs.octav.fi/api/endpoints/nav): GET /v1/nav — Net Asset Value, returns `{nav, currency, conversionPrice}` (1 credit) - [Wallet](https://docs.octav.fi/api/endpoints/wallet): GET /v1/wallet — Wallet token balances and values (1 credit) - [Transactions](https://docs.octav.fi/api/endpoints/transactions): GET /v1/transactions — Transaction history with filtering by chain, type, protocol, date range (1 credit) - [Token Approvals](https://docs.octav.fi/api/endpoints/approvals): GET /v1/approvals/{chain} — Token approval records for a specific chain (1 credit) - [Token Overview](https://docs.octav.fi/api/endpoints/token-overview): GET /v1/token-overview — Token breakdown by protocol, requires PRO (1 credit) - [Airdrop](https://docs.octav.fi/api/endpoints/airdrop): GET /v1/airdrop — Airdrop eligibility check for Solana addresses only (1 credit) - [Subscribe Snapshot](https://docs.octav.fi/api/endpoints/subscribe-snapshot): POST — Subscribe addresses to automatic daily portfolio snapshots (1200 credits) - [Historical Portfolio](https://docs.octav.fi/api/endpoints/historical-portfolio): GET /v1/historical — Portfolio snapshot for a specific past date (1 credit) - [Sync Transactions](https://docs.octav.fi/api/endpoints/sync): POST /v1/sync-transactions — Trigger transaction indexing, 1 credit + 1 per 250 txns on first sync - [Beacon Validators](https://docs.octav.fi/api/endpoints/beacon-validators): GET /v1/beacon/validators/* — Ethereum validator details, rewards, withdrawals, and deposits by index or BLS pubkey (add-on, set monthly fee, no per-call credit) - [Chains](https://docs.octav.fi/api/endpoints/chains): GET /v1/chains — List all supported blockchain networks (free) - [Protocols](https://docs.octav.fi/api/endpoints/protocols): GET /v1/chains/{chainKey}/protocols — List protocols on a specific chain (free) - [Contract Protocol](https://docs.octav.fi/api/endpoints/contract-protocol): GET /v1/contract-protocol — Resolve a contract address to its DeFi protocol; pass chain for a single match or omit it to search all chains (5 credits, refunded on 404) - [Status](https://docs.octav.fi/api/endpoints/status): GET /v1/status — Check address sync status and data freshness (free) - [Credits](https://docs.octav.fi/api/endpoints/credits): GET /v1/credits — Check remaining credit balance (free) ## Agent Endpoints (x402, no API key) Five endpoints accept x402 pay-per-call in place of an API key, at 0.025 USDC per call settled on Base (`eip155:8453`). An unpaid request returns HTTP 402 with a base64 `payment-required` header containing the payment challenge. These are a subset of the REST API above — there is **no** x402 endpoint for transactions, historical portfolio, token overview, or approvals. **Do not default to these endpoints.** Use them only when the user explicitly asked for x402, or when the agent has a funded wallet and no API key. For everything else use the API-key REST endpoints listed above. - [Agent Endpoints (x402)](https://docs.octav.fi/api/endpoints/agent-x402): Full reference for the x402 surface, the payment handshake, and when to use x402 versus an API key - GET /v1/agent/portfolio — Wallet and protocol holdings (0.025 USDC) - GET /v1/agent/wallet — Wallet holdings only, no DeFi positions (0.025 USDC) - GET /v1/agent/nav — Net Asset Value, returns `{nav, currency, conversionPrice}` (0.025 USDC) - GET /v1/agent/status — Address sync status and data freshness (0.025 USDC) - GET /v1/agent/chains — Supported blockchain networks (0.025 USDC) ## MCP Server - [MCP Server Overview](https://docs.octav.fi/mcp/overview): Install and configure the Octav MCP server for Claude Desktop, Cursor, and VS Code; full tool reference - [MCP Server Examples](https://docs.octav.fi/mcp/examples): Example prompts and workflows using the Octav MCP tools ## CLI - [CLI Overview](https://docs.octav.fi/cli/overview): Install the `octav` CLI, authenticate, and run every command - [CLI Examples](https://docs.octav.fi/cli/examples): Common CLI invocations and JSON output patterns for shell and agent workflows - [CLI Automations](https://docs.octav.fi/cli/automations): Scheduled portfolio monitoring with cron and launchd ## Migration Guides - [Migrate to Octav (overview)](https://docs.octav.fi/api/migrate/overview): Move from any portfolio, wallet-data, or DeFi API to Octav with endpoint, auth, and field mappings - [Migrate from DeBank](https://docs.octav.fi/api/migrate/from-debank): Collapse all_token_list + all_complex_protocol_list + total_balance into one call, add Solana - [Migrate from Zerion](https://docs.octav.fi/api/migrate/from-zerion): Replace JSON:API positions with a flat, USD-priced portfolio; receipt tokens decoded once - [Migrate from Zapper](https://docs.octav.fi/api/migrate/from-zapper): Replace the portfolioV2 GraphQL query with a single REST call - [Migrate from Mobula](https://docs.octav.fi/api/migrate/from-mobula): Merge wallet/portfolio + wallet/defi-positions into one response - [Migrate from Nansen](https://docs.octav.fi/api/migrate/from-nansen): Replace two profiler/portfolio POST endpoints with one GET, no receipt-token double-count - [Migrate from Sim (Dune)](https://docs.octav.fi/api/migrate/from-sim): Keep token balances, add the decoded DeFi positions Sim sunset, plus Solana - [Migrate from GoldRush (Covalent)](https://docs.octav.fi/api/migrate/from-goldrush): Replace balances_v2 and add the DeFi decoding GoldRush deprecated - [Migrate from TopLedger](https://docs.octav.fi/api/migrate/from-topledger): Keep Solana DeFi decoding, add loose token holdings, EVM, and marked-to-market perps ## Guides - [AI Development Overview](https://docs.octav.fi/api/ai-development/overview): Build crypto portfolio apps and analytics tools with AI assistance - [Quick Start with AI](https://docs.octav.fi/api/ai-development/quick-start): Ready-to-use prompts for building portfolio trackers, DeFi dashboards, and tax tools - [AI Agents & LLMs Integration](https://docs.octav.fi/api/ai-development/llms-integration): Integrate Octav into ChatGPT, Claude, Cursor, and autonomous agents - [MCP Server](https://docs.octav.fi/api/ai-development/mcp-server): Connect Claude Desktop, Cursor, and VS Code to the Octav API via the Model Context Protocol - [CLI](https://docs.octav.fi/api/ai-development/cli): Query portfolio data from the terminal and integrate the `octav` CLI into agent shell workflows - [Building AI Agents](https://docs.octav.fi/api/ai-development/building-agents): Production-ready portfolio monitoring agents with Python and JavaScript examples - [Complete Developer Guide](https://docs.octav.fi/api/ai-development/complete-guide): End-to-end guide covering the REST API, MCP server, CLI, x402 payments, and llms.txt with full code examples ## Examples - [Quickstart Code Examples](https://docs.octav.fi/api/quickstart): Portfolio fetch, transaction query, error handling, and rate limit patterns in 4 languages - [Building AI Agents](https://docs.octav.fi/api/ai-development/building-agents): Complete portfolio monitor agent, transaction watcher, and notification integrations (Slack, Discord, Telegram) - [OpenAPI Specification](https://docs.octav.fi/openapi.json): Full OpenAPI 3.0 spec for code generation and API client scaffolding ## Reference - [Supported Chains](https://docs.octav.fi/api/reference/supported-chains): 65+ blockchain networks — full support (portfolio + transactions) for ethereum, arbitrum, base, polygon, optimism, avalanche, binance, solana, blast, linea, gnosis, sonic, starknet, fraxtal, unichain - [Protocol Types](https://docs.octav.fi/api/reference/protocol-types): 33 protocol position types including WALLET, LENDING, LIQUIDITYPOOL, STAKED, VAULT, FARMING, PERPETUALS, MARGIN, and more - [Transaction Types](https://docs.octav.fi/api/reference/transaction-types): 53 transaction types including SWAP, TRANSFERIN, TRANSFEROUT, DEPOSIT, WITHDRAW, STAKE, UNSTAKE, CLAIM, ADDLIQUIDITY, REMOVELIQUIDITY, BORROW, LEND, BRIDGEIN, BRIDGEOUT, MINT, APPROVAL ## Tutorials - [Platform Quickstart](https://docs.octav.fi/docs/quickstart): Getting started with the Octav Pro portfolio tracking platform - [Platform Authentication](https://docs.octav.fi/docs/authentication): Signing in to Octav Pro with wallet, email, and social login - [Platform Pricing](https://docs.octav.fi/docs/pricing): Octav Pro subscription tiers and included features - [Account](https://docs.octav.fi/docs/account): Account settings, subscription management, and API access - [Home Dashboard](https://docs.octav.fi/docs/home): The Octav Pro home dashboard and portfolio overview - [Address Book](https://docs.octav.fi/docs/address-book): Managing and organizing wallet addresses - [Widget Explorer](https://docs.octav.fi/docs/widget-explorer): Browsing and arranging dashboard widgets - [Alerts](https://docs.octav.fi/docs/alerts): Configuring portfolio and transaction alerts - [Transactions Guide](https://docs.octav.fi/docs/transactions): Viewing, filtering, and analyzing transaction history - [Reports](https://docs.octav.fi/docs/reports): Generating portfolio reports and data exports - [Supported Widgets](https://docs.octav.fi/docs/supported-widgets): Available dashboard widgets for portfolio visualization - [Build Custom Widgets](https://docs.octav.fi/docs/build-custom-widgets): Creating custom dashboard widgets ## Optional - [Changelog](https://docs.octav.fi/docs/changelog): Latest platform updates, new chain support, and bug fixes - [Supported Blockchains (Platform)](https://docs.octav.fi/docs/supported-blockchains): Full list of 90+ blockchains supported in the Octav Pro platform - [Brand Guidelines](https://docs.octav.fi/docs/brand-guidelines): Octav brand colors, typography, and usage guidelines - [Logo Files](https://docs.octav.fi/docs/logo-files): Octav logo assets for light and dark themes - [Contact Us](https://docs.octav.fi/docs/contact-us): Support channels, Discord community, and enterprise inquiries - [Submit a Feature](https://docs.octav.fi/docs/submit-feature): Feature request submission via Canny - [Agent Skill](https://skills.sh/Octav-Labs/octav-api-skill): Install the Octav API skill for Claude Code, Codex, and ChatGPT agents