# API Setup

Welcome to the Glassnode API, which powers all our tools, including Glassnode Studio, the CLI, the MCP Server and the Excel add-in. The Glassnode API is available exclusively to **Professional subscribers**. Please be aware that making API requests consumes [data credits](/basic-api/api-credits.md) associated with your subscription tier.

Before making your first request, it is highly recommended that you familiarize yourself with how our data is structured and processed. Understanding these core concepts is crucial for accurate analysis:

* [**Timestamps & Resolutions**](https://docs.glassnode.com/data/timestamps-and-resolutions)**:** Understand how we treat timestamps across different timeframes and metric resolutions.
* [**Data Availability**](https://docs.glassnode.com/data/data-availability)**:** Learn exactly when new data points arrive and are ready to be fetched.
* [**Data Finalization**](https://docs.glassnode.com/data/data-finalization)**:** Read about how we handle data mutations, reprocessing, and finalization over time.
* [**Metadata**](/basic-api/metadata.md)**:** Retrieve metadata for metrics (parameters, time ranges, descriptions, …) and assets (smart contract addresses, external vendor identifiers, …).
* [**Bulk Endpoints**](https://docs.glassnode.com/basic-api/bulk-metrics)**:** Batch multiple queries into a single request.

***

## Make Your First API Request

### Generate your API key

You can generate an API key by clicking on the user icon in the top right corner of [Glassnode Studio](https://studio.glassnode.com/). In the dropdown, you'll find the [API option](https://studio.glassnode.com/settings/api). Scroll to the bottom to find the *Generate API Key* section.

Follow the instructions on the [API Key](broken://pages/-LiHusL80xkcU11V7R0I) page to generate your credentials and make your first request.

### Usage

Specify the `api_key` query parameter or `X-Api-Key` header with your API key with all endpoints.

#### Example using `cURL`

```bash
export API_KEY=YOUR-KEY

# using query parameter
curl "https://api.glassnode.com/v1/metrics/indicators/sopr?a=btc&api_key=$API_KEY"

# using request header
curl -H "X-Api-Key:${API_KEY}" "https://api.glassnode.com/v1/metrics/indicators/sopr?a=btc"
```

#### Example using `Python`

```python
import json
import requests
import pandas as pd

# insert your API key here
API_KEY = ''

# make API request
res = requests.get('https://api.glassnode.com/v1/metrics/indicators/sopr',
    params={'a': 'BTC', 'api_key': API_KEY})

# convert to pandas dataframe
df = pd.read_json(res.text, convert_dates=['t'])
```

### Pro-Tip: The Glassnode CLI

While the API is perfect for programmatic integrations, for ad hoc research, we highly recommend using the [**Glassnode CLI**.](/integrations-and-tools/glassnode-cli.md) The CLI makes it incredibly easy to download metric files directly to your local disk. Because of its command-line nature, it also fits perfectly into **agentic workflows**, allowing AI agents and automated scripts to fetch exactly what they need with minimal overhead.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.glassnode.com/basic-api/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
