# EIA Energy Data Scraper (`parseforge/eia-energy-data-scraper`) Actor

Scrapes EIA energy data including gas prices by state, diesel prices by region, and crude oil weekly prices. Returns each record as a flat row with price, date, and region.

- **URL**: https://apify.com/parseforge/eia-energy-data-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### EIA Energy Data Scraper

**Scrape EIA energy data for gas prices, diesel prices, and crude oil weekly prices, up to a million records per run.** Every record comes with its price, date, and geographic region in a flat, analysis-ready schema. No API key or registration required. Export to CSV, JSON, Excel, or XML.

The U.S. Energy Information Administration publishes critical energy data, but downloading it manually means navigating complex web tools and reformatting spreadsheets. This Actor reads the public data feeds directly, letting you pull gas prices by state, diesel prices by region, or crude oil weekly prices into a single, consistent dataset. It handles pagination and rate limits so you get every record you need without writing a script.

| Who uses it | What they scrape EIA for |
|---|---|
| Energy analysts | Tracking weekly crude oil price movements for market reports. |
| Fleet managers | Monitoring state-level gas and diesel prices to budget fuel costs. |
| Economic researchers | Building historical price series to model inflation or consumer spending. |
| Data journalists | Pulling the latest regional fuel prices for a news story on energy costs. |

### What it does

This Actor collects EIA energy data from the selected dataset and returns each record as a flat row with price, date, and geographic region.

- ⛽ **Gas Prices by State:** Weekly retail gasoline prices for every U.S. state, including regular, midgrade, and premium grades.
- 🛢️ **Diesel Prices by Region:** Weekly on-highway diesel prices broken out by U.S. region and California sub-regions.
- 📈 **Crude Oil Weekly Prices:** Weekly spot prices for West Texas Intermediate, Brent, and other key crude benchmarks.

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with EIA data

**⛽ Monitor retail fuel costs by state.**

A fleet operator pulls weekly gas and diesel prices for their operating states to forecast monthly fuel spend and adjust routing budgets.

**📊 Build a crude oil price history.**

An energy analyst scrapes the full crude oil weekly dataset to backtest trading strategies against WTI and Brent spot prices.

**📰 Feed a news dashboard with energy prices.**

A data journalist schedules a weekly run of gas prices by state to populate an interactive map showing where prices are rising fastest.

**🧪 Enrich economic models with fuel data.**

A researcher collects diesel prices by region to correlate transportation costs with consumer price index changes across U.S. regions.

### Why choose this scraper

|  | What you get |
|---|---|
| **No API key** | Reads public EIA data feeds directly, no registration or token management. |
| **Consistent schema** | Every record arrives with the same columns, ready for analysis or a database. |
| **Historical depth** | Pull years of weekly pricing data in a single run. |
| **Flexible export** | Save results as CSV, JSON, Excel, or XML for your existing workflow. |

### How it compares

No other Store actor targets EIA the same way, so the honest comparison is with the alternatives teams actually weigh.

| | EIA Energy Data Scraper | Build it in-house | By hand |
|---|---|---|---|
| Setup | Run it now, zero config | Days of engineering | None, but hours per pull |
| When EIA changes | Maintained for you | You fix it | You re-learn the page |
| Proxies, retries, anti-bot | Built in | Your problem | Browser only |
| Output | Fixed JSON schema, CSV/Excel export | Whatever you build | Copy-paste |
| Cost | Pay per result | Engineering time | Analyst hours |

### Configure the run

Drive the Actor by selecting one of three EIA datasets, and set a maximum record count to cap the run. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "dataset": "gas-prices-by-state",
  "maxItems": 10
}
```

A larger pull:

```json
{
  "dataset": "gas-prices-by-state",
  "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.0065 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $0.65 |
| 1,000 results | $6.50 |
| 10,000 results | $65.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [EIA Energy Data Scraper](https://apify.com/parseforge/eia-energy-data-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to EIA through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?tools=parseforge/eia-energy-data-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Check that you selected a valid dataset in the input configuration. Also verify that the EIA website is reachable and that your maxItems setting is not set to zero.

**The run is taking too long.**

Large datasets with many years of history can take time to paginate through. Reduce the maxItems value to collect a smaller sample, or let the run complete for a full historical pull.

**Some records have missing price values.**

The EIA occasionally publishes records with null or missing values when data is not available for a specific date or region. This is expected and reflects the source data.

**I need a dataset that is not listed.**

This Actor currently supports three specific EIA datasets. If you need another EIA data product, you can request it as a feature addition or use a generic web scraper to target the page directly.

**The export file has duplicate rows.**

The Actor does not deduplicate records. If you run it multiple times over overlapping date ranges, you may see duplicates. Deduplicate in your analysis tool using the date and region columns.

### FAQ

| Question | Answer |
|---|---|
| Do I need an EIA API key to use this Actor? | No. This Actor reads the public data feeds from the EIA website directly. You do not need to register for an API key or manage any authentication. |
| What EIA datasets can I scrape? | You can choose from three datasets: Gas Prices by State, Diesel Prices by Region, and Crude Oil Weekly Prices. Select the one you need in the input configuration. |
| How far back does the historical data go? | The Actor pulls all available records from the selected dataset, which typically includes several years of weekly pricing history. The exact start date varies by dataset. |
| Can I filter by a specific state or region? | The Actor returns all geographic areas in the selected dataset. You can filter the results after export using your own tools, or set a maximum record count to limit the run. |
| What format does the data come in? | You can export the scraped data to CSV, JSON, Excel, or XML directly from the Apify platform. The schema is flat and consistent across all records. |
| How often is the EIA data updated? | The EIA updates its datasets on a regular schedule, typically weekly. You can schedule this Actor to run on the same cadence to keep your data current. |
| Can I scrape more than one dataset in a single run? | Each run scrapes one dataset at a time. To collect multiple datasets, run the Actor separately for each one and combine the results afterward. |
| Is there a limit to how many records I can collect? | You can set a maximum of up to 1,000,000 records per run. The actual number of records available depends on the dataset and how much history the EIA publishes. |
| Does this Actor handle pagination automatically? | Yes. The Actor follows all pages in the data feed automatically. You do not need to manage offsets or page tokens. |
| Can I run this on a schedule? | Yes. Apify supports scheduled runs. You can set this Actor to run weekly to capture the latest EIA energy data as soon as it is published. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by U.S. Energy Information Administration. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `dataset` (type: `string`):

Select the EIA energy dataset to scrape

## `maxItems` (type: `integer`):

Maximum number of records to collect per run.

## Actor input object example

```json
{
  "dataset": "gas-prices-by-state",
  "maxItems": 10
}
```

# Actor output Schema

## `overview` (type: `string`):

Overview

# 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 = {
    "dataset": "gas-prices-by-state",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/eia-energy-data-scraper").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 = {
    "dataset": "gas-prices-by-state",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/eia-energy-data-scraper").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 '{
  "dataset": "gas-prices-by-state",
  "maxItems": 10
}' |
apify call parseforge/eia-energy-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/eia-energy-data-scraper"
        }
    }
}

```

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/Lpp6dNo9YYOw3MRHY/builds/oca51P80KrDcFGqd2/openapi.json
