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

# Make your first API request

> Get an access token, then list supported exchanges with cURL, JavaScript or Python.

> [!TIP]
>
> **You may not need the API.** To use Itoflow from Claude, Codex or another assistant, [connect Itoflow MCP](https://docs.itoflow.ai/mcp/install.md) instead: no tokens, no code, and your assistant finds the right operation for you.

The API lives at `https://api.itoflow.ai`. You need an [Itoflow account](https://app.itoflow.ai) and cURL, Node.js 22 or later, or Python 3.

**1. Get an access token**

Run the sign-in script in [Authentication](https://docs.itoflow.ai/authentication.md#get-an-access-token). It prints a link; open it, approve the code, and the script stores the token for you:

```bash theme={null}
export ITOFLOW_ACCESS_TOKEN="$(python3 get_token.py)"
```

**2. List supported exchanges**

```bash cURL theme={null}
curl --fail-with-body --silent --show-error \
  'https://api.itoflow.ai/symbols/exchanges' \
  --header "Authorization: Bearer $ITOFLOW_ACCESS_TOKEN"
```

```javascript JavaScript theme={null}
const token = process.env.ITOFLOW_ACCESS_TOKEN;
if (!token) throw new Error('Set ITOFLOW_ACCESS_TOKEN first');
const response = await fetch('https://api.itoflow.ai/symbols/exchanges', {
  headers: { Authorization: `Bearer ${token}` },
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const { exchanges } = await response.json();
console.log(exchanges);
```

```python Python theme={null}
import json
import os
from urllib.request import Request, urlopen

request = Request(
    "https://api.itoflow.ai/symbols/exchanges",
    headers={
        "Authorization": f"Bearer {os.environ['ITOFLOW_ACCESS_TOKEN']}",
        # The API rejects Python's default User-Agent, so send a named one.
        "User-Agent": "itoflow-quickstart/1.0",
    },
)
with urlopen(request, timeout=30) as response:
    exchanges = json.load(response)["exchanges"]
print(exchanges)
```

A `200` response contains an `exchanges` array. Each entry has a `code`, a `name` and the instrument `types` it lists. Shortened:

```json theme={null}
{
  "exchanges": [
    { "code": "US", "name": "United States", "types": ["stock", "etf"] },
    { "code": "CC", "name": "Cryptocurrency", "types": ["crypto"] }
  ]
}
```

Use these codes to build symbols such as `AAPL.US`. See [Find and resolve symbols](https://docs.itoflow.ai/guides/symbols.md).

**3. Check which account you're using**

```bash theme={null}
curl --fail-with-body --silent --show-error \
  'https://api.itoflow.ai/auth/user' \
  --header "Authorization: Bearer $ITOFLOW_ACCESS_TOKEN"
```

The response contains your account's personal details, so keep it out of shared logs.

## If it fails

* `401`: the token expired or is wrong. [Refresh it](https://docs.itoflow.ai/authentication.md#refresh-an-expired-token) or sign in again.
* `429`: you hit a rate limit. Wait for the time in `Retry-After`, then try again.

See [Troubleshooting](https://docs.itoflow.ai/troubleshooting.md) for other errors.

## Next steps

> [card] [API conventions](https://docs.itoflow.ai/guides/api-conventions.md)
>
> Retries, pagination, units and status codes.

> [card] [Portfolios](https://docs.itoflow.ai/features/portfolios.md)
>
> Read holdings, import a portfolio and approve trades.

> [card] [Monitors](https://docs.itoflow.ai/features/monitors.md)
>
> Watch holdings or a fund and get scheduled reports.

> [card] [Strategies](https://docs.itoflow.ai/features/strategies.md)
>
> Run a portfolio under a mandate you write.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.