API Reference
Base URL: https://api.kwhpulse.com
All endpoints return application/json unless ?format=csv is specified. Data is sourced from EIA Form 861 and 861M public datasets.
Authentication
All endpoints except /v1/signup and the OpenAPI docs require an API key. Pass it as an HTTP header:
x-api-key: YOUR_API_KEYGet a free key (1,000 requests/month) on the home page or via the API:
curl -X POST https://api.kwhpulse.com/v1/signup \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com"}'Response:
{
"api_key": "abc123xyz...",
"message": "API key created. Keep it safe — it won't be shown again."
}Common parameters
| Parameter | Values | Description |
|---|---|---|
format | json (default), csv | Response format. ?format=csv returns a CSV file with a Content-Disposition header. |
sector | RES, COM, IND, TRA, ALL (default) | Customer sector: Residential, Commercial, Industrial, Transportation, or all. |
adjust | cpi-2024 | Adjust prices to 2024 dollars using US CPI. Adds adjusted_cents_per_kwh to each record. |
start | YYYY-MM | Inclusive start period (e.g. 2010-01). |
end | YYYY-MM | Inclusive end period (e.g. 2024-12). |
GET
/v1/prices/state/{state}
Returns historical monthly electricity prices for a US state.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
state | string | required | Two-letter US state code (e.g. OR). |
Query parameters
| Parameter | Default | Description |
|---|---|---|
sector | ALL | Filter by customer sector. |
format | json | Response format (json or csv). |
adjust | — | Set cpi-2024 for inflation-adjusted values. |
start | — | Inclusive start period (YYYY-MM). |
end | — | Inclusive end period (YYYY-MM). |
Example request
curl "https://api.kwhpulse.com/v1/prices/state/OR?sector=RES&start=2020-01" \
-H "x-api-key: YOUR_API_KEY"import requests
r = requests.get(
"https://api.kwhpulse.com/v1/prices/state/OR",
params={"sector": "RES", "start": "2020-01"},
headers={"x-api-key": "YOUR_API_KEY"},
)
print(r.json())const res = await fetch(
"https://api.kwhpulse.com/v1/prices/state/OR?sector=RES&start=2020-01",
{ headers: { "x-api-key": "YOUR_API_KEY" } }
);
const data = await res.json();
console.log(data);Example response
Show JSON response
{
"state": "OR",
"sector": "RES",
"data": [
{
"price_cents_per_kwh": 1392,
"price_dollars_per_kwh": 13.92,
"sector": "RES",
"source": "eia861m",
"period": "2024-01"
}
]
}
GET
/v1/prices/zip/{zip}
Returns historical monthly electricity prices for a US ZIP code, resolved via the ZIP→utility→state mapping.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
zip | string | required | Five-digit US ZIP code (e.g. 97333). |
Query parameters
| Parameter | Default | Description |
|---|---|---|
sector | RES | Filter by customer sector. |
format | json | Response format. |
adjust | — | Set cpi-2024 for inflation-adjusted values. |
start | — | Inclusive start period. |
end | — | Inclusive end period. |
Example request
curl "https://api.kwhpulse.com/v1/prices/zip/97333?sector=RES" \
-H "x-api-key: YOUR_API_KEY"
GET
/v1/prices/utility/{utility_id}
Returns historical monthly electricity prices for a specific utility, identified by its EIA utility ID.
Path parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
utility_id | string | required | EIA utility ID (e.g. 14354). |
Example request
curl "https://api.kwhpulse.com/v1/prices/utility/14354?sector=RES" \
-H "x-api-key: YOUR_API_KEY"
GET
/v1/utilities
Returns the list of utilities serving a given ZIP code.
Query parameters
| Parameter | Required | Description |
|---|---|---|
zip | required | Five-digit US ZIP code. |
Example response
Show JSON response
{
"zip": "97333",
"state": "OR",
"utility_ids": ["14354", "4743"]
}
GET
/v1/rankings/states
Returns all 50 states + DC ranked by current average price for a given sector.
Query parameters
| Parameter | Default | Description |
|---|---|---|
sector | RES | Filter by customer sector. |
order | asc | asc (cheapest first) or desc (most expensive first). |
Example request
curl "https://api.kwhpulse.com/v1/rankings/states?sector=RES&order=asc" \
-H "x-api-key: YOUR_API_KEY"
GET
/v1/compare/zips
Compare current and historical prices across multiple ZIP codes side-by-side.
Query parameters
| Parameter | Required | Description |
|---|---|---|
zips | required | Comma-separated ZIP codes (max 10), e.g. 97333,94102,10001. |
sector | — | Customer sector. Defaults to RES. |
Example request
curl "https://api.kwhpulse.com/v1/compare/zips?zips=97333,94102,10001§or=RES" \
-H "x-api-key: YOUR_API_KEY"
GET
/openapi.json
OpenAPI 3.1 specification for the entire kWhPulse API. No API key required.
curl "https://api.kwhpulse.com/openapi.json"Error codes
| Status | Meaning |
|---|---|
400 | Bad request — invalid parameter (e.g. unknown state code, malformed ZIP). |
401 | Unauthorized — missing or invalid x-api-key header. |
404 | Not found — no data for that state/ZIP/utility combination. |
429 | Rate limit exceeded — upgrade your plan or wait until the next month. |
500 | Internal server error — please report at hello@kwhpulse.com. |