> ## Documentation Index
> Fetch the complete documentation index at: https://docs.octav.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Chains

> Get all supported blockchain networks

Retrieve a list of all blockchain networks supported by Octav, including chain metadata, icons, and explorer URLs. Results are sorted alphabetically by name.

<Info>
  **Cost:** Free (0 credits)
</Info>

<Note>
  **Interactive Playground:** Test this endpoint in the [API Playground](/api-reference/chains). Get your API key at [data.octav.fi](https://data.octav.fi/)
</Note>

<Note>
  **Tip:** Use this endpoint to discover valid `chainKey` values for other endpoints like [Protocols](/api/endpoints/protocols). The chain list is cached for 24 hours — newly added chains may take up to 24h to appear.
</Note>

***

## Endpoint

```bash theme={null}
GET https://api.octav.fi/v1/chains
```

No parameters required.

***

## Response

Returns an array of supported chain objects.

### Chain Fields

<ResponseField name="chainId" type="string">
  Blockchain network ID (e.g. `"1"` for Ethereum mainnet)
</ResponseField>

<ResponseField name="key" type="string">
  Short identifier used in API requests (e.g. `"ethereum"`, `"solana"`, `"arbitrum"`)
</ResponseField>

<ResponseField name="name" type="string">
  Human-readable chain name (e.g. `"Ethereum"`, `"Solana"`)
</ResponseField>

<ResponseField name="symbol" type="string">
  Native token symbol (e.g. `"ETH"`, `"SOL"`)
</ResponseField>

<ResponseField name="color" type="string">
  Hex color code for UI display (e.g. `"#627EEA"`)
</ResponseField>

<ResponseField name="imgSmall" type="string">
  URL to small chain icon
</ResponseField>

<ResponseField name="imgLarge" type="string">
  URL to large chain icon
</ResponseField>

<ResponseField name="explorerTokenUrl" type="string">
  Block explorer URL template for tokens
</ResponseField>

<ResponseField name="explorerTransactionUrl" type="string">
  Block explorer URL template for transactions
</ResponseField>

<ResponseField name="explorerAddressUrl" type="string">
  Block explorer URL template for addresses
</ResponseField>

<ResponseField name="blockscoutExplorerAddressUrl" type="string | null">
  Blockscout explorer URL for addresses (null if unavailable)
</ResponseField>

<ResponseField name="blockscoutExplorerTokenUrl" type="string | null">
  Blockscout explorer URL for tokens (null if unavailable)
</ResponseField>

<ResponseField name="blockscoutExplorerTransactionUrl" type="string | null">
  Blockscout explorer URL for transactions (null if unavailable)
</ResponseField>

<ResponseField name="isPortfolioSupported" type="boolean">
  Whether portfolio tracking is supported on this chain
</ResponseField>

<ResponseField name="isTransactionsSupported" type="boolean">
  Whether transaction history is supported on this chain
</ResponseField>

***

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.octav.fi/v1/chains" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.octav.fi/v1/chains', {
    headers: {
      'Authorization': `Bearer ${apiKey}`
    }
  });

  const chains = await response.json();
  console.log(`Supported chains: ${chains.length}`);
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.octav.fi/v1/chains',
      headers={'Authorization': f'Bearer {api_key}'}
  )

  chains = response.json()
  print(f'Supported chains: {len(chains)}')
  ```

  ```typescript TypeScript theme={null}
  interface Chain {
    chainId: string;
    key: string;
    name: string;
    symbol: string;
    color: string;
    imgSmall: string;
    imgLarge: string;
    explorerTokenUrl: string;
    explorerTransactionUrl: string;
    explorerAddressUrl: string;
    blockscoutExplorerAddressUrl: string | null;
    blockscoutExplorerTokenUrl: string | null;
    blockscoutExplorerTransactionUrl: string | null;
    isPortfolioSupported: boolean;
    isTransactionsSupported: boolean;
  }

  const response = await fetch('https://api.octav.fi/v1/chains', {
    headers: {
      'Authorization': `Bearer ${apiKey}`
    }
  });

  const chains: Chain[] = await response.json();
  console.log(`Supported chains: ${chains.length}`);
  ```
</CodeGroup>

***

## Example Response

<Accordion title="View Full Response" icon="code">
  ```json theme={null}
  [
    {
      "chainId": "1",
      "key": "ethereum",
      "name": "Ethereum",
      "symbol": "ETH",
      "color": "#627EEA",
      "imgSmall": "https://images.octav.fi/chains/ethereum_icon.svg",
      "imgLarge": "https://images.octav.fi/chains/ethereum_icon.svg",
      "explorerTokenUrl": "https://etherscan.io/token/",
      "explorerTransactionUrl": "https://etherscan.io/tx/",
      "explorerAddressUrl": "https://etherscan.io/address/",
      "blockscoutExplorerAddressUrl": null,
      "blockscoutExplorerTokenUrl": null,
      "blockscoutExplorerTransactionUrl": null,
      "isPortfolioSupported": true,
      "isTransactionsSupported": true
    },
    {
      "chainId": "42161",
      "key": "arbitrum",
      "name": "Arbitrum",
      "symbol": "ETH",
      "color": "#28A0F0",
      "imgSmall": "https://images.octav.fi/chains/arbitrum_icon.svg",
      "imgLarge": "https://images.octav.fi/chains/arbitrum_icon.svg",
      "explorerTokenUrl": "https://arbiscan.io/token/",
      "explorerTransactionUrl": "https://arbiscan.io/tx/",
      "explorerAddressUrl": "https://arbiscan.io/address/",
      "blockscoutExplorerAddressUrl": null,
      "blockscoutExplorerTokenUrl": null,
      "blockscoutExplorerTransactionUrl": null,
      "isPortfolioSupported": true,
      "isTransactionsSupported": true
    }
  ]
  ```
</Accordion>

***

## Use Cases

<Tabs>
  <Tab title="Build Chain Selector" icon="list">
    Populate a chain dropdown in your UI:

    ```javascript theme={null}
    const response = await fetch('https://api.octav.fi/v1/chains', {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    });

    const chains = await response.json();

    // Filter to chains with portfolio support
    const portfolioChains = chains.filter(c => c.isPortfolioSupported);

    // Build selector options
    const options = portfolioChains.map(chain => ({
      value: chain.key,
      label: chain.name,
      icon: chain.imgSmall,
      color: chain.color
    }));
    ```
  </Tab>

  <Tab title="Discover Chain Keys" icon="key">
    Look up valid chain keys for use with other endpoints:

    ```javascript theme={null}
    const response = await fetch('https://api.octav.fi/v1/chains', {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    });

    const chains = await response.json();

    // Get all valid chain keys
    const chainKeys = chains.map(c => c.key);
    console.log('Valid chain keys:', chainKeys.join(', '));

    // Check if a chain key is valid before querying protocols
    function isValidChain(key) {
      return chainKeys.includes(key);
    }
    ```
  </Tab>

  <Tab title="Explorer Links" icon="link">
    Generate block explorer links for addresses and transactions:

    ```javascript theme={null}
    const response = await fetch('https://api.octav.fi/v1/chains', {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    });

    const chains = await response.json();
    const chainMap = Object.fromEntries(chains.map(c => [c.key, c]));

    function getExplorerUrl(chainKey, type, hash) {
      const chain = chainMap[chainKey];
      if (!chain) return null;

      switch (type) {
        case 'address': return chain.explorerAddressUrl + hash;
        case 'tx': return chain.explorerTransactionUrl + hash;
        case 'token': return chain.explorerTokenUrl + hash;
      }
    }

    // Example
    const url = getExplorerUrl('ethereum', 'address', '0x6426af...');
    // => "https://etherscan.io/address/0x6426af..."
    ```
  </Tab>
</Tabs>

***

## Error Responses

<AccordionGroup>
  <Accordion title="401 Unauthorized" icon="lock">
    Authentication failed.

    ```json theme={null}
    {
      "error": "Unauthorized",
      "message": "Invalid API key"
    }
    ```

    **Solution:** Check your API key in the Authorization header
  </Accordion>

  <Accordion title="429 Too Many Requests" icon="gauge-high">
    Rate limit exceeded.

    ```json theme={null}
    {
      "error": "Rate limit exceeded",
      "message": "You have exceeded your rate limit",
      "retry_after": 60
    }
    ```

    **Solution:** Wait for the specified time or implement retry logic
  </Accordion>
</AccordionGroup>

***

## Related Endpoints

<CardGroup cols={2}>
  <Card title="Protocols" icon="cubes" href="/api/endpoints/protocols">
    List DeFi protocols available on a chain
  </Card>

  <Card title="Portfolio" icon="wallet" href="/api/endpoints/portfolio">
    Get portfolio holdings across chains
  </Card>

  <Card title="Supported Chains Reference" icon="globe" href="/api/reference/supported-chains">
    Full chain support matrix
  </Card>

  <Card title="Transactions" icon="receipt" href="/api/endpoints/transactions">
    Query transaction history by chain
  </Card>
</CardGroup>
