# US Energy Information Administration API

> US Energy Information Administration returns fuel and electricity prices as a workflow and API.

EIA returns weekly gasoline and diesel prices and changes; provide a reported U.S. area and 1–52 weeks.

- Page: https://fous.com/tools/us-energy-information-administration
- Handle: `@us-energy-information-administration`
- Category: [Energy](https://fous.com/tools/category/energy)
- Source website: https://eia.gov
- Last verified: Sep 29, 2026

## Methods

### Get electricity prices

Operation `get_electricity_prices`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get a state’s latest monthly electricity price by customer type, its year-over-year change, year-to-date average, and the matching US average. Prices are preliminary EIA estimates; some sector prices are unavailable.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `state` | string | yes | `"California"` | US state name or two-letter code, or US. Example: California. |
| `customer_type` | string | no | `"business"` | Customer sector: residential, commercial, industrial, transportation, or all; home and business are accepted. Example: home. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "state"
  ],
  "properties": {
    "state": {
      "type": "string",
      "description": "US state name or two-letter code, or US. Example: California.",
      "examples": [
        "California",
        "CA",
        "US"
      ]
    },
    "customer_type": {
      "type": "string",
      "default": "residential",
      "description": "Customer sector: residential, commercial, industrial, transportation, or all; home and business are accepted. Example: home.",
      "examples": [
        "business",
        "all",
        "transportation"
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "state": "California"
    },
    {
      "state": "CA",
      "customer_type": "business"
    },
    {
      "state": "US",
      "customer_type": "all"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `state` | string | `"California"` | State or United States |
| `eia_link` | string | `"https://www.eia.gov/electricity/monthly/epm_table_grapher.php?t=epmt_5_6_a"` | EIA monthly price table link |
| `latest_month` | string | `"2026-07"` | Latest reporting month (YYYY-MM) |
| `customer_type` | string | `"Residential"` | Customer type in words |
| `change_percent` | number or null | `2.91` | Percentage change from the same month a year earlier |
| `us_average_cents_per_kwh` | number or null | `18.31` | US price for this customer type and month in cents per kilowatthour |
| `average_price_cents_per_kwh` | number or null | `33.61` | Latest monthly average price in cents per kilowatthour |
| `price_year_earlier_cents_per_kwh` | number or null | `32.66` | Price for the same month a year earlier in cents per kilowatthour |
| `year_to_date_average_cents_per_kwh` | number or null | `33.25` | Year-to-date average price in cents per kilowatthour |

**Example input**

```json
{
  "state": "California"
}
```

**Example output**

```json
{
  "state": "California",
  "eia_link": "https://www.eia.gov/electricity/monthly/epm_table_grapher.php?t=epmt_5_6_a",
  "latest_month": "2026-07",
  "customer_type": "Residential",
  "change_percent": 2.91,
  "us_average_cents_per_kwh": 18.31,
  "average_price_cents_per_kwh": 33.61,
  "price_year_earlier_cents_per_kwh": 32.66,
  "year_to_date_average_cents_per_kwh": 33.25
}
```

### Get fuel prices

Operation `get_fuel_prices`, version 1. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.

Get the latest weekly retail gasoline and on-highway diesel prices for a reported U.S. area, with changes from the prior week and 52 weeks earlier. Diesel is unavailable for some states and cities.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `area` | string | no | `"Chicago"` | Reported U.S. area, such as US, Midwest, California, Texas, Chicago, or Denver. Example: Midwest |
| `weeks` | integer | no | `3` | Number of recent weeks, from 1 to 52. Example: 4 |

**Input schema**

```json
{
  "type": "object",
  "properties": {
    "area": {
      "type": "string",
      "default": "US",
      "description": "Reported U.S. area, such as US, Midwest, California, Texas, Chicago, or Denver. Example: Midwest",
      "examples": [
        "Chicago",
        "US",
        "California"
      ]
    },
    "weeks": {
      "type": "integer",
      "default": 1,
      "maximum": 52,
      "minimum": 1,
      "description": "Number of recent weeks, from 1 to 52. Example: 4",
      "x-fous-developer": true,
      "examples": [
        3,
        1,
        2
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "area": "Chicago",
      "weeks": 3
    },
    {
      "area": "US",
      "weeks": 1
    },
    {
      "area": "California",
      "weeks": 2
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `area` | string | `"Chicago"` | Reported area. |
| `history` | array |  | Weekly prices and changes, newest first when more than one week is requested; empty for one week. |
| `history[].area` | string | `"Chicago"` | Reported area. |
| `history[].currency` | string | `"USD"` | Currency for prices and changes. |
| `history[].eia_link` | string | `"https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm"` | EIA page for this area. |
| `history[].week_date` | string | `"2026-09-21"` | Week ending date (YYYY-MM-DD). |
| `history[].diesel_price_per_gallon` | number or null | `8.246` | Diesel retail price in USD per gallon, or null if not reported. |
| `history[].diesel_change_from_year_ago` | number or null | `3.261` | Diesel change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `history[].diesel_change_from_last_week` | number or null | `0.207` | Diesel change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `history[].premium_gasoline_price_per_gallon` | number or null | `6.118` | Premium gasoline retail price in USD per gallon, or null if not reported. |
| `history[].regular_gasoline_price_per_gallon` | number or null | `4.879` | Regular gasoline retail price in USD per gallon, or null if not reported. |
| `history[].midgrade_gasoline_price_per_gallon` | number or null | `5.455` | Midgrade gasoline retail price in USD per gallon, or null if not reported. |
| `history[].all_grades_gasoline_price_per_gallon` | number or null | `5.061` | All grades gasoline retail price in USD per gallon, or null if not reported. |
| `history[].premium_gasoline_change_from_year_ago` | number or null | `1.52` | Premium gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `history[].regular_gasoline_change_from_year_ago` | number or null | `1.413` | Regular gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `history[].midgrade_gasoline_change_from_year_ago` | number or null | `1.36` | Midgrade gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `history[].premium_gasoline_change_from_last_week` | number or null | `0.447` | Premium gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `history[].regular_gasoline_change_from_last_week` | number or null | `0.459` | Regular gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `history[].midgrade_gasoline_change_from_last_week` | number or null | `0.41` | Midgrade gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `history[].all_grades_gasoline_change_from_year_ago` | number or null | `1.413` | All grades gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `history[].all_grades_gasoline_change_from_last_week` | number or null | `0.455` | All grades gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `currency` | string | `"USD"` | Currency for prices and changes. |
| `eia_link` | string | `"https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm"` | EIA page for this area. |
| `week_date` | string | `"2026-09-21"` | Week ending date (YYYY-MM-DD). |
| `diesel_price_per_gallon` | number or null | `6.529` | Diesel retail price in USD per gallon, or null if not reported. |
| `diesel_change_from_year_ago` | number or null | `2.78` | Diesel change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `diesel_change_from_last_week` | number or null | `0.244` | Diesel change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `premium_gasoline_price_per_gallon` | number or null | `6.118` | Premium gasoline retail price in USD per gallon, or null if not reported. |
| `regular_gasoline_price_per_gallon` | number or null | `4.879` | Regular gasoline retail price in USD per gallon, or null if not reported. |
| `midgrade_gasoline_price_per_gallon` | number or null | `5.455` | Midgrade gasoline retail price in USD per gallon, or null if not reported. |
| `all_grades_gasoline_price_per_gallon` | number or null | `5.061` | All grades gasoline retail price in USD per gallon, or null if not reported. |
| `premium_gasoline_change_from_year_ago` | number or null | `1.52` | Premium gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `regular_gasoline_change_from_year_ago` | number or null | `1.413` | Regular gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `midgrade_gasoline_change_from_year_ago` | number or null | `1.36` | Midgrade gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `premium_gasoline_change_from_last_week` | number or null | `0.447` | Premium gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `regular_gasoline_change_from_last_week` | number or null | `0.459` | Regular gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `midgrade_gasoline_change_from_last_week` | number or null | `0.41` | Midgrade gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |
| `all_grades_gasoline_change_from_year_ago` | number or null | `1.413` | All grades gasoline change in USD per gallon versus 52 weeks before, or null if unavailable. |
| `all_grades_gasoline_change_from_last_week` | number or null | `0.455` | All grades gasoline change in USD per gallon from the previous weekly observation, or null if unavailable. |

**Example input**

```json
{
  "area": "Chicago",
  "weeks": 3
}
```

**Example output**

```json
{
  "area": "Chicago",
  "history": [
    {
      "area": "Chicago",
      "currency": "USD",
      "eia_link": "https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm",
      "week_date": "2026-09-21",
      "diesel_price_per_gallon": null,
      "diesel_change_from_year_ago": null,
      "diesel_change_from_last_week": null,
      "premium_gasoline_price_per_gallon": 6.118,
      "regular_gasoline_price_per_gallon": 4.879,
      "midgrade_gasoline_price_per_gallon": 5.455,
      "all_grades_gasoline_price_per_gallon": 5.061,
      "premium_gasoline_change_from_year_ago": 1.52,
      "regular_gasoline_change_from_year_ago": 1.413,
      "midgrade_gasoline_change_from_year_ago": 1.36,
      "premium_gasoline_change_from_last_week": 0.447,
      "regular_gasoline_change_from_last_week": 0.459,
      "midgrade_gasoline_change_from_last_week": 0.41,
      "all_grades_gasoline_change_from_year_ago": 1.413,
      "all_grades_gasoline_change_from_last_week": 0.455
    }
  ],
  "currency": "USD",
  "eia_link": "https://www.eia.gov/dnav/pet/pet_pri_gnd_dcus_yord_w.htm",
  "week_date": "2026-09-21",
  "diesel_price_per_gallon": null,
  "diesel_change_from_year_ago": null,
  "diesel_change_from_last_week": null,
  "premium_gasoline_price_per_gallon": 6.118,
  "regular_gasoline_price_per_gallon": 4.879,
  "midgrade_gasoline_price_per_gallon": 5.455,
  "all_grades_gasoline_price_per_gallon": 5.061,
  "premium_gasoline_change_from_year_ago": 1.52,
  "regular_gasoline_change_from_year_ago": 1.413,
  "midgrade_gasoline_change_from_year_ago": 1.36,
  "premium_gasoline_change_from_last_week": 0.447,
  "regular_gasoline_change_from_last_week": 0.459,
  "midgrade_gasoline_change_from_last_week": 0.41,
  "all_grades_gasoline_change_from_year_ago": 1.413,
  "all_grades_gasoline_change_from_last_week": 0.455
}
```

## Quick start

Replace `YOUR_API_KEY` with a Fous API key. To create one, open Developers at the bottom of Fous Studio, turn on Developer mode, then go to API keys (https://app.fous.com/keys). Change the values in `input` to run the same tool on new data.

```bash
curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 180 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@us-energy-information-administration",
  "visibility": "public",
  "operation": "get_electricity_prices",
  "version": 1,
  "input": {
    "state": "California"
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
import json
import urllib.error
import urllib.request

api_key = "YOUR_API_KEY"

body = json.loads("{\n  \"api\": \"@us-energy-information-administration\",\n  \"visibility\": \"public\",\n  \"operation\": \"get_electricity_prices\",\n  \"version\": 1,\n  \"input\": {\n    \"state\": \"California\"\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=180) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
const apiKey = "YOUR_API_KEY";

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(180_000),
  body: JSON.stringify({
  "api": "@us-energy-information-administration",
  "visibility": "public",
  "operation": "get_electricity_prices",
  "version": 1,
  "input": {
    "state": "California"
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

## Use from an AI assistant

Connect this tool to Claude Code, Claude Desktop, Cursor, VS Code, Codex and any MCP client as its own MCP server. Each method is a typed tool whose arguments are the method’s input.

- Server URL: `https://api.fous.com/mcp/tools/us-energy-information-administration`
- Authorization: `Authorization: Bearer <Fous API key>`

**Tools**

- `get_electricity_prices`: Get electricity prices. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `get_fuel_prices`: Get fuel prices. 1 credit per completed call. Failed calls without a completed billing receipt are free; completed work can remain charged if delivery is interrupted.
- `fous_get_run`: the result of a run that was still going, by its `request_id`. Free.

Claude Code:

```bash
claude mcp add --scope user --transport http fous-us-energy-information-administration https://api.fous.com/mcp/tools/us-energy-information-administration --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"
```

To give the assistant every tool, connect `https://api.fous.com/mcp`: it finds one with `fous_search_tools` and runs it with `fous_run_tool`. Setup for other clients: https://fous.com/llms-full.txt.

## Use cases

- Compare weekly gasoline prices across U.S. areas
- Track diesel price changes from the prior week
- Review gasoline prices against the same week a year earlier
- Compare state electricity prices by customer type
- Assess state electricity prices against the U.S. average

## FAQ

### Can I run it with my own inputs?

Yes. Change the inputs in Studio and press Run, or send new inputs from your code, or ask a connected AI assistant.

### Can I call this US Energy Information Administration tool as an API?

Yes. Send a POST request to /v1/query with your Fous API key and the inputs, and get JSON back.

### How much does it cost?

Each completed run costs 1 credit. Failed runs without a completed receipt are free; completed work can remain charged if delivery is interrupted. With pay as you go, a credit costs 1¢. Monthly plans cost less per credit.

### Do I need a US Energy Information Administration account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from eia.gov when you run it. Some results are reused for up to 24 hours, and results that use your account or key are never reused. It was last verified on Sep 29, 2026.

### What are the latest fuel prices in my area?

Get fuel prices returns weekly retail gasoline and diesel prices for a reported U.S. area, with changes from the prior week and 52 weeks earlier.

### How have fuel prices changed over recent weeks?

Get fuel prices returns prices and changes for the requested number of recent weeks.

### What is my state's electricity price by customer type?

Get electricity prices returns the latest monthly price, year-over-year change, year-to-date average, and matching U.S. average for a state and customer type.

## Related

- [AAA API](https://fous.com/tools/aaa.md): AAA daily gas price averages for the United States, states and metro areas.
- [GasBuddy API](https://fous.com/tools/gasbuddy.md): GasBuddy finds stations and community-reported fuel prices in the US and Canada, with nearby prices that may be missing or out of date and regional averages that may lag the day.
- [FuelEconomy.gov API](https://fous.com/tools/fueleconomy-gov.md): FuelEconomy.gov provides official vehicle fuel economy ratings, driving range, emissions, five-year savings, and annual fuel costs based on current fuel prices and EPA’s 15,000-mile annual driving assumption.
- [Trading Economics API](https://fous.com/tools/trading-economics.md): Trading Economics provides economic indicators, market data and country statistics, including country overviews, latest reported country comparisons and current commodity prices reflecting reported trading days.
- [Alternative Fuels Data Center API](https://fous.com/tools/alternative-fuels-data-center.md): U.S. Department of Energy data on alternative fuel stations and vehicles.
- [Etherscan API](https://fous.com/tools/etherscan.md): Etherscan shows current gas prices, estimated costs, wallet balances, displayed token holdings and newest confirmed transactions, plus transaction status and details; pending fees are unconfirmed.
- [Investing.com API](https://fous.com/tools/investing-com.md): Investing.com provides financial markets data and news, economic releases up to 31 days, and current commodity prices and government bond yields, which may be delayed or indicative.
- [Costco API](https://fous.com/tools/costco.md): Costco returns US product prices/details and warehouse hours/services/gas prices; delivery affects availability, member prices may be hidden, and posted gas and holiday hours may differ.
- [All Energy tools](https://fous.com/tools/category/energy)
