> For the complete documentation index, see [llms.txt](https://docs.glassnode.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glassnode.com/integrations-and-tools/glassnode-cli.md).

# Glassnode CLI

The [Glassnode CLI](https://github.com/glassnode/glassnode-cli) (`gn`) is a command-line interface for the Glassnode API. Use it to list assets and metrics, fetch data, and integrate with scripts or AI assistants via the optional skill. To see a practical demonstration of how the CLI can be utilized in agentic workflows, check out the article on [Using Glassnode Data with Agents](https://insights.glassnode.com/ai-for-crypto-research/).

## Installation

### Install script (recommended)

**Linux / macOS**

```bash
curl -sSL https://raw.githubusercontent.com/glassnode/glassnode-cli/main/install.sh | bash
```

This installs the latest release to `/usr/local/bin` (uses `sudo` if needed). To install to a custom directory:

```bash
INSTALL_DIR=~/bin curl -sSL https://raw.githubusercontent.com/glassnode/glassnode-cli/main/install.sh | bash
```

**Windows (PowerShell)**

```powershell
irm https://raw.githubusercontent.com/glassnode/glassnode-cli/main/install.ps1 | iex
```

This installs to `%LOCALAPPDATA%\glassnode\bin` and adds it to your user `PATH` if needed.

### Manual download

Download the archive for your OS and architecture from [Releases](https://github.com/glassnode/glassnode-cli/releases), extract it, then move the binary into your `PATH` and make it executable (`chmod +x gn` on Unix).

### From source

```bash
go install github.com/glassnode/glassnode-cli@latest
```

The binary from `go install` is named `glassnode-cli`. To get the `gn` command, build with:

```bash
go build -o gn .
```

and put `gn` in your `PATH`.

## Authentication

Set your API key so the CLI can access the Glassnode API. The CLI resolves the key in this order:

1. `--api-key` flag (highest priority)
2. `GLASSNODE_API_KEY` environment variable
3. `~/.gn/config.yaml` configuration file

To persist the key in the config file:

```bash
gn config set api-key=your-key
```

See [API Key](broken://pages/-LiHusL80xkcU11V7R0I) for how to get your API key. API access is available on the **Professional** plan (full API) and the **Advanced** plan ([Light API](https://docs.glassnode.com/basic-api/api#light-api)). API usage consumes [API credits](/basic-api/api-credits.md) as with direct API calls.

## Quick start

```bash
# List available assets
gn asset list

# Fetch Bitcoin's closing price for the last 30 days
gn metric get market/price_usd_close --asset BTC --since 30d
```

## Add the CLI skill (AI assistants)

To let AI coding assistants (e.g. Cursor, Codex) use the Glassnode CLI and API knowledge, add the official skill:

```bash
npx skills add glassnode/glassnode-cli
```

After adding the skill, the assistant can run `gn` commands, discover metrics and assets, and follow CLI best practices when helping you work with Glassnode data.

For full usage, examples, and bulk metrics, see the [Glassnode CLI repository](https://github.com/glassnode/glassnode-cli).
