Register at eia.gov to obtain a free API key; the key is passed as a query parameter named 'api_key' on every request.
Browse the v2 route catalog at https://api.eia.gov/v2 (no key required) to discover available routes, facets, and frequency options for electricity data under the 'electricity' parent route.
Construct a GET request such as GET https://api.eia.gov/v2/electricity/retail-sales/data/?frequency=monthly&data[0]=price&facets[sectorName][]=residential&start=2023-01&end=2023-12&api_key=<API_KEY> to retrieve monthly residential retail prices.
Parse the JSON response: actual records are nested under response.data; check response.total for pagination and use the 'offset' and 'length' parameters to page through large result sets.
For generation data, switch the route to /v2/electricity/electric-power-operational-data/data/ and select relevant facets such as fuel type and geographic area.
Known gotchas
The v2 API replaced the legacy v1 series-based API; old series IDs (e.g., ELEC.GEN.ALL-US-99.A) no longer work in v2 — you must translate them to the new facet/route model.
Default page size is 5000 rows; silently truncating large queries is common — always check response.total against the number of records returned and loop with 'offset' if they differ.
Some high-frequency (hourly) data sets have a rolling availability window and older data may be unavailable or require a different sub-route; check the route metadata for 'start' and 'end' bounds before querying.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp