Skip to main content

gridstatus logo

Tests PyPI version

GridStatus.io Hosted API — Python Client

gridstatusio is a Python client for the GridStatus.io Hosted API, which provides historical and real-time electricity market data from North American ISOs through a single REST API.

Available datasets cover load and demand, fuel and generation mix, forecasts, locational marginal prices (LMPs), interchange, ancillary services, and more. Browse 500+ datasets in the Data Catalog.

Contents

Why the hosted API?

The hosted API differs from the open-source gridstatus library in several ways:

Hosted API Open-source gridstatus
Consistent column names, timestamp formats, and DST handling Raw data directly from ISO sources
Single REST API Source-specific integrations
Historical data queryable immediately Historical availability depends on each source's retention policy
Consistent server-side filtering by time, columns, and row values Filtering capabilities vary by source
Support included with paid subscriptions Community support

Use the open-source library when you want raw data directly from the ISOs with no account. We recommend this client when you want normalized, hosted data through a single API.

Installation

gridstatusio supports Python 3.10+. Install with uv or pip.

# Standard installation (includes pandas)
uv pip install gridstatusio

# With polars support (for polars DataFrames)
uv pip install gridstatusio[polars]

# With notebook support (for running example notebooks)
uv pip install gridstatusio[notebooks]

# With all optional dependencies
uv pip install gridstatusio[all]

Getting started

  1. Get an API key. Sign up for a Grid Status account and copy your key from the Settings page.
  2. Provide the key. Set export GRIDSTATUS_API_KEY=your_api_key, or pass it directly: GridStatusClient(api_key="<your_api_key>").
  3. Find a dataset. Call client.list_datasets() or browse the Data Catalog.
  4. Query the dataset. Call client.get_dataset(...) with the dataset ID and desired time range.
from gridstatusio import GridStatusClient

client = GridStatusClient()  # reads GRIDSTATUS_API_KEY from the environment

client.list_datasets()

df = client.get_dataset(
    "ercot_fuel_mix",
    start="2024-06-01",
    end="2024-06-02",
    limit=1000,
)

Dataset metadata

Use client.get_dataset_metadata(dataset_id) to get a dataset's description, available time range, columns, and more. It always returns a dictionary, with timestamp fields parsed into timezone-aware datetimes:

metadata = client.get_dataset_metadata("ercot_fuel_mix")

# {
#     "id": "ercot_fuel_mix",
#     "name": "ERCOT Fuel Mix",
#     "earliest_available_time_utc": datetime(2017, 1, 1, 6, 0, tzinfo=timezone.utc),
#     "all_columns": [{"name": "interval_start_utc", ...}, ...],
#     ...
# }

Return formats

get_dataset(...) supports pandas, polars, or Python objects. Set the return format at the client level or per-call. Dataset metadata is always returned as a dictionary.

from gridstatusio import GridStatusClient

# Set default format when creating the client
client = GridStatusClient(return_format="pandas")  # or "polars" or "python"

# Override format for a specific call
data = client.get_dataset("ercot_fuel_mix", limit=100, return_format="python")
Format Return Type Description
"pandas" pd.DataFrame Pandas DataFrame with parsed datetime columns
"polars" pl.DataFrame Polars DataFrame with parsed datetime columns
"python" list[dict] List of dictionaries with parsed datetime columns

If return_format is not specified, the client returns pandas DataFrames by default.

# Python format → list of dicts:
# [
#     {"interval_start_utc": "2025-01-01T00:00:00+00:00", "coal": 1234.5, ...},
#     {"interval_start_utc": "2025-01-01T00:05:00+00:00", "coal": 1235.2, ...},
# ]

Using without pandas (advanced)

Pandas is installed by default, but the library uses lazy loading so it's only imported when needed. In minimal environments, you can install without dependencies and use return_format="python" to avoid pandas entirely:

uv pip install gridstatusio --no-deps
uv pip install requests termcolor tabulate
from gridstatusio import GridStatusClient

# Must explicitly set return_format="python" to avoid the pandas import
client = GridStatusClient(api_key="your_key", return_format="python")
data = client.get_dataset("ercot_fuel_mix", limit=100)

If you don't set return_format="python", the client attempts to use pandas and raises an error if it isn't installed.

Checking your API usage

usage = client.get_api_usage()

Shows the limits for your API key, the start/end of the current usage period, and usage in the current period. A limit of -1 means no limit.

The free plan allows 500,000 rows per month. You can view detailed usage stats in Settings.

Retry configuration

The API enforces per-second/minute/hour rate limits. The client retries rate limits (429), server errors (5xx), and network issues with exponential backoff. See the Pricing Page for specific limits.

client = GridStatusClient(
    max_retries=3,        # Maximum retries (default: 5)
    base_delay=1.0,       # Base delay in seconds (default: 2.0)
    exponential_base=1.5, # Exponential backoff multiplier (default: 2.0)
)

Set max_retries=0 to disable retries.

Version check

The client checks PyPI for library updates on import. To disable this (e.g. in restricted environments), set:

export GSIO_SKIP_VERSION_CHECK=true

More examples

Resources

Get help

For usage or data-access questions, email contact@gridstatus.io.

Metadata

Release files for gridstatusio 0.16.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gridstatusio 0.16.1
File Size Uploaded
gridstatusio-0.16.1.tar.gz 1.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for gridstatusio 0.16.1
File Interpreter ABI Platform
gridstatusio-0.16.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.1 MB

Release files / gridstatusio-0.16.1.tar.gz

Download URL gridstatusio-0.16.1.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
1286162e53b52f307f9cf922c08134878a0422c8aa8c4db095fd64384afc5c3f
BLAKE2b-256 checksum
How to use checksums
2c3d80bc0fba1de881a95ef2f298eea86777cbe43e401c450583f8d891f7900d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / gridstatusio-0.16.1-py3-none-any.whl

Download URL gridstatusio-0.16.1-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d73601ecc04cd31006621108a63d3b7a184095af55cac5ffb8b06dc27d44551
BLAKE2b-256 checksum
How to use checksums
387d7f0ce555592b758c80944ebeca9816c1321832c4540d30de76af0bd0b356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.16.1 This release

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.9

2 release files

0.5.8

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page