# Tokens by Chain

Retrieve all tokens available on a specific blockchain — ideal for populating swap and send forms after a chain is selected.

## Overview

When a user selects a source chain in a send or swap interface, call this endpoint to populate the token dropdown with only the assets available on that chain. This is more efficient than fetching all tokens and filtering client-side.

### `GET /v1/tokens/chain/{chain}`

Authentication: bearer token required.

Returns all tokens registered for a specific chain.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `chain` | string | yes | Chain identifier (e.g. ethereum, polygon, solana) |

**Responses**

`200` OK

```json
{
  "chain": "ethereum",
  "items": [
    {
      "symbol": "USDC",
      "name": "USD Coin",
      "contract_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
      "decimals": 6,
      "logoUri": "https://..."
    },
    {
      "symbol": "USDT",
      "name": "Tether USD",
      "contract_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
      "decimals": 6
    }
  ]
}
```

`404` Not Found

```json
{ "detail": "Chain not supported" }
```

## Implementation

```javascript
// When user selects a chain, load its available tokens
async function getTokensForChain(token, chain) {
  const res = await fetch(
    `https://api.aureahub.com/v1/tokens/chain/${chain}`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  if (res.status === 404) throw new Error(`Chain '${chain}' is not supported`);
  const { items } = await res.json();
  return items;
}

// Populate a token <select> dropdown
async function populateTokenSelect(token, chain, selectEl) {
  const tokens = await getTokensForChain(token, chain);
  selectEl.innerHTML = tokens
    .map(t => `<option value="${t.contract_address}">${t.symbol} — ${t.name}</option>`)
    .join('');
}
```

---

Web version: https://docs.aureahub.com/#tokens-by-chain
