API to Get the Great Britain Carbon Intensity Price
You need a reliable way to fetch Great Britain’s real-time grid carbon intensity for Environmental analytics and applications. By the end of this guide, you will know exactly how to call the Energy API for the Great Britain Carbon Intensity symbol, handle authentication, parse the response fields you care about, and implement a robust first request with cURL and Python.
What the Great Britain Carbon Intensity symbol provides
The Great Britain Carbon Intensity symbol reports the grid’s emission intensity—the grams of CO2 emitted per kilowatt-hour of electricity generated. This is critical for environmental monitoring, carbon-aware load shifting, demand response, and accurate Scope 2 calculations.
- Symbol name: Great Britain Carbon Intensity
- Symbol code: CARBON_INT_GB
- Unit: gCO2/kWh
The Energy API’s latest endpoint returns a compact envelope with the values you need for a given symbol list. For CARBON_INT_GB, read the value from rates.CARBON_INT_GB, its timestamp from dates.CARBON_INT_GB, and its unit/currency indicator from currencies.CARBON_INT_GB. The top-level base can be MIXED when your request spans symbols with different units.
Endpoint, authentication, and request shape
Use a simple GET request to the latest endpoint and pass your API key as a query parameter. No headers are required for auth in this flow.
- HTTP method: GET
- URL: https://energy-api.com/api/v1/latest
- Query parameters:
- symbols: a comma-separated list; for this guide, use CARBON_INT_GB
- api_key: your Energy API key
Auth detail: pass the API key as api_key in the query string. Use the placeholder value YOUR_API_KEY in examples and tooling while you wire up your environment.
Plan info for your first test: Starter $19.99/mo with a 7-day / 50 calls trial is available. You can create an account at the link at the end of this article.
Try it now with cURL
The following official sample is copy/paste-ready and uses the Great Britain Carbon Intensity symbol. Replace YOUR_API_KEY with your actual key:
curl -G "https://energy-api.com/api/v1/latest" --data-urlencode "symbols=CARBON_INT_GB" --data-urlencode "api_key=YOUR_API_KEY"
This request will return the most recent observation for CARBON_INT_GB. The primary fields to read are rates.CARBON_INT_GB (numeric intensity, in gCO2/kWh), dates.CARBON_INT_GB (ISO date string), and currencies.CARBON_INT_GB (unit/denomination context for the value). The base field at the top level can be MIXED when symbols have heterogeneous units, which is common in Environment datasets.
Python example: fetch and parse CARBON_INT_GB
This short Python snippet performs the same GET request, checks for success, and extracts the value and timestamp for CARBON_INT_GB. Keep it minimal during your first integration and add your own logging, retries, and metrics later.
import requests
API_URL = "https://energy-api.com/api/v1/latest"
params = {
"symbols": "CARBON_INT_GB",
"api_key": "YOUR_API_KEY"
}
resp = requests.get(API_URL, params=params, timeout=15)
resp.raise_for_status()
data = resp.json()
# Handle explicit success flag when present
if data.get("success") is False:
# Surface the provider message directly to your logs/alerting
raise RuntimeError(f"Energy API error: {data.get('error')}")
# Extract fields specific to the symbol
symbol = "CARBON_INT_GB"
rates = data.get("rates", {})
dates = data.get("dates", {})
currencies = data.get("currencies", {})
value_gco2_per_kwh = rates.get(symbol)
obs_date = dates.get(symbol) # ISO date string for the observation
unit_or_currency = currencies.get(symbol) # Expect gCO2/kWh context in Environment symbols
if value_gco2_per_kwh is None or obs_date is None:
raise ValueError("Missing value or date for CARBON_INT_GB in the response payload.")
print({
"symbol": symbol,
"value_gco2_per_kwh": value_gco2_per_kwh,
"observation_date": obs_date,
"unit_or_currency": unit_or_currency,
"base": data.get("base") # may be MIXED for multi-symbol calls
})
Understanding the response envelope by example
Below is an official successful response sample from the live system. It demonstrates the response envelope you should code against, including top-level success, date, base, and nested rates/dates/currencies. The symbol shown is a different Environment listing, but the structure is identical to CARBON_INT_GB calls. Code to these exact field names.
{
"success": true,
"date": "2026-10-27",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 206.8894
},
"dates": {
"OMIE_ES_DA": "2026-10-27"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
Field mapping you must handle in code:
- success: Boolean when present; check it before reading values.
- date: A top-level reference date for the payload (not a per-symbol timestamp).
- base: A base unit or denomination for the set; may be MIXED when symbols differ in their unit contexts.
- rates: A map keyed by symbol code. For CARBON_INT_GB, read rates.CARBON_INT_GB.
- dates: A map keyed by symbol code with the symbol’s observation date. Read dates.CARBON_INT_GB.
- currencies: A map keyed by symbol code for unit/denomination. Read currencies.CARBON_INT_GB. For carbon intensity, treat it as the unit context (gCO2/kWh).
Current catalog status for CARBON_INT_GB
At the time of writing, the live request for CARBON_INT_GB returns the following error envelope. Do not treat this as a transport failure; it is an application-level response signaling catalog availability. Your integration should branch on success and handle this case gracefully.
{"success":false,"error":"Symbol CARBON_INT_GB is not currently available. See \/api\/v1\/symbols for the current catalog."}
Recommended handling:
- Log the error message as-is for operational visibility.
- Fallback to a cached last-known value if your UX requires continuity (mark it stale clearly).
- Surface a user-facing note that the symbol is temporarily unavailable and link to your status/help page.
Schema walkthrough using the same official sample
This second copy of the official success sample is here so you can map, test, and validate your JSON parsing (e.g., unit tests) against a complete, known-good envelope without altering values. Keep your parser robust to fields like base_filter_note and missing_symbols, which can be null.
{
"success": true,
"date": "2026-10-27",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 206.8894
},
"dates": {
"OMIE_ES_DA": "2026-10-27"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
Key robustness guidelines for your parser:
- Never assume a symbol is present; check missing_symbols if provided and verify the dictionary keys exist before reading.
- Do not assume a single base across Environment symbols; base can be MIXED.
- Treat currencies as unit context for environmental metrics; your UI labels should use the unit (gCO2/kWh for CARBON_INT_GB).
Troubleshooting and guardrails for Environment data
1) Success flag vs HTTP status
The API may return HTTP 200 with success=false when a symbol is not available. Always inspect the success field and error message before parsing rates.
2) Mixed-base responses
When fetching multiple Environment symbols, the top-level base may be MIXED. Do not coerce or assume a common base across carbon, price, or other heterogeneous measures. Read currencies[symbol] for the per-symbol unit label.
3) Units and precision
CARBON_INT_GB is reported in gCO2/kWh. Display this unit explicitly in any chart legend or tooltip. If you smooth or aggregate values, keep unit consistency and document your method next to the plot or value.
4) Authentication and key management
Use the api_key query parameter exactly as shown. Store YOUR_API_KEY securely (environment variables or your secrets manager). Do not log full URLs with the key in production logs.
5) Catalog changes
Symbols can be added, renamed, or temporarily unavailable. Build a lightweight “catalog check” into CI or on application boot and alert when a production symbol returns success=false. The JSON error above is a good example to test against.
6) Request frequency and caching
Carbon intensity does not change every second. Cache responses server-side for a sensible interval according to your UX and the provider’s update cadence. This reduces calls and smooths transient availability gaps.
7) Combining multiple Environment symbols
If later you request multiple Environment symbols in one call, always parse each key within rates, dates, and currencies individually. Do not pass base=USD when you also need TTF_GAS or EUA_CO2; keep Environment requests clean and avoid cross-category currency coercion.
Production template for your integration
Use this checklist to reach production readiness with CARBON_INT_GB:
- Endpoint: GET /api/v1/latest
- Symbols parameter: CARBON_INT_GB
- Auth: api_key=YOUR_API_KEY (query parameter)
- Fields to read:
- rates.CARBON_INT_GB → numeric value (gCO2/kWh)
- dates.CARBON_INT_GB → ISO date string for the observation
- currencies.CARBON_INT_GB → unit context (expect gCO2/kWh for this symbol)
- Top-level metadata:
- success → gate parsing
- base → may be MIXED when querying multiple differing units
- Error handling:
- Check success=false and error message
- Fallback to cached value or communicate unavailability
- Test coverage:
- Successful parse against the official sample envelope
- Error parse against the CARBON_INT_GB “not currently available” JSON
End-to-end flow: call, parse, and render
Put together, your service should:
- Issue a GET to /api/v1/latest with symbols=CARBON_INT_GB and api_key.
- Check HTTP status, then check data.success. If false, branch to error flow.
- Read data.rates.CARBON_INT_GB (float), data.dates.CARBON_INT_GB (string), and data.currencies.CARBON_INT_GB (unit label).
- Persist the raw JSON and a normalized record with a TTL appropriate to your UI refresh rate.
- Render the numeric value with unit “gCO2/kWh” and the observation date. Make base visible only if you show multi-symbol views.
Additional JSON example: official envelope (use for unit tests)
Use the following official sample as a fixture for parser tests that assert field presence and typing. It is identical to the earlier success envelope, included here to ensure your test suite has a stable copy to import without network calls.
{
"success": true,
"date": "2026-10-27",
"base": "EUR",
"rates": {
"OMIE_ES_DA": 206.8894
},
"dates": {
"OMIE_ES_DA": "2026-10-27"
},
"currencies": {
"OMIE_ES_DA": "EUR"
},
"base_filter_note": null,
"missing_symbols": null
}
Operational notes that save time
- Time zone: Treat dates.* as date strings (no time component) unless you normalize to your app’s time zone. Keep user-facing labels clear about the observation date.
- UI formatting: Always append “gCO2/kWh” next to the numeric value for CARBON_INT_GB. Avoid ambiguous labels like “intensity.”
- Backfill: If you snapshot values periodically, tag each record with the API’s dates.CARBON_INT_GB and your ingest timestamp for audit.
- Alerts: Create a simple threshold-based alert (e.g., value rises above a chosen gCO2/kWh level) with hysteresis to avoid alert storms on noisy data.
Frequently asked questions
Q1: Which fields do I read for CARBON_INT_GB?
Read rates.CARBON_INT_GB for the numeric intensity in gCO2/kWh, dates.CARBON_INT_GB for the observation date, and currencies.CARBON_INT_GB for unit context. The top-level base may be MIXED when multiple symbols are requested.
Q2: How do I authenticate?
Pass your key as api_key in the query string. Example: api_key=YOUR_API_KEY. No headers are required for authentication in this flow.
Q3: What should I do if the symbol is not available?
Check success; if false, log the error message and optionally return a cached value to your app. The current live response for CARBON_INT_GB indicates it is not available; build your error path now so production is resilient.
Q4: Can I request multiple Environment symbols in one call?
Yes, pass them comma-separated in symbols. Parse each key in rates, dates, and currencies. Expect base to be MIXED across heterogeneous units; never coerce units implicitly.
Q5: Is there a trial?
Yes, Starter $19.99/mo with a 7-day / 50 calls trial is available. Register and obtain your key to begin testing.
Get your API key and ship your first request
Register for access, grab your API key, and run the cURL command above to wire up CARBON_INT_GB in your Environment workflow. Start here: Register. For field-by-field details and more examples, see the Documentation.
Ready to get started?
Get your API key and start querying energy commodity prices in minutes.
Get API Key