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

# How To Export Data

This guide will show you how to export data using the Coin Metrics API.

## HTTP API

On a web browser, you can append any valid API request URL with `&format=csv` or `&format=json` to download the data in CSV or JSON format, respectively.

For example:

```text theme={null}
https://api.coinmetrics.io/v4/timeseries/asset-metrics?assets=eth&metrics=PriceUSD&frequency=1d&end_time=2015-08-01&start_inclusive=false&format=csv&api_key=<your_key>
```

## Google Sheets

Any endpoint that accepts `format=csv` can feed a Google Sheet through the `IMPORTDATA` function. The quickest version passes the whole URL inline:

```text theme={null}
=IMPORTDATA("https://api.coinmetrics.io/v4/timeseries/asset-metrics?metrics=CapMrktEstUSD,SplyCur,PriceUSD,CapMrktCurUSD&assets=usdc&frequency=1d&limit_per_asset=1&format=csv&api_key=<your_key>")
```

Sheets re-runs `IMPORTDATA` periodically, so the cell keeps pulling fresh data without you touching it.

### Building a reusable sheet

Editing that URL by hand gets tedious as soon as you want a different asset or date range. Put each query parameter in its own cell instead and assemble the URL with a formula, which turns the sheet into a small control panel you can point anywhere.

1. Open a new Google Sheet and enter the parameter names in column A with their values in column B, starting at row 1:

   | Cell | Parameter | Value |
   | - | - | - |
   | B1 | `api_key` | `<your_key>` |
   | B2 | `assets` | btc |
   | B3 | `metrics` | PriceUSD |
   | B4 | `page_size` | 1000 |
   | B5 | `start_time` | 2025-01-01T00:00:00Z |
   | B6 | `end_time` | 2025-01-31T00:00:00Z |
   | B7 | `paging_from` | end |
   | B8 | `frequency` | 1d |

2. In another cell, build the query URL from those values:

   ```text theme={null}
   = "https://api.coinmetrics.io/v4/timeseries/asset-metrics?" &
   "api_key=" & B1 &
   "&assets=" & B2 &
   "&metrics=" & B3 &
   "&page_size=" & B4 &
   "&start_time=" & B5 &
   "&end_time=" & B6 &
   "&paging_from=" & B7 &
   "&frequency=" & B8 &
   "&format=csv"
   ```

3. In a third cell, pass that cell to `IMPORTDATA`:

   ```text theme={null}
   =IMPORTDATA(<cell containing the URL>)
   ```

The first time you do this, Sheets asks you to allow the connection to an external URL:

![](https://mintcdn.com/talos-trading/9m6tIKuinLLOp5jj/coinmetrics/images/Screenshot%202025-12-05%20at%2010.42.13%20AM.png?fit=max\&auto=format\&n=9m6tIKuinLLOp5jj\&q=85\&s=1b2a3df80f67940c7cf9796f52ab58a7)

Once you allow it, the CSV response fills the cells below:

![](https://mintcdn.com/talos-trading/9m6tIKuinLLOp5jj/coinmetrics/images/Screenshot%202025-12-05%20at%2010.47.02%20AM.png?fit=max\&auto=format\&n=9m6tIKuinLLOp5jj\&q=85\&s=dfb86a063fea6bf766f0cfd0631a90e6)

> [!WARNING]
>
> Your API key sits in a cell and in the assembled URL, so anyone you share the sheet with can read it. Keep these sheets private, or use a key scoped to what the sheet needs.

## Python API Client

In the Python API client, you can use the `export_to_csv` and `export_to_json` methods to export data to a CSV or JSON file.

For example:

```python theme={null}
from coinmetrics.api_client import CoinMetricsClient

client = CoinMetricsClient()

client.get_asset_metrics(
    assets = ["btc", "eth"], 
    metrics = ["PriceUSD"], 
    start_time = "2024-01-01",
    end_time = "2024-01-31"
).export_to_csv("sample_data.csv")

client.get_asset_metrics(
    assets = ["btc", "eth"], 
    metrics = ["PriceUSD"], 
    start_time = "2024-01-01",
    end_time = "2024-01-31"
).export_to_json("sample_data.json")
```

As of version 2025.9.17.17, exporting to JSON files using the Python API Client is as fast using a `curl` command. See these [release notes](https://github.com/coinmetrics/api-client-python/releases) for more on benchmarking.

Exporting data can be sped up significantly by splitting the API calls to parallel threads.&#x20;

```python theme={null}
client.get_asset_metrics(
    assets = ["btc", "eth"], 
    metrics = ["PriceUSD"], 
    start_time = "2024-01-01",
    end_time = "2024-01-31"
).parallel("assets").export_to_csv_files()

# Exporting to CSV: 100%|██████████| 2/2 [00:00<00:00, 14.22it/s]
# 2025-09-18 15:41:36 [INFO] Files saved in: 
# ./asset-metrics/*.csv
```

Note that the download speed is evenly divided between all active connections of a single api key. 10 parallel connections are allowed. Excessing connections will be queued (no data transfer will happen).
