Climate Change API
The Climate Change API returns live grid and emissions data in a JSON response. It includes CO2 intensity, current CO2 output, energy source percentages, and a summary of energy mix values.
Response Format
All successful responses are returned in JSON format.
{
"credit": "API Data from <a href='https://dev.tylermwise.uk/v1/v1/climatechange'>tylermwise.uk</a>",
"CO2_intensity": "moderate",
"CO2": "166 gCO2eq/kWh",
"biomass": "7.6%",
"coal": "0%",
"imports": "20.1%",
"gas": "35%",
"nuclear": "12.5%",
"other": "0%",
"hydro": "0%",
"solar": "1.2%",
"wind": "23.6%",
"summary": {
"renewable_energy": "24.8%",
"fossil_fuels": "35%",
"nuclear": "12.5%",
"other": "27.7%"
}
}
Response Fields:
credit(string) - Attribution text for the API source, returned as HTML.CO2_intensity(string) - Current CO2 intensity level, such as low, moderate, or high.CO2(string) - Current CO2 value in gCO2eq/kWh.biomass(string) - Biomass energy percentage.coal(string) - Coal energy percentage.imports(string) - Imported energy percentage.gas(string) - Gas energy percentage.nuclear(string) - Nuclear energy percentage.other(string) - Other energy sources percentage.hydro(string) - Hydroelectric energy percentage.solar(string) - Solar energy percentage.wind(string) - Wind energy percentage.summary(object) - High-level energy mix summary.
Authentication Methods
This endpoint is publicly accessible and does not require authentication.
Characteristics:
- No authentication required
- JSON response format
- Live energy and emissions data
- Useful for dashboards and sustainability displays
Usage:
Endpoint
GET /v1/climatechange
Example Request
Example Response
{
"credit": "API Data from <a href='https://dev.tylermwise.uk/v1/climatechange'>tylermwise.uk</a>",
"CO2_intensity": "moderate",
"CO2": "166 gCO2eq/kWh",
"biomass": "7.6%",
"coal": "0%",
"imports": "20.1%",
"gas": "35%",
"nuclear": "12.5%",
"other": "0%",
"hydro": "0%",
"solar": "1.2%",
"wind": "23.6%",
"summary": {
"renewable_energy": "24.8%",
"fossil_fuels": "35%",
"nuclear": "12.5%",
"other": "27.7%"
}
}
PHP Usage
Fetch API Data
<?php
$contents = file_get_contents("https://api.tylermwise.uk/v1/climatechange");
$data = json_decode($contents);
?>
Output Common Values
<?php
echo $data->credit;
echo $data->co2_intensity;
echo $data->biomass;
echo $data->coal;
echo $data->gas;
echo $data->nuclear;
echo $data->other;
echo $data->hydro;
echo $data->solar;
echo $data->wind;
?>
Output CO2 Intensity
Output CO2 Value
Output API Credit
Response Fields
| Field | Type | Description |
|---|---|---|
credit | string | Attribution text for the API source. |
CO2_intensity | string | Current CO2 intensity level. |
CO2 | string | Current CO2 value in gCO2eq/kWh. |
biomass | string | Biomass energy percentage. |
coal | string | Coal energy percentage. |
imports | string | Imported energy percentage. |
gas | string | Gas energy percentage. |
nuclear | string | Nuclear energy percentage. |
other | string | Other energy percentage. |
hydro | string | Hydro energy percentage. |
solar | string | Solar energy percentage. |
wind | string | Wind energy percentage. |
summary | object | Summary of the energy mix. |
Notes
- The endpoint returns energy mix and emissions data in a single response.
- The
CO2_intensityfield uses uppercase letters in the latest JSON response. - The
summaryobject groups the main energy mix totals. - If you want to keep backward compatibility, consider supporting both
co2_intensityandCO2_intensityin your docs and client code.
HTTP Status Codes
Standard responses may include:
200- Success.400- Bad Request.429- Too Many Requests.500- Internal Server Error.
Versioning
This page documents version 1 of the Climate Change API, available under the /v1/ path.