query the EIA API v2 to discover valid facet values (e.g. sectorid, stateid, fueltypeid) for an electricity data route before filtering a request

domain: api.eia.gov · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Register for a free EIA API key at eia.gov/opendata and note the key
  2. Identify the target dataset route (e.g. electricity/retail-sales)
  3. Call GET https://api.eia.gov/v2/{route}/facet/{facetid}/?api_key=... to list valid values for one facet at a time
  4. Repeat per facet needed (e.g. stateid, sectorid) since each facet must be queried individually
  5. Build the final data query using facets[factid][]=value for each confirmed facet plus data[]=value column selection
  6. Handle pagination with offset/length parameters if more than 5000 rows are expected

Known gotchas

Related routes

Query electricity data (net generation, retail sales, prices) from the EIA using the API v2 route/facets/data hierarchy.
api.eia.gov · 6 steps · unrated
Query petroleum and natural gas price series from the EIA API v2 using route, frequency, and facets parameters
api.eia.gov · 5 steps · unrated
Query electricity generation and retail price data from the EIA API v2
api.eia.gov · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans