EU Carbon Intensity API: CARBON_INT_EU as JSON
You need a reliable, machine-readable number for EU grid carbon intensity to power a feature—anything from emissions projections to automated load shifting. By the end of this article, you’ll be able to fetch CARBON_INT_EU as JSON from Energy API, parse it safely, cache it sensibly, and ship it to production with confidence.
What “EU carbon intensity” is (and isn’t)
EU carbon intensity represents the greenhouse gas emissions per unit of electricity delivered, measured as grams of CO2-equivalent per kilowatt-hour (gCO2eq/kWh). This metric is useful for:
- Carbon-aware scheduling and demand response
- Real-time emissions dashboards and compliance reporting
- Scope 2 calculations and product-level carbon accounting
Important: this is not the EUA allowance tick. CARBON_INT_EU returns an intensity value (gCO2eq/kWh), not a carbon price or permit.
Endpoint and request
The Energy API provides a single, simple endpoint for carbon intensity:
- Method: GET
- Path: /api/v1/carbon-intensity
- Primary field to read: rates.CARBON_INT_EU
- Unit field: unit (expected gCO2eq/kWh)
Copy your API key from your account, then call the endpoint as shown below. The example request is the canonical form—use the same authentication and headers you see here.
curl "https://energy-api.com/api/v1/carbon-intensity?api_key=YOUR_API_KEY"
Sample response and how to read it
The following is the official live response example. Note that the print is dated 2026-08-01, not “today.” Use the response you receive at request time in your application, not the example’s date.
{"success": true, "date": "2026-08-01", "base": "CO2", "rates": {"CARBON_INT_EU": 215.99}, "dates": {"CARBON_INT_EU": "2026-08-01"}, "unit": "gCO2eq/kWh"}
What you will typically read from the payload:
- rates.CARBON_INT_EU: the numeric carbon intensity value you need for EU electricity. Store and use this for computations, alerts, and dashboards.
- unit: the unit string for the numeric value. According to the API, this is gCO2eq/kWh. Persist this alongside the value so you can display context and validate conversions.
If additional metadata fields are present in your live response (such as timestamps), prefer those for display and sorting. If they are absent, keep your own retrieval timestamp to aid debugging and cache invalidation.
Go live in four steps
- Register for the 7-day trial: Register (Starter $19.99/mo, 7-day trial / 50 calls).
- Copy your api_key from the dashboard.
- Call GET /api/v1/carbon-intensity using your key.
- Parse and store rates.CARBON_INT_EU along with unit.
A minimal client: parse, validate, cache
The snippet below shows how to call the same endpoint programmatically and safely read the values you actually need. It demonstrates:
- Reading rates.CARBON_INT_EU and unit
- Handling HTTP errors and missing fields defensively
- Basic in-memory caching to avoid unnecessary calls
JavaScript (Node.js or modern browsers)
// Replace YOUR_API_KEY with your real key.
// Use the same URL you see in the curl above.
const API_KEY = "YOUR_API_KEY";
const URL = /* paste the exact URL from the curl request above */ "";
let cache = {
value: null,
unit: null,
fetchedAt: 0,
};
async function getCarbonIntensityEU({ minCacheMs = 60_000 } = {}) {
const now = Date.now();
if (cache.value !== null && (now - cache.fetchedAt) < minCacheMs) {
return { value: cache.value, unit: cache.unit, cached: true };
}
const res = await fetch(URL, {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`, // or the same auth used in the curl above
"Accept": "application/json",
},
});
if (!res.ok) {
// HTTP-level failure: do not assume JSON shape
throw new Error(`Request failed with status ${res.status}`);
}
const data = await res.json();
// Defensive parsing: validate presence of rates and CARBON_INT_EU
if (!data || typeof data !== "object") {
throw new Error("Malformed JSON response");
}
const rates = data.rates;
const unit = data.unit;
if (!rates || typeof rates.CARBON_INT_EU === "undefined" || unit == null) {
// Handle missing values explicitly
throw new Error("Missing rates.CARBON_INT_EU or unit in response");
}
// Persist what you will display or compute with
cache = {
value: rates.CARBON_INT_EU,
unit,
fetchedAt: Date.now(),
};
return { value: cache.value, unit: cache.unit, cached: false };
}
// Example usage:
getCarbonIntensityEU()
.then(({ value, unit, cached }) => {
console.log(`EU Carbon Intensity: ${value} ${unit} ${cached ? "(cached)" : ""}`);
})
.catch((err) => {
console.error("Failed to load carbon intensity:", err.message);
});
Error handling and missing values
Design your client to be resilient to both transport and data issues:
- HTTP errors: if the response code indicates failure, back off and retry with exponential delays. Log the status code and response body for triage.
- API-level failure: if the response indicates failure (for example, via a boolean flag or structured error field), do not assume a partial payload is usable. Surface the error and avoid stale updates.
- Missing data: if rates or rates.CARBON_INT_EU is absent, skip updates and retain the last known-good value with a TTL. Alert if the condition persists.
- Unit safety: always read and store unit alongside the value. Do not hardcode the unit string in downstream systems.
Units, dates, and timezones
- Units: the carbon intensity is provided in gCO2eq/kWh. Keep it as-is for display and conversions.
- Currency: not applicable here—this is an intensity metric, not a price.
- Dates and timezones: the official sample is live and dated 2026-08-01, but that example is not “today.” When you call the API, prefer any timestamp fields returned by the API for display, logging, and cache control. If a timestamp is not provided, use your retrieval time (UTC) and store it with the reading.
Caching and rate usage
Carbon intensity typically changes on the order of minutes, not milliseconds. Cache responses to:
- Reduce latency for your UI
- Stay within your trial call allocation
- Protect your service from transient upstream failures
Pick a cache TTL that fits your use case, then document it. For strict freshness, enable a manual “refresh” action in operational tools so on-call engineers can force an update if needed.
Testing and observability
- Use a clear separation between “last-known-good value” and “latest attempted fetch.” Update the former only on successful parses.
- Log the full request path and a hash of the response body for quick diffing without storing sensitive headers.
- Alert on repeated parse failures or prolonged reuse of stale data.
Why CARBON_INT_EU matters in real apps
With a single field—rates.CARBON_INT_EU—you can:
- Label energy-heavy workflows with current emissions intensity
- Trigger batch jobs when intensity dips below your threshold
- Backfill Scope 2 estimates when high-resolution metering is unavailable
Because the payload includes unit, you can normalize across other regions or series you may add later without guessing or hardcoding assumptions.
Developer checklist before production
- Authentication: confirm your api_key is loaded securely and rotated periodically.
- Parsing: validate presence of rates, rates.CARBON_INT_EU, and unit before using values.
- Caching: implement a TTL and a manual refresh path.
- Fallbacks: on failure, serve last-known-good data with an on-screen “as of” time.
- Monitoring: track success rate, average latency, and streaks of stale reads.
Read CARBON_INT_EU as JSON
You can start reading CARBON_INT_EU as JSON in minutes. Register, copy your key, call GET /api/v1/carbon-intensity, and persist rates.CARBON_INT_EU and unit. If you prefer to explore parameters and nuanced behavior first, browse the Documentation. When you’re ready, start your trial here: Register.
FAQ
Is CARBON_INT_EU the same as the EUA carbon allowance?
No. CARBON_INT_EU is an emissions intensity metric in gCO2eq/kWh, not a price tick for EU Allowances.
Which fields should I persist?
Persist rates.CARBON_INT_EU and unit. Also store your retrieval timestamp so you can display “as of” metadata and manage cache TTLs.
How do I handle errors from the API?
Treat non-2xx responses as failures and log them. If the response indicates a failure state, don’t consume partial data—keep your last-known-good value and try again later.
What timezone are the values in?
Use any timestamp fields returned by the API for display. If none are present, record your own retrieval time in UTC next to the value.
Can I try this without paying?
Yes. The Starter plan includes a 7-day trial with 50 calls.
Ready to ship? Create your account, grab your api_key, and read CARBON_INT_EU as JSON today: Register. If you need more context first, the full API reference is here: Documentation.
Ready to get started?
Get your API key and start querying energy commodity prices in minutes.
Get API Key