Accelerating Developer Onboarding: Building a Sandbox Environment with Energy API for Rapid Prototyping
Developer onboarding for energy data projects often grinds to a halt at the same choke points: fragmented sources, incompatible formats, and painful, one-off integrations. If you are stitching together OMIE for Spain’s day-ahead electricity auctions, ENTSO-E for cross-border flows, EIA/FRED for oil and gas, ESIOS for PVPC retail references, and Ember for carbon intensity, the real world looks like divergent CSVs, XML payloads, and asynchronous publishing schedules. Your engineers aren’t iterating; they’re chasing data hygiene. Meanwhile, product doesn’t care which exchange or ministry published the number — they need it in a consistent shape that can ship into dashboards, alerts, and pricing engines today.
This post shows how to accelerate developer onboarding by building a sandbox environment that feels like a local mock server yet serves real, normalized energy market data. We’ll leverage a single, unified surface from Energy API — a REST API that aggregates wholesale energy data across electricity, natural gas, crude oil, coal, carbon allowances, and grid carbon intensity — all returned as consistent JSON. With one interface, you can prototype a price alert bot, backtest risk models, or assemble an ESG intensity panel without becoming an expert in every upstream portal’s quirks.
You’ll learn how to get your first requests working in minutes, how to explore symbols, query latest and historical values across multiple commodities in the same call, and how to pull intraday electricity curves for sandboxes that stress-test your UX against day-ahead auctions and hourly retail reference prices. Along the way we will cover best practices for reliability (health checks, retries, circuit breakers), governance (role separation via per-app credentials), and performance (regional routing and lean JSON) so you can move from a proof-of-concept to a production-ready prototype with minimal friction.
Introduction
The hardest part of building energy data products isn’t plotting a chart or performing math — it’s normalizing raw inputs. In Europe, electricity day-ahead auctions publish at specific times with country-specific conventions. Natural gas prices like TTF have different currencies and frequencies than Henry Hub in the U.S. Crude oil benchmarks (Brent, WTI) arrive in USD/barrel, coal in USD/tonne, and EU ETS carbon allowances in EUR/MT. If you try to wire these sources yourself, your sandbox becomes an ETL factory: coalescing timestamps, inferring missing values, caching around weekends and holidays, and translating naming conventions into something your codebase can reason about.
The solution is a unified, commodity-agnostic interface with consistent semantics so your UI, alert engines, and quant libraries don’t fork logic per source. A developer sandbox built on Energy API gives you a stable base URL, the same JSON schema across categories, and clear endpoints for daily spot values, intraday curves, OHLC series, fluctuations, and status checks. Your team can model risk with TTF_GAS and EUA_CO2 in the same payload, test a COGS calculator with wholesale electricity prices, or overlay carbon intensity on consumption data — all without hand-carving per-provider connectors.
We’ll walk through a practical sandbox blueprint: discover symbols, fetch combined latest values across commodities, pull timeseries for charting, and wire intraday electricity curves to mimic a live operations view. We’ll discuss pragmatic error handling and backoff strategies for 429s, deterministic fallbacks around non-publishing days, and health checks to guard your pipeline with minimal code.
Why Energy API
Most teams underestimate the engineering tax of heterogeneous energy feeds. Each provider publishes on a different cadence, wraps values in different shapes, and encodes symbols in conflicting conventions. Energy API erases those seams:
- One normalized REST surface: Instead of writing ETL glue for OMIE, ENTSO-E, EIA/FRED, and ESIOS, you query a single base URL and receive consistent JSON across electricity, gas, oil, coal, carbon, and carbon intensity. This shrinks sandbox setup from weeks to hours and lets you ship early versions while backfilling more nuanced features later.
- Same JSON schema across commodities: Your code to parse “rates,” “dates,” “currencies,” and “frequencies” works for BRENT_CRUDE, TTF_GAS, OMIE_ES_DA, and EUA_CO2 alike. That uniformity means you can build generic chart components and alert rules, then plug in new symbols with no schema debt.
- Intraday electricity curves where available: For operators and retail products, hourly (and 15-minute) curves are the heart of UX. The API exposes a dedicated intraday endpoint so your sandbox can replicate real-world dynamics like daily auction pivots, PVPC hourly references in Spain, or profiles that feed cost estimators.
- Breadth of coverage with deterministic history handling: 39+ symbols across six categories, plus well-defined behavior on weekends and holidays. If you request a historical date with no publication, you get the most recent prior value. Your tests pass even on non-business days without special-case logic.
Beyond features, developer velocity is the core advantage. The same interface delivers spot prices, multi-commodity latest snapshots, historical series, OHLC candles, forecasted day-ahead auctions (where already published by the source), and grid carbon intensity. This uniformity collapses your onboarding curve and keeps your sandbox faithful to production behavior while still being simple to reason about.
Quick Start
The sandbox surface is straightforward: a single base URL and a small set of parameters. You can query multiple commodities in one call, which is ideal for prototyping dashboards or alert engines quickly.
Base URL:
https://energy-api.com/api/v1
Example: pull the most recent value for Brent crude, TTF gas, and EU ETS carbon allowances in one shot.
curl -G https://energy-api.com/api/v1/latest \
--data-urlencode "symbols=BRENT_CRUDE,TTF_GAS,EUA_CO2" \
--data-urlencode "api_key=YOUR_API_KEY"
Sample response:
{
"success": true,
"date": "2026-06-11",
"base": "MIXED",
"rates": {
"BRENT_CRUDE": 74.82,
"TTF_GAS": 38.15,
"EUA_CO2": 67.40
},
"dates": {
"BRENT_CRUDE": "2026-06-11",
"TTF_GAS": "2026-06-11",
"EUA_CO2": "2026-06-11"
},
"currencies": {
"BRENT_CRUDE": "USD",
"TTF_GAS": "EUR",
"EUA_CO2": "EUR"
}
}
Key fields your sandbox will use:
- success: Boolean guard for happy-path logic.
- date: Normalized “as-of” date for the composite response when mixing commodities.
- rates: Symbol-to-latest price map for all requested assets.
- dates: Per-symbol timestamp to reflect differences in publishing cadence.
- currencies: Per-symbol currency code so you can annotate charts and avoid unit mix-ups.
This single call powers a “global market snapshot” card in a dashboard, instantly showing your users an energy landscape across oil, gas, and carbon with correct currencies intact.
Core Endpoints
Below are the most important endpoints to wire into a prototyping sandbox. Each one includes a cURL example, a realistic JSON response, and field explanations you can repurpose directly in your application code.
1) Discover symbols: GET /symbols
Use this to enumerate symbols by category and render pickers in your UI. It’s also useful to auto-complete forms and to prevent invalid symbol submissions.
curl -G https://energy-api.com/api/v1/symbols \
--data-urlencode "category=gas" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"count": 3,
"symbols": [
{
"symbol": "TTF_GAS",
"name": "TTF Natural Gas Day-Ahead",
"category": "gas",
"country_code": "EU",
"currency_code": "EUR",
"frequency": "daily",
"description": "TTF day-ahead price published by EEX."
},
{
"symbol": "HENRY_HUB",
"name": "Henry Hub Natural Gas",
"category": "gas",
"country_code": "US",
"currency_code": "USD",
"frequency": "daily",
"description": "Henry Hub spot price benchmark."
},
{
"symbol": "NATGAS_GENERIC",
"name": "Composite Natural Gas Reference",
"category": "gas",
"country_code": "MIXED",
"currency_code": "MIXED",
"frequency": "daily",
"description": "Composite reference; use for exploratory analysis."
}
]
}
Important fields:
- symbol: The canonical token used across all other endpoints.
- frequency: Good input for chart time granularity (daily vs intraday where applicable).
- currency_code: Enables correct labeling and FX transformation logic if you convert units.
2) Latest prices across commodities: GET /latest
Ideal for top-of-screen snapshots and alert checks. You can mix commodities in a single call to reduce roundtrips and keep logic simple. Below we ask for oil, gas, electricity, and carbon all at once.
curl -G https://energy-api.com/api/v1/latest \
--data-urlencode "symbols=BRENT_CRUDE,WTI_CRUDE,TTF_GAS,OMIE_ES_DA,EUA_CO2" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"date": "2026-06-11",
"base": "MIXED",
"rates": {
"BRENT_CRUDE": 74.82,
"WTI_CRUDE": 70.33,
"TTF_GAS": 38.15,
"OMIE_ES_DA": 96.42,
"EUA_CO2": 67.40
},
"dates": {
"BRENT_CRUDE": "2026-06-11",
"WTI_CRUDE": "2026-06-11",
"TTF_GAS": "2026-06-11",
"OMIE_ES_DA": "2026-06-11",
"EUA_CO2": "2026-06-11"
},
"currencies": {
"BRENT_CRUDE": "USD",
"WTI_CRUDE": "USD",
"TTF_GAS": "EUR",
"OMIE_ES_DA": "EUR",
"EUA_CO2": "EUR"
}
}
Use cases:
- Pre-market digest: one widget, five commodities.
- Alert pre-filter: only trigger heavier timeseries pulls if a threshold is breached.
3) Charting and backtests: GET /timeseries
This endpoint returns multi-symbol, date-keyed series. It’s your workhorse for charts, regressions, and backtests. If your sandbox shows historical context behind alerts, this is the backbone.
curl -G https://energy-api.com/api/v1/timeseries \
--data-urlencode "start=2025-01-01" \
--data-urlencode "end=2025-03-31" \
--data-urlencode "symbols=BRENT_CRUDE,TTF_GAS,EUA_CO2" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"base": "MIXED",
"start_date": "2025-01-01",
"end_date": "2025-03-31",
"rates": {
"BRENT_CRUDE": {
"2025-01-02": 76.30,
"2025-01-03": 75.90,
"2025-01-06": 76.10
},
"TTF_GAS": {
"2025-01-02": 46.80,
"2025-01-03": 47.10,
"2025-01-06": 46.20
},
"EUA_CO2": {
"2025-01-02": 70.10,
"2025-01-03": 69.75,
"2025-01-06": 70.50
}
},
"frequencies": {
"BRENT_CRUDE": "daily",
"TTF_GAS": "daily",
"EUA_CO2": "daily"
},
"currencies": {
"BRENT_CRUDE": "USD",
"TTF_GAS": "EUR",
"EUA_CO2": "EUR"
}
}
Key fields:
- rates: Nested map keyed by symbol, then ISO date. Use for direct chart binding.
- frequencies: Confirms granularity for each symbol — helpful for aggregations.
- currencies: Prevents unit mismatches in multi-axis charts and portfolio calculators.
4) Intraday electricity curves: GET /electricity/hourly
For operators, retailers, and real-time dashboards, intraday curves (hourly or 15-minute) are vital. Use this endpoint to render a tradable-looking curve or to power cost estimates that depend on time-of-use.
curl -G https://energy-api.com/api/v1/electricity/hourly \
--data-urlencode "symbol=OMIE_ES_DA" \
--data-urlencode "date=2026-06-11" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"symbol": "OMIE_ES_DA",
"date": "2026-06-11",
"interval": "hourly",
"currency": "EUR",
"values": [
{ "time": "2026-06-11T00:00:00+02:00", "price": 82.10 },
{ "time": "2026-06-11T01:00:00+02:00", "price": 79.30 },
{ "time": "2026-06-11T02:00:00+02:00", "price": 76.90 },
{ "time": "2026-06-11T03:00:00+02:00", "price": 75.20 },
{ "time": "2026-06-11T04:00:00+02:00", "price": 74.00 },
{ "time": "2026-06-11T05:00:00+02:00", "price": 80.50 },
{ "time": "2026-06-11T06:00:00+02:00", "price": 92.30 },
{ "time": "2026-06-11T07:00:00+02:00", "price": 104.20 }
]
}
In your sandbox, bind values to a time-series chart, and show hover details with time and price. If you simulate forecast overlays, you can visually compare the day-ahead publication to realized load or cost feeds you supply locally.
5) Period-over-period changes: GET /fluctuation
Quantify deltas for summary cards and risk alerts. This endpoint returns start/end, absolute change, and percentage change. Great for “Week-over-Week TTF +3.2 EUR/MWh (8.5%)” style callouts.
curl -G https://energy-api.com/api/v1/fluctuation \
--data-urlencode "start=2025-09-01" \
--data-urlencode "end=2025-09-30" \
--data-urlencode "symbols=TTF_GAS,EUA_CO2,BRENT_CRUDE" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"start_date": "2025-09-01",
"end_date": "2025-09-30",
"results": {
"TTF_GAS": {
"start_value": 34.20,
"end_value": 36.20,
"change": 2.00,
"change_pct": 5.85
},
"EUA_CO2": {
"start_value": 66.10,
"end_value": 67.40,
"change": 1.30,
"change_pct": 1.97
},
"BRENT_CRUDE": {
"start_value": 72.90,
"end_value": 71.45,
"change": -1.45,
"change_pct": -1.99
}
}
}
Bind change_pct to sparkline color, and show tooltips with start/end_value to give users confidence in your derived metrics.
6) Candles for volatility analysis: GET /ohlc
Engineering teams integrating trading analytics or hedging dashboards often need higher-level aggregates. OHLC candles let you chart volatility, compress history for UI performance, and compute momentum indicators quickly.
curl -G https://energy-api.com/api/v1/ohlc \
--data-urlencode "symbols=BRENT_CRUDE,TTF_GAS" \
--data-urlencode "period=monthly" \
--data-urlencode "start=2025-01-01" \
--data-urlencode "end=2025-06-30" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"period": "monthly",
"results": {
"BRENT_CRUDE": [
{ "period": "2025-01", "open": 76.12, "high": 79.34, "low": 74.90, "close": 77.01, "data_points": 21 },
{ "period": "2025-02", "open": 77.05, "high": 80.21, "low": 75.88, "close": 78.40, "data_points": 20 }
],
"TTF_GAS": [
{ "period": "2025-01", "open": 46.50, "high": 49.90, "low": 45.80, "close": 47.30, "data_points": 21 },
{ "period": "2025-02", "open": 47.40, "high": 50.40, "low": 46.10, "close": 48.70, "data_points": 20 }
]
},
"currencies": {
"BRENT_CRUDE": "USD",
"TTF_GAS": "EUR"
}
}
Practical tips: cache these aggregates in your sandbox for snappy chart loads; use data_points to flag sparse months or handle market holidays.
7) Electricity category helpers
Category endpoints simplify common workflows. For electricity-centric prototypes, these give you breadth and speed.
- GET /electricity/latest — pull the latest for all electricity symbols (filterable by country). Quick “market board” scaffold.
- GET /electricity/pvpc — hourly Spanish PVPC retail reference for a given date. Perfect for consumer-facing cost simulators and UX stress tests.
- GET /forecast — deterministic next published day-ahead price for auction symbols (e.g., OMIE). If the symbol isn’t auction-based, you’ll get a 404.
Example: top-of-board electricity snapshot with optional country filter.
curl -G https://energy-api.com/api/v1/electricity/latest \
--data-urlencode "country=ES" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"count": 2,
"symbols": [
{ "symbol": "OMIE_ES_DA", "price": 96.42, "date": "2026-06-11", "currency": "EUR" },
{ "symbol": "PVPC_ES_2TD", "price": 0.211, "date": "2026-06-11", "currency": "EUR" }
]
}
Deterministic day-ahead lookup for auction symbols:
curl -G https://energy-api.com/api/v1/forecast \
--data-urlencode "symbol=OMIE_ES_DA" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"symbol": "OMIE_ES_DA",
"forecast_date": "2026-06-12",
"currency": "EUR",
"price": 101.75,
"published_at": "2026-06-11T12:45:00+02:00",
"note": "Day-ahead auction result as published by OMIE"
}
Use published_at in your UI to indicate data freshness; for operations users, that transparency builds trust quickly.
8) Gas, coal, emissions category helpers
These shortcuts fetch the most watched benchmarks in each category with minimal parameters — ideal for quick tiles in your sandbox.
- GET /gas/latest — returns TTF_GAS and HENRY_HUB.
- GET /coal/latest — returns COAL_ROTTERDAM (API2) and COAL_NEWCASTLE.
- GET /emissions/latest — returns EUA_CO2.
curl -G https://energy-api.com/api/v1/gas/latest \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"symbols": [
{ "symbol": "TTF_GAS", "price": 38.15, "date": "2026-06-11", "currency": "EUR" },
{ "symbol": "HENRY_HUB", "price": 2.91, "date": "2026-06-11", "currency": "USD" }
]
}
Bind these results to comparative tiles and color-code by region or currency for at-a-glance context.
9) Grid carbon intensity: GET /carbon-intensity
ESG dashboards and sustainability models often overlay consumption data with grid intensity. This endpoint returns gCO2eq/kWh by country, powering footprint estimates and decarbonization nudges in your UI.
curl -G https://energy-api.com/api/v1/carbon-intensity \
--data-urlencode "country=DE" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"country": "DE",
"symbol": "CARBON_INT_DE",
"unit": "gCO2eq/kWh",
"date": "2026-06-11",
"value": 324,
"source_note": "National/transmission data normalized via Ember/ENTSO-E methodology"
}
Combine this with wholesale electricity prices to simulate “green cost” overlays or to trigger alerts when intensity exceeds a threshold.
10) Historical snapshots: GET /historical
For backfilling charts and running event studies, you often need a specific date’s values across multiple assets. This endpoint returns prices for a date, with deterministic fallback to the most recent prior publication if the date is a non-publishing day.
curl -G https://energy-api.com/api/v1/historical \
--data-urlencode "date=2025-09-15" \
--data-urlencode "symbols=BRENT_CRUDE,TTF_GAS" \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"date": "2025-09-15",
"base": "MIXED",
"rates": {
"BRENT_CRUDE": 71.45,
"TTF_GAS": 36.20
},
"currencies": {
"BRENT_CRUDE": "USD",
"TTF_GAS": "EUR"
}
}
Your tests will stay green on holidays/weekends thanks to the prior-value fallback, so you don’t need special-case logic per market.
11) Simple cost estimation: POST /cost-estimate
Product teams regularly ask for “back-of-the-envelope” cost simulations. This helper multiplies the latest wholesale price by a given monthly kWh. It’s intentionally simple (excludes taxes, network charges, and hourly profiles) and perfect for early UX trials.
curl -X POST https://energy-api.com/api/v1/cost-estimate \
-H "Content-Type: application/json" \
-d '{
"symbol": "OMIE_ES_DA",
"kwh_per_month": 450
}'
{
"success": true,
"symbol": "OMIE_ES_DA",
"kwh_per_month": 450,
"price": 96.42,
"currency": "EUR",
"estimated_cost": 433.89,
"note": "Wholesale-only estimate; excludes taxes, network charges, and time-of-use effects."
}
Use this endpoint to A/B test UI flows and copy — you can wire a more detailed calculator later without changing the contract your frontend consumes today.
12) Provider health: GET /status
Reliability is a feature. For production-grade sandboxes, poll status to gate heavy jobs, surface “data delayed” banners, and manage fallback chains. This is the fastest path to observability without building bespoke monitors on day one.
curl -G https://energy-api.com/api/v1/status \
--data-urlencode "api_key=YOUR_API_KEY"
{
"success": true,
"providers": [
{ "provider": "OMIE", "last_fetch": "2026-06-11T12:50:21Z", "status": "ok", "message": null },
{ "provider": "ENTSO-E", "last_fetch": "2026-06-11T12:51:03Z", "status": "ok", "message": null },
{ "provider": "EIA", "last_fetch": "2026-06-11T12:45:10Z", "status": "ok", "message": null },
{ "provider": "FRED", "last_fetch": "2026-06-11T12:44:29Z", "status": "ok", "message": null },
{ "provider": "ESIOS", "last_fetch": "2026-06-11T12:49:58Z", "status": "ok", "message": null }
]
}
When status is degraded, apply exponential backoff and circuit-break expensive polling until the provider recovers.
Real-World Use Cases
Below are three concrete blueprints your team can build in a day using this sandbox foundation.
1) Cross-commodity price alert system
Spin up a worker that pulls GET /latest for BRENT_CRUDE, TTF_GAS, EUA_CO2, and OMIE_ES_DA every few minutes. If any rate crosses a configured threshold or deviates beyond N standard deviations from a trailing window (via GET /timeseries), trigger an alert. Use GET /fluctuation to annotate alerts with contextual percent change and GET /status to mute alerts during provider incidents. The same alert engine works across commodities because the schema is uniform.
2) ESG dashboard with carbon intensity overlays
Combine GET /carbon-intensity with GET /electricity/hourly to render time-aligned charts: display hourly OMIE_ES_DA prices next to CARBON_INT_DE or CARBON_INT_EU values for the same date. Use GET /timeseries for longer context and to compute rolling averages of intensity. The sandbox lets product managers preview location-based emissions exposure and decide which KPIs resonate before you integrate internal consumption data.
3) Wholesale cost simulator for retail UX prototyping
Start with POST /cost-estimate for a quick monthly estimate using OMIE_ES_DA or PVPC_ES_2TD. Add GET /electricity/pvpc to power an hourly “what-if” slider that scales consumption per hour against the reference curve. Use GET /fluctuation to summarize MoM changes for copywriting (“Your estimated wholesale cost increased 5.2% this month”). Behind the scenes, GET /status guards the simulator from stale data with a banner when providers are delayed.
Developer Reliability, Performance, and Governance Best Practices
A sandbox should behave like production in the ways that matter: reliability, latency, and control. Here are patterns that keep your prototype resilient without over-engineering.
- Retries and backoff: For transient network hiccups or 429 rate responses, implement exponential backoff with jitter. The API signals 429 explicitly; respect Retry-After when provided and widen the backoff window for category endpoints that fan out to multiple providers.
- Circuit breakers: If GET /status reports a provider as degraded, temporarily suspend calls that depend on that provider and switch to cached values with a UI banner (“Data delayed from source – showing last good value from 12:45 UTC”).
- Deterministic fallback days: GET /historical returns the most recent prior publication when you select a weekend or holiday. Lean on that behavior to keep your test schedules simple; you don’t need market-specific calendars for early-stage work.
- Regional routing and latency: Coalesce multi-commodity requests into one call (e.g., GET /latest with multiple symbols) to reduce roundtrips. Cache OHLC aggregates and timeseries window slices that drive charts.
- Observability: Record success flags, durations, and provider statuses from GET /status. Surface a health widget in your internal tools so non-engineers see when data pipelines are green.
- Governance: Assign separate application credentials per service or team. Enforce least privilege via internal routing and audit logs on your side; rotate credentials routinely and isolate sandboxes from production stores.
These patterns accelerate your path from demo to production by removing the “unknowns” that commonly derail data integrations late in the cycle.
Comprehensive Endpoint Overview and Practical Guidance
Below is a reference-style survey of the primary endpoints and how to use them effectively in a sandbox and beyond. Along the way, we’ll emphasize parameters, error modes, and practical field usage. Where relevant, we include code examples in cURL and either Python or JavaScript to help you wire clients with minimal friction.
Symbols: GET /symbols
Purpose: discover what’s available, filter by category, and retrieve metadata used to render symbol pickers and tooltips.
- Params: base (currency code, optional), category (gas|electricity|oil|coal|carbon_intensity), provider (fred|omie|eex)
- Business value: prevent invalid inputs, speed up onboarding via auto-complete, and centralize symbol metadata in your UI.
Field tips:
- frequency guides chart bucket size; if hourly or 15-min curves are present for a symbol (via electricity endpoints), keep your tooltip and axis consistent.
- country_code improves localization, flagging, and sorting by geography.
Latest: GET /latest
Purpose: show at-a-glance market state across multiple commodities. Reduces roundtrips and simplifies caching.
- Params: symbols (comma-separated), base (optional), category (optional).
- Business value: one snapshot to power alert checks, dashboards, and watchlists.
Best practices:
- Cache results briefly (e.g., 30–60 seconds) for UI smoothness.
- Use dates per symbol for correct staleness badges in mixed-asset views.
Historical: GET /historical
Purpose: run event studies and backfills for specific dates. Deterministic prior-value fallback avoids weekend failures.
- Params: date (YYYY-MM-DD), symbols, base (optional).
- Business value: stable backtesting and reproducible snapshots across mixed markets.
Timeseries: GET /timeseries
Purpose: feed charts and machine learning features with a contiguous slice of history for one or more symbols.
- Params: start, end, symbols, base (optional).
- Business value: minimal ETL for cross-commodity comparisons in a uniform schema.
Implementation tip: hydrate charts with only the window in view, and fetch extended history on-demand to keep your sandbox responsive.
Fluctuation: GET /fluctuation
Purpose: efficient summary of period changes to drive headlines, badges, and alert context.
- Params: start, end, symbols, base (optional).
- Business value: reduces client-side math and ambiguity around calendar effects.
OHLC: GET /ohlc
Purpose: compress history into weekly, monthly, or quarterly candles. Ideal for volatility analysis, sparkline summaries, and performance comparisons.
- Params: symbols, period (weekly|monthly|quarterly), optional start/end/base.
- Business value: low-latency charting and quick momentum features in prototypes.
Electricity category: GET /electricity/latest, GET /electricity/hourly, GET /electricity/pvpc
Purpose: focus on electricity-specific UX — market boards, hourly/15-min curves, and PVPC references for Spain.
- Params vary per endpoint; hourly and pvpc require a date and/or symbol.
- Business value: fast scaffolding for retail and operator dashboards.
Gas, Coal, Emissions shortcuts: GET /gas/latest, GET /coal/latest, GET /emissions/latest
Purpose: fetch the most watched benchmarks in a single, simple call. Ideal for tiles and alert seeds.
Carbon Intensity: GET /carbon-intensity
Purpose: power ESG overlays and policy dashboards. Often paired with electricity curves to contextualize consumption footprints.
Forecast: GET /forecast
Purpose: retrieve the next published day-ahead auction price for applicable electricity symbols. Deterministic lookup — not a predictive model — which is perfect for operations UIs that must reflect published results precisely.
Cost Estimate: POST /cost-estimate
Purpose: give product and design a fast way to test pricing flows with realistic wholesale numbers. Your engineering later can plug in a full tariff engine without breaking the front-end contract.
Status: GET /status
Purpose: monitor provider health to inform retries, backoff, and UI banners. Treat this as a first-class signal in your sandbox and production.
Implementation Examples (cURL, Python, JavaScript)
A few quick code snippets for common workflows.
Multi-commodity snapshot (cURL)
curl -G https://energy-api.com/api/v1/latest \
--data-urlencode "symbols=BRENT_CRUDE,TTF_GAS,EUA_CO2,OMIE_ES_DA" \
--data-urlencode "api_key=YOUR_API_KEY"
Fetch and plot timeseries (Python)
import requests
import datetime as dt
BASE = "https://energy-api.com/api/v1"
params = {
"start": "2025-01-01",
"end": "2025-03-31",
"symbols": "BRENT_CRUDE,TTF_GAS,EUA_CO2",
"api_key": "YOUR_API_KEY"
}
r = requests.get(f"{BASE}/timeseries", params=params, timeout=30)
data = r.json()
if not data.get("success"):
raise RuntimeError(data.get("error", "Unknown error"))
series = data["rates"]["TTF_GAS"]
# series looks like: {"2025-01-02": 46.80, "2025-01-03": 47.10, ...}
# Bind directly to your plotting library or compute rolling stats here.
Hourly electricity curve (JavaScript, fetch)
async function loadHourly(symbol, date) {
const url = new URL("https://energy-api.com/api/v1/electricity/hourly");
url.searchParams.set("symbol", symbol);
url.searchParams.set("date", date);
url.searchParams.set("api_key", "YOUR_API_KEY");
const res = await fetch(url.toString(), { method: "GET" });
const json = await res.json();
if (!json.success) {
throw new Error(json.error || "Failed to load hourly data");
}
return json.values; // [{ time, price }, ...]
}
loadHourly("OMIE_ES_DA", "2026-06-11")
.then(values => console.log(values))
.catch(err => console.error(err));
Error Handling and Troubleshooting
Good sandboxes make failure modes visible and teach production-safe behaviors early. Here’s how to handle common scenarios.
- 401 — Missing or invalid credentials: verify request parameters and transport. In client apps, display a friendly message and pause polling.
- 404 — No data for given symbols or date: for historical weekend requests, switch to GET /historical and rely on the prior-value fallback. For GET /forecast, a 404 likely means the symbol isn’t auction-based.
- 422 — Validation errors: sanitize inputs, ensure date formats are YYYY-MM-DD, and confirm symbol names via GET /symbols.
- 429 — Rate limit exceeded: implement exponential backoff with jitter and respect server hints. De-duplicate requests across tabs; batch symbols where possible.
Error shape example:
{
"success": false,
"error": "Human-readable message."
}
Observability tips:
- Log success, request duration, and the provider statuses from GET /status to a simple dashboard.
- Add a “Data Freshness” badge backed by the per-symbol dates returned from GET /latest and GET /timeseries.
FAQ
How often does the TTF gas price update?
TTF_GAS is provided as a daily time series aligned to official publication schedules. Use GET /latest for the most recent value and GET /timeseries to analyze the daily history window. For summaries, GET /fluctuation computes period changes without manual joins.
Can I get historical energy prices going back 5 years?
Use GET /timeseries with start and end dates to retrieve history for supported symbols. For specific snapshots, GET /historical returns exact-date values with prior-day fallback on non-publishing dates. Combine with GET /ohlc to compress long spans into weekly or monthly candles for fast charting.
Does the API support multiple commodities in the same request?
Yes. Endpoints like GET /latest and GET /timeseries accept multiple symbols across categories (oil, gas, electricity, coal, carbon, carbon intensity). The response includes per-symbol currencies and dates so you can preserve units and freshness in mixed dashboards.
How do I get Spanish PVPC hourly prices for a specific day?
Call GET /electricity/pvpc with the target date. You’ll receive hourly values suitable for retail UX prototypes, cost comparisons, and user education around time-of-use effects.
What should I do if a data provider is delayed?
Poll GET /status to detect provider health. If degraded, display a “Data delayed” banner, serve cached values, and apply exponential backoff. When the provider returns to “ok,” resume normal polling and refresh the affected tiles automatically.
Conclusion + CTA
The fastest way to accelerate developer onboarding in energy data is to erase fragmentation at the source. By building your sandbox on a single, normalized interface, you eliminate the category-specific ETL traps that otherwise dominate sprint after sprint. With Energy API, your team can query oil, gas, electricity, coal, carbon allowances, and grid carbon intensity using the same schema, the same fields, and the same mental model.
Start with discovery via GET /symbols, ship a cross-commodity snapshot with GET /latest, anchor your charts with GET /timeseries, and bring your electricity UX to life with GET /electricity/hourly and GET /electricity/pvpc. Add GET /fluctuation for instant deltas, GET /ohlc for volatility views, POST /cost-estimate for rapid pricing experiments, and GET /status to make reliability visible. These building blocks compress the path from idea to working prototype so you can validate features earlier and iterate with confidence.
If you’re ready to assemble a developer sandbox that behaves like production — without the integration burden — start here: Energy API. Kick the tires, wire your first widgets, and ship something useful this week: Try Energy API for free.
Ready to get started?
Get your API key and start querying energy commodity prices in minutes.
Get API KeyRelated posts
Unlock the potential of your energy startup with our guide on using Energy API for rapid prototyping. Streamli...
Read more →
Unlock the power of Energy API to build accurate energy forecasting models. Discover how to streamline data an...
Read more →
Discover how to leverage Energy API to enhance smart building technologies and improve energy efficiency. Unlo...
Read more →
Discover how to streamline energy data access with Energy API in our developer's guide. Unlock innovation in b...
Read more →
Unlock the power of Energy API with our developer's guide to building customized energy analytics dashboards....
Read more →