Endpoints
The /data endpoint is the only endpoint we offer for public access.
While we make this API available to use to increase awareness and understanding of sustainability on the web, we aren't currently able to guarantee technical support beyond this page, and these endpoints and the structure of the responses can change without notice.
The data endpoint: /data
/data?bytes={0000000}&green={1/0}
An endpoint to calculate the emissions of a page by manually passing the bytes and whether or not it is powered by green hosting.
Accepted parameters
- bytes as an integer that is required
-
The number of bytes transferred by the page on load.
- green as an integer that is required
-
Whether the site is using environmentally sustainable hosting.
This should be either 1 (if it is using green hosting) or 0 (if it is not using green hosting).
- legacy as an integer
-
A flag to attempt to return the statistics object based on an outdated calculation model.
Note that this will only affect the statistics object. The top level values will all be calculated using the latest model.
The only valid values for this are 2 or 3, relating to the methodology and calculations being used up to 19 April 2022 and July 2024 respectively.
Details about the latest model can be found in in the How does it work? part of our Website Carbon Calculator site.
Successful response
- bytes as a number
-
Number of bytes you passed to the endpoint.
- green as a number
-
The green hosting flag you passed to the endpoint.
- gco2e as an number
-
The emissions in grams of CO2.
- rating as a string
- statistics as an object
- cleanerThan as a number
-
A numeric value between 0 and 1 representing the percentage - 1 is 100% - of pages that this result's emissions are lower than.
This is in comparison to average transfer size of pages from HTTP Archive. For more detail see the percentile data mentioned see Sustainable Web Design's explainer page.
Example good request
https://api.websitecarbon.com/data?bytes=12345678&green=1
Example successful response
{
"bytes": 12345678,
"green": true,
"gco2e": 1.0506427318758333,
"rating": "F",
"statistics": {
"adjustedBytes": 9320986.89,
"energy": 0.0026042536525055764,
"co2": {
"grid": {
"grams": 1.2865013043377547,
"litres": 0.7155520254726591
},
"renewable": {
"grams": 1.0506427318758333,
"litres": 0.5843674874693384
}
}
},
"cleanerThan": 0.07
}
The site endpoint
As of 14 July 2025 we no longer offer public access to the site endpoint.
The statistics object
The statistics object returned as part of some responses is a result of the calculations performed by the API.
You can find out more about these calculations in the How does it work? part of our Website Carbon Calculator site.
Note that the values in this statistics object are mainly useful for considering different aspects of the emissions; the top level emissions (the top level gco2e value) is the most concise figure.
- adjustedBytes as a number
-
The data transfer of the page load adjusted to take returning visitor caching into account.
Note that this is a reference figure; all the calculated emissions (i.e. gCO2e values) have factored in returning visitor caching.
- energy as a number
-
The approximate amount of energy required for each page load in kWh.
- co2 as an object
-
An object containing data relating to CO2 emissions from each page load.
This is currently offered as two separate options: renewable and grid. These relate to whether the energy used as part of the page load is renewable or from the national grid respectively.
Note that this is a reference figure for context; the top level emissions have been calculated based on the green hosting status (green = renewable here).
The value of both the renewable and grid options are objects:
- grams as a number
-
The approximate CO2 emissions from the page load in grams
- litres as a number
-
The CO2 in grams converted to litres.
The website carbon calculator
We power https://www.websitecarbon.com/.