Skip to content

# Energy Data API

GET/v1/griddata/petroleum/weekly

The latest EIA weekly US petroleum figure for a series (crude_stocks, gasoline_stocks, distillate_stocks, refinery_inputs, crude_imports) with the previous week and the change. Published Wednesdays 10:30 ET. Refreshes every 7 days.

Price

$0.01/ call

Edge cache

86400s

Uptime 24h

100.00%

p95

652ms

MCP tool

griddata_petroleum-weekly

The Energy Data API provides wholesale electricity prices per market region, grid demand and generation by fuel, and other related data. The API offers a single schema across four market structures, including AEMO NEM, Elexon GB, ENTSO-E EU zones, and EIA US balancing authorities. Data is available in integer micro units with region codes in one list. The API also includes EIA weekly petroleum inventories and derived cheapest-window signals for charging and demand response.

Parameters

NameInTypeDescription
series query string = crude_stocks

Code

curl
# 1. No key, no payment: the gateway answers 402 with the price
curl -i "https://api.realtimeapi.ai/v1/griddata/petroleum/weekly"

# 2. Pay: retry with a signed x402 payment (any x402 client builds this header)
curl "https://api.realtimeapi.ai/v1/griddata/petroleum/weekly" -H "PAYMENT-SIGNATURE: $X402_PAYMENT"
TypeScript · @x402/fetch
// npm i @x402/fetch @x402/core @x402/evm viem
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = x402Client.fromConfig({ schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(privateKeyToAccount(PRIVATE_KEY)) }] });
const pay = wrapFetchWithPayment(fetch, client);
const data = await (await pay("https://api.realtimeapi.ai/v1/griddata/petroleum/weekly")).json();
console.log(data);
Python · x402
# pip install "x402[requests,evm]==2.27.0" eth-account
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact import register_exact_evm_client

client = x402ClientSync()
register_exact_evm_client(client, EthAccountSigner(Account.from_key(PRIVATE_KEY)))
session = x402_requests(client)
print(session.get("https://api.realtimeapi.ai/v1/griddata/petroleum/weekly").json())
With an API key
curl "https://api.realtimeapi.ai/v1/griddata/petroleum/weekly" -H "X-API-Key: $RTAPI_KEY"

Frequently asked questions

What data is available?

Wholesale electricity prices, grid demand, generation by fuel, and EIA weekly petroleum inventories

What market regions are covered?

AEMO NEM, Elexon GB, ENTSO-E EU zones, and EIA US balancing authorities

How often is the data updated?

The EIA weekly petroleum inventories are updated every 7 days, published on Wednesdays at 10:30 ET

Get a free key

1,000 calls a month across every feed. Who is setting it up?

No key needed at all: agents can pay per call in USDC with x402.