# EIA State Electricity Generation & Consumption API (`devone-studio/eia-state-electricity-api`) Actor

Search US EIA state-level electricity generation (66K records) and consumption (27K records) for 1990-2025 across 54 states, 6 producer types, 14 energy sources. Renewable transition, fossil fuel share, year-over-year change. Public domain (17 U.S.C. § 105).

- **URL**: https://apify.com/devone-studio/eia-state-electricity-api.md
- **Developed by:** [Ti Gg](https://apify.com/devone-studio) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 per results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## EIA State Electricity API — Generation and Consumption Data

Query US EIA state-level electricity generation (66 000) and
consumption (27 000) records for 1990–2025, across 54 states, 6
producer types, 14 energy sources. Renewable transition, fossil fuel
share, and YoY change helpers. Built for **energy analysts**,
**policy researchers**, and **AI agents** that need structured US
electricity data.

### Free trial

A free Apify account gives you about **5 USD of monthly credits**, more
than enough to compute several state-level timeseries before paying.

### Use cases

1. **Renewable transition watch** — for each state, pull yearly
   generation by `energy_source_category == "Renewable"` and compute
   `renewable_share_pct` from 2010 to most recent.
2. **Fossil fuel divestment screen** — for a portfolio of utilities,
   fetch the state-level `fossil_share_pct` and `yoy_change_pct` to
   track decarbonisation pace.
3. **State ranking** — order states by `renewable_share_pct` in
   `year = 2024` to support a policy brief.

### Input

```json
{
  "year": 2024,
  "state": "TX",
  "producer_type": "Total Electric Power Industry",
  "energy_source_category": "Renewable",
  "max_results": 100
}
```

| Field | Type | Default | Description |
|---|---|---|---|
| `dataset` | string | `generation` | `generation` or `consumption`. |
| `year` | integer | `0` | Filter to one year. `0` = all years (1990–2025). |
| `state` | string | `""` | 2-letter state code (e.g. `TX`, `CA`). |
| `state_division` | string | `""` | Census division (e.g. `West South Central`). |
| `state_region` | string | `""` | Census region. |
| `producer_type` | string | `""` | `Total Electric Power Industry`, `Electric Utility`, `Independent Power Producer`, `Combined Heat and Power`, … |
| `energy_source` | string | `""` | `Wind`, `Solar`, `Coal`, `Natural Gas`, … |
| `energy_source_category` | string | `""` | `Renewable`, `Fossil`, `Nuclear`, … |
| `min_value_gwh` | number | `0` | Post-filter minimum value in GWh. |
| `max_results` | integer | `100` | Cap on returned records. |

### Output (real run)

```json
[
  {
    "year": 2024,
    "state": "TX",
    "state_name": "Texas",
    "state_fips": "48",
    "state_region": "South",
    "state_division": "West South Central",
    "producer_type": "Total Electric Power Industry",
    "energy_source": "Wind",
    "energy_source_category": "Renewable",
    "value_raw": 124277504,
    "value_unit": "Megawatthours",
    "value_gwh": 124277.504,
    "value_twh": 124.277504,
    "is_renewable": true,
    "is_fossil": false,
    "is_nuclear": false,
    "is_zero_emission": true,
    "is_recent_year": true,
    "rank_in_state": 1,
    "state_total_mwh": 539000000,
    "source_share_of_state_pct": 23.06,
    "renewable_share_pct": 28.4,
    "fossil_share_pct": 56.7,
    "decade_change_pct": 84.3,
    "yoy_change_pct": 6.2,
    "year_min": 1990,
    "year_max": 2025,
    "value_tier": "very_high",
    "resource": "wind"
  },
  {
    "year": 2024,
    "state": "TX",
    "state_name": "Texas",
    "state_fips": "48",
    "state_region": "South",
    "state_division": "West South Central",
    "producer_type": "Total Electric Power Industry",
    "energy_source": "Solar",
    "energy_source_category": "Renewable",
    "value_raw": 43800000,
    "value_unit": "Megawatthours",
    "value_gwh": 43800,
    "value_twh": 43.8,
    "is_renewable": true,
    "is_fossil": false,
    "is_nuclear": false,
    "is_zero_emission": true,
    "is_recent_year": true,
    "rank_in_state": 2,
    "state_total_mwh": 539000000,
    "source_share_of_state_pct": 8.13,
    "renewable_share_pct": 28.4,
    "fossil_share_pct": 56.7,
    "decade_change_pct": 1240.0,
    "yoy_change_pct": 28.5,
    "year_min": 1990,
    "year_max": 2025,
    "value_tier": "high",
    "resource": "solar"
  }
]
```

| Field | Type | Description |
|---|---|---|
| `year` | integer | Calendar year (1990–2025). |
| `state` / `state_name` / `state_fips` | string | 2-letter code, full name, FIPS code. |
| `state_region` / `state_division` | string | Census region / division. |
| `producer_type` | string | Reporting sector. |
| `energy_source` / `energy_source_category` | string | Source (`Wind`) and category (`Renewable`). |
| `value_raw` / `value_unit` | integer / string | Raw value and unit. |
| `value_gwh` / `value_twh` | number | Same value, scaled. |
| `is_renewable` / `is_fossil` / `is_nuclear` / `is_zero_emission` | boolean | Category flags. |
| `is_recent_year` | boolean | True when within the last 3 years. |
| `rank_in_state` | integer | Rank by `value_gwh` within the state for that year. |
| `state_total_mwh` | integer | Total state generation in the year (MWh). |
| `source_share_of_state_pct` | number | Source share of state total. |
| `renewable_share_pct` | number | Renewable share of state total. |
| `fossil_share_pct` | number | Fossil share of state total. |
| `decade_change_pct` | number | 10-year change percentage. |
| `yoy_change_pct` | number | Year-over-year change percentage. |
| `year_min` / `year_max` | integer | Dataset coverage. |
| `value_tier` | string | `very_high`, `high`, `medium`, `low`, `very_low`. |
| `resource` | string | Normalised resource slug. |

### Pricing (pay-per-event)

- **No subscription.** Free monthly credits apply first.
- **1 result = $0.001 USD** (about $1 per 1 000 results).
- Charged per item returned in the dataset; failed runs are not charged.

### Source, licence, limits

- Source: US EIA Open Data API
  (<https://www.eia.gov/opendata/browser/electricity/>).
- Licence: EIA Open Data is free to use with attribution.
- Update frequency: monthly. This Actor reflects the upstream API at the
  moment of the run.
- Limits: requires no API key for the public endpoint; rate limits are
  generous but we use exponential backoff to be polite.

### FAQ

**Why is `state_division` empty for some states?**
Each state belongs to exactly one census division; some territories
(PR, DC, VI) are not in the official divisions and may return null.

**How is `renewable_share_pct` computed?**
It sums `value_gwh` for all records in the same `(state, year)`
where `is_renewable=true`, divided by `state_total_mwh`. Non-energy
records (e.g. hydroelectric pumped storage) are excluded.

**What's `value_tier`?**
A categorical bucket of `value_gwh` (`very_high`, `high`, `medium`,
`low`, `very_low`) — useful for legends and filters.

**How do I get a full timeseries for one source?**
Leave `year` empty and filter by `state` + `energy_source`. The Actor
returns every annual record.

**Why does some years have gaps?**
EIA does not always publish every state×source×producer for every year
— the Actor returns only what EIA provides.

**How do I export to a chart?**
Run with `state = "TX"` and `energy_source_category = "Renewable"`,
then chart `value_gwh` over `year` in your tool of choice.

### Other Actors from DevOne-Studio

- **[ted-tenders-api](https://apify.com/devone-studio/ted-tenders-api)** — TED (Tenders Electronic Daily) EU public procurement search.
- **[pdf-to-text-api](https://apify.com/devone-studio/pdf-to-text-api)** — PDF to text + tables extraction via pdfplumber, no external calls.
- **[pubmed-articles-api](https://apify.com/devone-studio/pubmed-articles-api)** — NCBI PubMed biomedical literature with MeSH/DOI/year filters.
- **[federal-register-api](https://apify.com/devone-studio/federal-register-api)** — US federal agency rules, proposed rules, notices, presidential docs.
- **[sec-company-tickers](https://apify.com/devone-studio/sec-company-tickers)** — Resolve SEC CIK from ticker or company name (10,400+ issuers).
- **[sec-edgar-fulltext-search-api](https://apify.com/devone-studio/sec-edgar-fulltext-search-api)** — Full-text search across 35M+ SEC EDGAR filings and exhibits.
- **[sec-edgar-xbrl-frames-api](https://apify.com/devone-studio/sec-edgar-xbrl-frames-api)** — XBRL frames (Revenues, Assets, NetIncomeLoss) for ~6000 US issuers.
- **[cfpb-consumer-complaints-api](https://apify.com/devone-studio/cfpb-consumer-complaints-api)** — 18M+ US CFPB consumer complaints since 2011.
- **[nhtsa-safety-ratings-api](https://apify.com/devone-studio/nhtsa-safety-ratings-api)** — NHTSA NCAP 5-star vehicle safety ratings.
- **[openfda-udi-api](https://apify.com/devone-studio/openfda-udi-api)** — FDA Unique Device Identifier database by device/manufacturer.

### Changelog

- **2026-10-12** — SEO metadata (seoTitle, seoDescription); README rewritten with real output sample, FAQ, cross-links.
- **2026-10-05** — Pricing switched to Apify pay-per-event (`$0.001` per dataset item).
- **2026-09-30** — Initial public release on the Apify Store.

# Actor input Schema

## `resource` (type: `string`):

Which EIA dataset to query.

## `year` (type: `integer`):

Specific year (1990-2025). Leave at 0 to use year_min/year_max.

## `year_min` (type: `integer`):

Earliest year (1990-2025). Used when year=0.

## `year_max` (type: `integer`):

Latest year (1990-2025). Used when year=0.

## `state` (type: `string`):

US state or territory 2-letter code (e.g. CA, TX, AK, DC, PR).

## `state_name_search` (type: `string`):

Substring filter on state name (e.g. 'Texas').

## `producer_type` (type: `string`):

EIA producer type filter.

## `energy_source` (type: `string`):

EIA energy source filter.

## `min_generation_mwh` (type: `integer`):

Minimum generation (MWh) or consumption (raw units).

## `max_generation_mwh` (type: `integer`):

Maximum generation (MWh) or consumption (raw units).

## `is_renewable_only` (type: `boolean`):

Keep only renewable sources (Hydro / Wind / Solar / Geothermal / Wood / Other Biomass).

## `is_fossil_only` (type: `boolean`):

Keep only fossil sources (Coal / Natural Gas / Petroleum / Other Gases).

## `is_zero_emission_only` (type: `boolean`):

Keep only zero-emission sources (Hydro / Wind / Solar / Geothermal / Wood / Nuclear).

## `recent_only` (type: `boolean`):

Restrict to 2023-2025.

## `sort_by` (type: `string`):

Sort field and direction.

## `max_results` (type: `integer`):

Maximum records to return (1-500).

## `include_derived` (type: `boolean`):

Add per-state renewable share, fossil share, YoY change, decade change, etc.

## `include_metadata` (type: `boolean`):

Add a 'metadata' record with fetch info (rows scanned, fetched_at, source_url).

## Actor input object example

```json
{
  "resource": "generation",
  "year": 0,
  "year_min": 1990,
  "year_max": 2025,
  "state": "",
  "state_name_search": "",
  "producer_type": "Total Electric Power Industry",
  "energy_source": "Total",
  "min_generation_mwh": 0,
  "max_generation_mwh": 0,
  "is_renewable_only": false,
  "is_fossil_only": false,
  "is_zero_emission_only": false,
  "recent_only": false,
  "sort_by": "generation_desc",
  "max_results": 50,
  "include_derived": true,
  "include_metadata": true
}
```

# Actor output Schema

## `results` (type: `string`):

All results of the run, as JSON from the default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("devone-studio/eia-state-electricity-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("devone-studio/eia-state-electricity-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call devone-studio/eia-state-electricity-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,devone-studio/eia-state-electricity-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/nxtz5EK9WedtOuwqM/builds/476FJtI7Sg8ZHzXyZ/openapi.json
