Skip to content

API to download data

  • With a valid API key and subscription, you can download the raw data via GET requests.

  • The availabe data fields are accessible in the Data section

  • Your API key is found at the My Account section.

  • You can purchase a subscription or add more days to an existing one at the Subscribe section.

  • NEW: See the "Handling Large Column Sets" section below for information on requesting more than 120 columns.

Parameters

api_key

Your API key

start_block

Integer starting block height

end_block

Integer ending block height

columns_list

String with the name of the column (can be passed multiple times).

columns

String with the name of the column as a comma-separated list.

format

csv (default) or json

Examples

https://bitcoinisdata.com/api/get_data?api_key=XXXXXXXXXXXXXXXXXXXXXX

Download data from the default block height 800,000 onwards

https://bitcoinisdata.com/api/get_data?api_key=XXXXXXXXXXXXXXXXXXXXXX&start_block=600000

Download data from the block height 600,000 onwards

https://bitcoinisdata.com/api/get_data?api_key=XXXXXXXXXXXXXXXXXXXXXX&start_block=600000&end_block=650000

Download data between the block heights 600,000 and 650,000

https://bitcoinisdata.com/api/get_data?api_key=XXXXXXXXXXXXXXXXXXXXXX&start_block=875000&columns_list=heights&columns_list=price&columns_list=difficulty&format=json

Download specific columns in JSON format (traditional method)

https://bitcoinisdata.com/api/get_data?api_key=XXXXXXXXXXXXXXXXXXXXXX&start_block=875000&columns=heights,price,difficulty,hashrate,tx_count&format=json

Download specific columns using comma-separated format (recommended for more than 120 columns)

Handling Large Column Sets

Important Update

We've identified an issue where requesting more than 120 columns using the traditional query parameter format would result in a 400 error. This is due to limitations in how many query parameters can be processed in a single request.

To address this, we've added a new way to specify columns using a comma-separated string.

Two Ways to Specify Columns

Method 1: Traditional

This method uses repeated query parameters (limited to 120 columns):

/api/get_data?columns_list=block_size&columns_list=heights&columns_list=difficulty&api_key=your_api_key
Method 2: Comma-separated

This method uses a single query parameter with comma-separated values (no column limit):

/api/get_data?columns=block_size,heights,difficulty&api_key=your_api_key

✓ Use this method when you need to request more than 120 columns

Python Example Code

import requests
import pandas as pd

# Method 1: Traditional approach (limited to 120 columns)
api_url = "https://bitcoinisdata.com/api/get_data"
params = {
    "api_key": "XXXXXXXXXXXXXXXXXXXXX",             # Replace with your actual API key
    "start_block": 875000,                          # Example start block
    "end_block": 875010,                            # Example end block
    "format": "json",                               # Request JSON format
    "columns_list": ["heights", "difficulty", "coins"]   # List of columns
}

# Method 2: Using comma-separated columns (for more than 120 columns)
api_url = "https://bitcoinisdata.com/api/get_data"
params = {
    "api_key": "XXXXXXXXXXXXXXXXXXXXX",                      # Replace with your actual API key
    "start_block": 875000,                                   # Example start block
    "end_block": 875010,                                     # Example end block
    "format": "json",                                         # CSV format works well with large datasets
    "columns": "heights,difficulty,price,hashrate,tx_count"  # Comma-separated column list
}
    
response = requests.get(api_url, params=params)
if response.status_code == 200:
    json_data = response.json()
    df = pd.DataFrame(json_data)
    print(df)
else:
    print('Error:', response)