Website Carbon API

Beginner's Pick Environment / No Auth Required Beginner HTTPS
Free to Use Varies (check documentation)

Overview

Website Carbon estimates the carbon footprint of loading any web page by analyzing its data transfer size and hosting type. It returns a simple carbon rating so developers can measure the environmental impact of their sites. No API key is required, making it easy to integrate into sustainability dashboards or CI pipelines.

Beginner Tip

Pass any URL as a query parameter to get a carbon estimate — for example, /b?url=example.com. Results are cached for performance, so repeated calls for the same URL return quickly.

Available Data

vehicle make and model
year and specifications
fuel economy
VIN decode data
prediction result with confidence score
input name or text

Example Response

JSON Response
{
  "make": "Toyota",
  "model": "Camry",
  "year": 2025,
  "engine": "2.5L 4-cylinder",
  "fuel_economy": {
    "city_mpg": 28,
    "highway_mpg": 39
  },
  "msrp": 28400
}

Field Reference

url The URL that was analyzed
green Whether the site is hosted on a green (renewable energy) host
bytes Page size in bytes used for the carbon calculation
cleanerThan Percentage of web pages this site is cleaner than (0 to 1 scale)
statistics.co2.grid.grams Estimated CO2 in grams per page view on a standard grid
statistics.co2.renewable.grams Estimated CO2 in grams per page view using renewable energy

Implementation Example

Request
const url = "https://api.websitecarbon.com/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

Invalid URL error Passing a URL without proper encoding or with http:// prefix stripped
URL-encode the parameter value, e.g. ?url=https%3A%2F%2Fexample.com
400 Bad Request Missing the required url query parameter
Always include ?url= followed by the target website address
Stale or cached result The API caches results and may return older data for frequently-queried URLs
Be aware that results reflect the last cached scan, not a real-time fetch every call

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Environment
Difficulty Beginner
Verified: 2026-04-04

Related Tags

Similar APIs

View All →