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

# Authentication

> Keyed Sentiment Data endpoints read the API key from the X-API-Key header or the api_key query parameter.

Keyed endpoints read the API key from one of these two places:

> [tab] Header (Recommended)
>
> ```http theme={null}
> GET /api/v1/consensus?asset=BTC&days=365 HTTP/1.1
> Host: consensus.cryptoquant.com
> X-API-Key: <YOUR_API_KEY>
> ```

> [tab] Query parameter
>
> ```text theme={null}
> https://consensus.cryptoquant.com/api/v1/consensus?asset=BTC&days=365&api_key=<YOUR_API_KEY>
> ```
>
> Avoid this form in logged URLs.

> [!WARNING]
>
> `Authorization: Bearer` is **not** read by this API. The CryptoQuant [Data API](https://docs.cryptoquant.com/guides/authentication.md)
> and the [Alpha Indicator API](https://docs.cryptoquant.com/indicator-api/authentication.md) use a Bearer token; the Analyst
> Consensus API uses the two forms above. Keys start with `unbias_live_`.

## Which endpoints need a key

The public endpoints need no key at all:

* [`/assets`](https://docs.cryptoquant.com/sentiment/assets)
* [`/consensus`](https://docs.cryptoquant.com/sentiment/consensus-index) without `days` (the latest point)
* [`/analyst-views`](https://docs.cryptoquant.com/sentiment/analyst-views) and [`/calls`](https://docs.cryptoquant.com/sentiment/calls)
* [`/analysts/top`](https://docs.cryptoquant.com/sentiment/top-analysts) and [`/analysts/{handle}`](https://docs.cryptoquant.com/sentiment/analyst-track-record)

A key unlocks the index history (`/consensus` with `days`), the per-asset breakdown
(`/consensus/breakdown`) and — on the Premium and Enterprise plans — the per-analyst stance
series (`/sentiment`). What each plan can read is on [Plans & Access](https://docs.cryptoquant.com/sentiment/plans-and-access.md).

## Getting a key

Keys are provisioned with the CryptoQuant **Premium** plan or an **Enterprise** agreement; there is
no self-serve key endpoint on this host.

* **Premium** — subscribe on the [CryptoQuant pricing page](https://cryptoquant.com/pricing) and
  use the API as part of your subscription.
* **Enterprise** — [contact us](https://cryptoquant.com/contact-us) to discuss your use case.

> [!NOTE]
>
> **Relationship to your CryptoQuant API key.** The Analyst Consensus API key is a separate
> credential from the key you use on `api.cryptoquant.com` — it carries its own plan (separate from
> your site login) and is sent as `X-API-Key`. The CryptoQuant API key is **not** accepted on
> `consensus.cryptoquant.com` today. If you only need the daily Analyst Consensus Index for BTC, ETH
> or SOL, your CryptoQuant Premium key can read it from the
> [Indicator API](https://docs.cryptoquant.com/indicator-api/consensus.md) with Bearer authentication.

## cURL

```bash theme={null}
curl -X GET "https://consensus.cryptoquant.com/api/v1/consensus?asset=BTC&days=365" \
-H "X-API-Key: <YOUR_API_KEY>"
```

## JavaScript

```javascript theme={null}
const response = await fetch(
  "https://consensus.cryptoquant.com/api/v1/consensus?asset=BTC&days=365",
  { headers: { "X-API-Key": "<YOUR_API_KEY>" } }
);
const json = await response.json();
```

## Python

```python theme={null}
import requests

headers = {"X-API-Key": "<YOUR_API_KEY>"}
url = "https://consensus.cryptoquant.com/api/v1/consensus?asset=BTC&days=365"
print(requests.get(url, headers=headers).json())
```

A request without a key on a keyed endpoint answers `401 API_KEY_REQUIRED`; an unknown or inactive
key answers `401 INVALID_API_KEY` — see [Errors](https://docs.cryptoquant.com/sentiment/errors.md).


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