Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- The API is a tree of routes: call a route without /data for its metadata (child routes, or frequencies, facets and data columns), then add /data to get rows.
- Data rows only carry value columns that are asked for with data[]; ask for them explicitly.
- JSON answers hold at most 5,000 rows; page with offset and length. response.total gives the full match count.
- Bulk scraping must be throttled; a key that sends too many requests per second or hour is suspended temporarily.
- Route segments go in separate path parameters (category, dataset); a value containing ’/’ would be escaped.
Endpoints
List top-level datasets
Get a route
Get a second-level route
List a facet’s values
Query a dataset two levels deep
- Facet filters (facets[<id>][]=<code>) have dynamic names; this entry cannot take them. Use eia.electricity.retail_sales, or a raw call with the facet in the query.
Query a dataset three levels deep
- Facet filters need a raw call, as for eia.data.get.
Query electricity retail sales
- Example: data [price], stateid [CO], sectorid [RES], frequency monthly gives Colorado’s residential price per month.