# On-Chain Crypto Metrics API - Glassnode MVRV, SOPR, Flows (`nabeelbaghoor/onchain-crypto-metrics-api`) Actor

Pull Bitcoin and Ethereum on-chain metrics from the Glassnode API into a dataset: MVRV, SOPR, NUPL, exchange balances and flows, active addresses, supply, miner, futures, options and ETF data, bulk multi-asset snapshots, metric metadata and asset lists. Bring your own API key.

- **URL**: https://apify.com/nabeelbaghoor/onchain-crypto-metrics-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Business, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 metric data point returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## On-Chain Crypto Metrics API - Glassnode MVRV, SOPR, Flows

Export Bitcoin, Ethereum and altcoin on-chain metrics, exchange flows, valuation indicators, derivatives and ETF data from the Glassnode API into an Apify dataset with your own Glassnode API key.

This actor wraps the Glassnode REST API. It turns a list of metric paths and assets into clean, deduplicated, timestamped rows you can download as JSON, CSV or Excel, schedule daily or hourly, or feed into trading models, research notebooks, dashboards, spreadsheets and AI agents. Bring your own API key.

### What it does

- **On-chain metrics for any asset**: active addresses, address balance bands, supply held by long-term and short-term holders, transfer volume, transaction counts, fees, hash rate and miner revenue, read as a time series for BTC, ETH, SOL, stablecoins and the other assets Glassnode covers.
- **Valuation and cycle indicators**: MVRV, MVRV Z-Score, SOPR, NUPL, realized price and cap, Puell Multiple, Reserve Risk, coin days destroyed, cost basis distributions and hundreds more.
- **Exchange balances and flows**: coins held on exchanges, inflows, outflows and net flows, per exchange (Binance, Coinbase, Bybit, OKX and others) or aggregated, in native units or USD.
- **Derivatives and options**: futures open interest, funding rates, liquidations, volume, options open interest, implied volatility and skew.
- **ETF, treasury and macro data**: US spot ETF balances and flows, corporate and government treasuries, and macro series.
- **Bulk snapshots**: one metric for many assets, or every asset with `*`, in a single request.
- **Metric metadata and data lag**: supported assets, resolutions, exchanges, networks, available history, descriptions, bulk and point-in-time variants, and how late new values arrive.
- **Asset and reference lists**: Glassnode asset IDs with contract addresses, CoinGecko, CoinMarketCap and CCData IDs and semantic tags; supported exchanges, networks, miners and tags; and your monthly credit usage.
- **Pay only for results**: empty answers are recorded as a free row that says why, never charged.

### Input

| Field | Used by | What it does |
| --- | --- | --- |
| `mode` | all | `metricSeries`, `bulkMetric`, `metricMetadata`, `dataLag`, `metricCatalog`, `assets`, `referenceList` or `apiUsage` |
| `metrics` | series, bulk, metadata, data lag | Metric paths below `/v1/metrics`, such as `market/mvrv`, `indicators/sopr` or `distribution/balance_exchanges` |
| `assets` | series, bulk, metadata, data lag, catalogue | Glassnode asset IDs such as BTC, ETH or SOL; `*` for every asset in bulk mode |
| `since`, `until` | series, bulk | A date, a UTC date and time, or a unix time |
| `lookbackDays` | series, bulk | Days back from today when `since` is empty (default 30) |
| `resolution` | series, bulk, catalogue | `24h`, `1h`, `10m`, `1w` or `1month`, where the metric and your plan offer it |
| `currency` | series, bulk, catalogue | `native` or `usd`, for metrics that take a currency |
| `exchanges`, `networks` | series, bulk | Exchange or chain breakdowns, for metrics that take them |
| `extraParameters` | series, bulk, metadata | Documented drill-downs passed verbatim: `miner`, `maturity`, `period`, `quote_symbol`, `from_exchange`, `to_exchange` |
| `assetFilter` | assets, asset lists | A CEL filter such as `asset.semantic_tags.exists(t, t=='stablecoin')` |
| `listType` | reference list | Exchanges, networks, miners, metric tags, asset tags, categories or blockchains |
| `maxResults` | all | Row ceiling for the run; the newest points are kept |
| `apiKey` | all | Your Glassnode API key (secret). Or set the `DATA_API_KEY` environment secret |

Every metric's own parameter list is checked against a snapshot of the Glassnode documentation (916 metrics). A currency, exchange or network the metric does not take is left off and named in the log, so a setting meant for another metric never silently empties your results. Metrics added after the snapshot are still sent, with the general parameters.

### How to get an API key

API access comes with the Glassnode Professional plan (the full API) or the Advanced plan (the Light API: daily data, 14 days of history, 50 calls a day, no bulk endpoints). In Glassnode Studio, open the user menu, choose API, and generate a key at the bottom of the page. Paste it into the API key field.

### Example output

```json
{
    "mode": "metricSeries",
    "recordType": "datapoint",
    "identifier": "market/mvrv BTC",
    "found": true,
    "id": "market/mvrv|BTC|||1759968000",
    "metric": "market/mvrv",
    "metricName": "MVRV Ratio",
    "asset": "BTC",
    "date": "2025-10-09T00:00:00Z",
    "timestamp": 1759968000,
    "value": 2.31,
    "values": null,
    "resolution": "24h",
    "currency": null,
    "exchange": null,
    "network": null,
    "note": null
}
```

Metrics that return several values per timestamp (supply bands, cost basis distributions, exchange breakdowns) carry them in `values` as an object. Bulk rows also carry `category` and any other breakdown parameters.

### FAQ

#### What is the Glassnode API?

The Glassnode API is the data API behind Glassnode Studio, the on-chain and crypto market analytics platform from Glassnode. It serves more than 900 metrics computed from the Bitcoin, Ethereum and other blockchains and from spot, futures and options markets, under paths such as `/v1/metrics/market/mvrv`, `/v1/metrics/indicators/sopr` and `/v1/metrics/distribution/balance_exchanges`, plus metadata endpoints under `/v1/metadata`. This actor calls those GET endpoints and nothing else.

#### Do I need my own API key?

Yes. This actor is bring your own key: you need a Glassnode plan with API access. Your key is stored as an Apify secret, sent only in the `X-Api-Key` header, and kept out of every log line and URL. Without a key the run stops immediately with a clear message and no charge.

#### How do I download Bitcoin MVRV or SOPR history?

Choose Metric time series, put `market/mvrv` or `indicators/sopr` in Metrics and `BTC` in Assets, and set Since to `2010-01-01` for the full history (or leave it empty for the last 30 days). Raise Maximum results to cover the number of days you want; each daily value is one row.

#### How do I get exchange inflows, outflows and balances per exchange?

Use metrics such as `distribution/balance_exchanges`, `transactions/transfers_volume_to_exchanges_sum`, `transactions/transfers_volume_from_exchanges_sum` or `transactions/transfers_volume_exchanges_net`, and list exchanges such as binance and coinbase in Exchanges. Each exchange is read separately and labelled in the `exchange` column; set Currency to usd for dollar values.

#### How do I compare one metric across many coins?

Choose Bulk metric, give one metric such as `market/marketcap_usd` and list the assets, or `*` for all. One bulk request spans at most 31 days at daily resolution (10 days at hourly, 93 days at weekly), so use it for recent snapshots and the time series mode for long history. Bulk endpoints need the Professional plan.

#### Which metrics can my key read?

Run the Metric catalogue mode. It lists every metric path your filters allow, with its name, resolutions, optional parameters and whether it is on the Light API, according to this actor's documentation snapshot. Metric metadata then shows the exact assets, exchanges, resolutions and history one metric supports.

#### What do I pay?

The actor charges per returned record: 0.005 USD per metric data point, 0.01 USD per metric metadata record, 0.005 USD per asset and 0.005 USD per reference record (catalogue path, lag statistic, list name or credit summary), with Apify platform usage included. Empty results are free. Glassnode also counts data credits on your plan: 1 per request for BTC and 2 for any other asset, and per asset in a bulk request.

#### What happens if my key is wrong or my plan does not cover a metric?

A missing or rejected key (401), spent credits (402) or a spent daily allowance ends the run cleanly with the provider's explanation as the status message. A metric, resolution or bulk endpoint outside your plan (403), or an asset a metric does not support (400), becomes a free row with the provider's words and the run moves on; if nothing at all comes back, the run ends with that explanation. The per-minute rate limit (429) is waited out using the provider's reset header and retried.

### Keyword map

Glassnode API, on-chain data API, crypto on-chain metrics, Bitcoin on-chain analytics, Ethereum on-chain data, MVRV ratio, MVRV Z-Score, SOPR, NUPL, realized price, exchange flows, exchange balances, exchange netflow, active addresses, long-term holder supply, whale addresses, miner revenue, hash rate, futures open interest, funding rates, Bitcoin ETF flows, crypto market data API.

### Terms and data use

You need your own Glassnode subscription with API access, and your use of the data is governed by your agreement with Glassnode. Its terms grant a personal, non-transferable licence: you may not distribute, sublicense or resell the content or your API key, the Advanced plan is for personal, non-commercial use, and commercial and redistribution rights come with the Professional plan or as a separate purchase. The terms also limit an account to one active IP address within 24 hours; Apify runs come from changing IP addresses, so check with Glassnode before scheduling runs alongside other use of the same key. Nothing here is investment advice. This actor is an independent tool and is not made or endorsed by Glassnode.

# Actor input Schema

## `mode` (type: `string`):

Metric time series reads each metric for each asset, one request per pair, as timestamped values. Bulk metric reads one metric for many assets (or all, with \*) in one request over a window of up to 31 daily days. Metric metadata describes a metric: its assets, resolutions, exchanges, networks, time range and variants. Metric data lag shows how late new values arrive. The metric catalogue lists every metric path your filters allow. Assets lists Glassnode's assets with contracts and external IDs. Reference list reads exchanges, networks, miners or tags. API credit usage shows this month's credits.

## `metrics` (type: `array`):

Metric paths as the Glassnode docs list them below /v1/metrics, one per line, for example market/price_usd_close, market/mvrv, indicators/sopr, indicators/net_unrealized_profit_loss, addresses/active_count, distribution/balance_exchanges, transactions/transfers_volume_exchanges_net or derivatives/futures_open_interest_sum. The metric catalogue mode lists every path.

## `assets` (type: `array`):

Glassnode asset IDs such as BTC, ETH, SOL or USDT, one per line. The time series reads each asset separately (1 data credit for BTC, 2 for any other asset per request). Bulk metric reads them all in one request; \* means every asset. Metric metadata and data lag narrow to an asset when one is set; the catalogue lists metrics those assets support.

## `since` (type: `string`):

Start of the window: a date such as 2025-01-01, a UTC date and time, or a unix time in seconds. Leave empty to read the last lookback days. Set it to 2009-01-01 for full Bitcoin history.

## `until` (type: `string`):

End of the window, in the same forms as Since. Leave empty for the latest value.

## `lookbackDays` (type: `integer`):

How many days back to read when Since is empty. A bulk request spans at most 10 days at 10m or 1h, 31 days at 24h and 93 days at 1w or 1month, so the bulk window is shortened to fit.

## `resolution` (type: `string`):

Data point interval. Each metric offers its own set and your plan decides which you may read; the Light API on the Advanced plan serves daily only. A metric with no daily resolution uses its only documented one.

## `currency` (type: `string`):

For metrics that take a currency, such as exchange balances, transfer volumes and open interest. Left off metrics that do not.

## `exchanges` (type: `array`):

For metrics broken down by exchange, such as exchange balances, inflows, outflows and futures open interest. Names such as binance, coinbase, bybit, okex or aggregated, one per line. The time series reads each exchange separately; bulk reads them together. Left off metrics that take no exchange.

## `networks` (type: `array`):

For token metrics broken down by chain, such as stablecoin supply and balances. Names such as eth, arb, base, opt, sol, trx or aggregated, one per line; the provider defaults to eth. Left off metrics that take no network.

## `extraParameters` (type: `object`):

Advanced. Drill-down parameters the Glassnode metadata documents, passed through verbatim: miner, maturity, period, quote_symbol, from_exchange and to_exchange, for example {"miner": "foundry_usa"} or {"from_exchange": "binance", "to_exchange": "coinbase"}. Use the metric metadata mode to see which a metric takes.

## `assetFilter` (type: `string`):

Assets mode and the asset tag, category and blockchain lists. A Common Expression Language filter, for example asset.id=='USDT', asset.external_ids.coingecko=='tether', asset.blockchains.exists(b, b.blockchain=='ETH') or asset.semantic_tags.exists(t, t=='stablecoin').

## `listType` (type: `string`):

Reference list mode. Which list to read.

## `maxResults` (type: `integer`):

The most rows this run returns and charges for, across all metrics and assets. When one series is longer than the rows left, its newest points are kept.

## `requestsPerMinute` (type: `integer`):

Pacing. The provider allows 600 requests a minute by default and returns 429 above it, which the actor waits out and retries. The Light API is also capped at 50 calls a day.

## `apiKey` (type: `string`):

Your own Glassnode API key, from the API page of your Glassnode Studio settings. Stored as a secret and sent only in the X-Api-Key header; it is never logged. You can instead set the DATA_API_KEY environment secret.

## Actor input object example

```json
{
  "mode": "metricSeries",
  "metrics": [
    "market/price_usd_close",
    "indicators/sopr"
  ],
  "assets": [
    "BTC"
  ],
  "lookbackDays": 30,
  "resolution": "24h",
  "currency": "native",
  "listType": "exchanges",
  "maxResults": 500,
  "requestsPerMinute": 120
}
```

# Actor output Schema

## `records` (type: `string`):

One row per data point, metric description, asset or reference record.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "metrics": [
        "market/price_usd_close",
        "indicators/sopr"
    ],
    "assets": [
        "BTC"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/onchain-crypto-metrics-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "metrics": [
        "market/price_usd_close",
        "indicators/sopr",
    ],
    "assets": ["BTC"],
}

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/onchain-crypto-metrics-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "metrics": [
    "market/price_usd_close",
    "indicators/sopr"
  ],
  "assets": [
    "BTC"
  ]
}' |
apify call nabeelbaghoor/onchain-crypto-metrics-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/onchain-crypto-metrics-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/dYicokpjymcKA5wX6/builds/ejRb3bR49PVqAjkBM/openapi.json
