# 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/workflows/us-energy-information-administration
- Handle: `@us-energy-information-administration`
- Category: [Energy](https://fous.com/workflows/category/energy)
- Source website: https://eia.gov
- Last verified: Sep 29, 2026
- Fous is not affiliated with US Energy Information Administration.

## Methods

### Get electricity prices

Operation `get_electricity_prices`, version 1. 1 credit per call.

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 call.

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

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_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.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

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=120) 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.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_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);
```

Or describe the data in plain language: send `{"api":"@us-energy-information-administration","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## 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

### Is Fous affiliated with US Energy Information Administration?

No. Fous is not affiliated with US Energy Information Administration. This workflow reads the public eia.gov website and returns its data.

### How much does it cost?

Each run costs 1 credit. 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; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check 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/workflows/aaa.md): AAA daily gas price averages for the United States, states and metro areas.
- [GasBuddy API](https://fous.com/workflows/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/workflows/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/workflows/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/workflows/alternative-fuels-data-center.md): U.S. Department of Energy data on alternative fuel stations and vehicles.
- [Etherscan API](https://fous.com/workflows/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/workflows/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/workflows/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 workflows](https://fous.com/workflows/category/energy)
