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

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

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 20/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 45ms

Fully tested on Apr 5, 2026

Technical Specifications

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

Similar APIs

View All →