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

# Authentication

> One API key — used as an env var by your MCP client, or as an HTTP header for direct calls.

<Note icon="key">
  Generate keys in the [Dashboard → API Keys](https://llmquantdata.com/dashboard).
</Note>

<Warning>
  Treat your API key like a password. Never commit it to source control, never expose it in client-side code, never paste it into a chat session.
</Warning>

## Get your API key

<Steps>
  <Step title="Sign in" icon="user">
    Go to [llmquantdata.com](https://llmquantdata.com) and sign up (or log in).
  </Step>

  <Step title="Create an API key" icon="key">
    Open the [Dashboard](https://llmquantdata.com/dashboard) → **API Keys** → **Create API key**. Copy it once — it won't be shown again.
  </Step>

  <Step title="Store as env var" icon="terminal">
    ```bash theme={null}
    export LLMQUANT_API_KEY=your_api_key_here
    ```

    Add it to your shell profile (`~/.zshrc`, `~/.bashrc`) for persistence. Both MCP and HTTP usage below read from this single source.
  </Step>
</Steps>

## How to use it

<Tabs>
  <Tab title="MCP runtime (recommended)">
    Every supported MCP client (Claude Code, Cursor, Codex, Gemini CLI, Claude Desktop) reads the key from `LLMQUANT_API_KEY`. For JSON config files, paste the actual key value in the `env` block.

    See [MCP Server setup](/en/integration/mcp-server#quick-setup) for the per-client commands.

    ```json title="example: Cursor / Claude Desktop config snippet" theme={null}
    {
      "mcpServers": {
        "llmquant-data": {
          "command": "npx",
          "args": ["-y", "@llmquant/data-mcp"],
          "env": {
            "LLMQUANT_API_KEY": "your_api_key_here"
          }
        }
      }
    }
    ```
  </Tab>

  <Tab title="HTTP (direct)">
    Pass the key in the `Authorization` header on every request:

    <CodeGroup>
      ```bash cURL theme={null}
      curl "https://api.llmquantdata.com/api/equity/historical?ticker=AAPL&limit=5" \
        -H "Authorization: Bearer $LLMQUANT_API_KEY"
      ```

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

      response = requests.get(
          "https://api.llmquantdata.com/api/equity/historical",
          headers={"Authorization": f"Bearer {os.environ['LLMQUANT_API_KEY']}"},
          params={"ticker": "AAPL", "limit": 5},
      )
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Error codes

| Status                            | Meaning                                       |
| --------------------------------- | --------------------------------------------- |
| <Badge color="green">200</Badge>  | Success                                       |
| <Badge color="orange">400</Badge> | Bad request — invalid or missing parameters   |
| <Badge color="red">401</Badge>    | Unauthorized — invalid or missing API key     |
| <Badge color="red">402</Badge>    | Insufficient credits — top up your balance    |
| <Badge color="orange">404</Badge> | Not found — ticker or resource does not exist |
| <Badge color="orange">429</Badge> | Rate limit exceeded                           |

## Rate limits

Rate limits vary by plan. If you exceed your limit you will receive a `429` response. Contact us to discuss higher limits.

<Tip>
  An MCP runtime that retries silently on `429` can burn credits fast. Inspect the agent's tool-call log when debugging unexpected billing.
</Tip>

## Replace or revoke a key

To replace a key, create a new one in [Dashboard → API Keys](https://llmquantdata.com/dashboard), update your environments, then revoke the old key. Requests that use a revoked key return `401`.

<Warning>
  Before revoking the old key, update `LLMQUANT_API_KEY` in **every** environment that uses MCP — your shell profile, your CI secrets, your team's onboarding templates.
</Warning>
