# EIA US Energy Data Search (`ryanclinton/eia-energy-data`) Actor

US energy data from the Energy Information Administration: electricity prices, natural gas, petroleum, and state energy profiles.

- **URL**: https://apify.com/ryanclinton/eia-energy-data.md
- **Developed by:** [Ryan Clinton](https://apify.com/ryanclinton) (community)
- **Categories:** Other, AI
- **Stats:** 5 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$30.00 / 1,000 result returneds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## EIA US Energy Data Search

US energy data from the Energy Information Administration: electricity prices, natural gas, petroleum, and state energy profiles.

### What does this actor do?

This actor queries the EIA Open Data API v2 across multiple energy datasets to build a comprehensive energy intelligence report:

1. **Electricity Retail Sales** — Prices, revenue, sales volume, and customer counts by state and sector (residential, commercial, industrial)
2. **Natural Gas Prices** — Spot prices, wellhead prices, and consumer prices
3. **Petroleum Prices** — Weekly retail gasoline and diesel prices (regular, midgrade, premium)
4. **State Energy Profiles (SEDS)** — Annual state-level production, consumption, prices, and expenditures

Each report includes a **market insight score** assessing energy cost conditions based on residential and industrial electricity prices.

### Input parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `apiKey` | string | EIA API key (free at https://www.eia.gov/opendata/register.php) |
| `dryRun` | boolean | Return sample data (default: true unless apiKey provided) |
| `sector` | string | `all`, `electricity`, `natural-gas`, `petroleum`, or `coal` |
| `state` | string | Two-letter state abbreviation |
| `frequency` | string | `weekly`, `monthly`, `quarterly`, or `annual` |
| `dateFrom` | string | Start date (YYYY-MM or YYYY) |
| `dateTo` | string | End date (YYYY-MM or YYYY) |
| `includeElectricity` | boolean | Include electricity data (default: true) |
| `includeNaturalGas` | boolean | Include natural gas data (default: true) |
| `includePetroleum` | boolean | Include petroleum data (default: true) |
| `includeStateProfiles` | boolean | Include SEDS state profiles (default: false) |
| `maxResults` | integer | Max records per dataset (1–5000, default: 500) |

### Output format

```json
{
    "reportType": "comprehensive",
    "electricity": {
        "records": [
            {
                "period": "2025-12",
                "state": "CA",
                "sector": "RES",
                "price": 28.52,
                "sales": 24680.3,
                "revenue": 4521.5,
                "customers": 14200000,
                "priceUnits": "cents per kilowatt-hour"
            }
        ],
        "summary": {
            "avgResidentialPrice": 22.05,
            "topExpensiveStates": [
                { "state": "CA", "price": 28.52 }
            ]
        }
    },
    "naturalGas": {
        "records": [
            {
                "period": "2025-11",
                "description": "Henry Hub Natural Gas Spot Price",
                "value": 3.42,
                "unit": "Dollars per Million Btu"
            }
        ]
    },
    "petroleum": {
        "records": [
            {
                "period": "2025-12",
                "description": "Weekly US Regular Gasoline Retail Price",
                "value": 3.24,
                "unit": "Dollars per Gallon"
            }
        ]
    },
    "marketInsight": {
        "score": 40,
        "level": "Moderate",
        "factors": [
            "High avg residential electricity: 22.05 cents/kWh (-15)",
            "Low avg industrial electricity: 7.82 cents/kWh (+8)"
        ]
    }
}
```

### Market insight scoring

Energy cost assessment (0–100):

| Factor | Impact |
|--------|--------|
| Residential electricity > 20 cents/kWh | -15 |
| Residential electricity > 15 cents/kWh | -5 |
| Residential electricity < 10 cents/kWh | +10 |
| Industrial electricity > 12 cents/kWh | -10 |
| Industrial electricity < 6 cents/kWh | +8 |

**Levels:** Favorable (65+), Moderate (45–64), Elevated (25–44), High Cost (<25)

### Use cases

- **Energy analysts**: Track electricity, gas, and petroleum price trends
- **Businesses**: Compare energy costs across states for site selection
- **Economists**: Monitor energy market conditions and price inflation
- **Utilities**: Benchmark rates against national and state averages
- **Policy researchers**: Analyze energy affordability by state and sector
- **Commodity traders**: Track natural gas and petroleum price movements

### API key

Register for a free EIA API key at https://www.eia.gov/opendata/register.php

Without an API key, the actor returns realistic sample data in dry run mode.

### Data sources

US Energy Information Administration (EIA) Open Data API v2:

- `electricity/retail-sales` — Electricity prices, sales, revenue by state/sector
- `natural-gas/pri/sum` — Natural gas price summaries
- `petroleum/pri/gnd` — Petroleum retail prices (gasoline, diesel)
- `seds` — State Energy Data System (consumption, production, expenditures)

# Actor input Schema

## `apiKey` (type: `string`):

Your EIA API key. Register free at https://www.eia.gov/opendata/register.php

## `dryRun` (type: `boolean`):

Return sample data without calling the API. Default: true (unless apiKey provided)

## `sector` (type: `string`):

Which energy sector to query

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

Two-letter state abbreviation to filter data

## `frequency` (type: `string`):

Data frequency

## `dateFrom` (type: `string`):

Start date (YYYY-MM for monthly, YYYY for annual)

## `dateTo` (type: `string`):

End date (YYYY-MM for monthly, YYYY for annual)

## `includeElectricity` (type: `boolean`):

Include electricity retail sales and prices by state

## `includeNaturalGas` (type: `boolean`):

Include natural gas price data

## `includePetroleum` (type: `boolean`):

Include petroleum/gasoline retail price data

## `includeStateProfiles` (type: `boolean`):

Include SEDS state-level energy consumption data (annual)

## `maxResults` (type: `integer`):

Maximum records per dataset (1-5000)

## Actor input object example

```json
{
  "dryRun": true,
  "sector": "all",
  "frequency": "monthly",
  "includeElectricity": true,
  "includeNaturalGas": true,
  "includePetroleum": true,
  "includeStateProfiles": false,
  "maxResults": 500
}
```

# Actor output Schema

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

No description

# 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("ryanclinton/eia-energy-data").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("ryanclinton/eia-energy-data").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 ryanclinton/eia-energy-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=ryanclinton/eia-energy-data",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/uY5GBLNv5fxQ2j1Yw/builds/BxuHDWVyUFBb6tUGO/openapi.json
