Website Carbon API

Beginner's Pick Environment / No Auth Required Beginner HTTPS
Free to Use
87 A
Measured Score 0 50 100 Speed 24/30 Consistency 20/20 Security 20/20 Browser access 15/15 Transparency 8/15 TESTED 2026-09-21

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.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://api.websitecarbon.com/b?url=example.com
Result
HTTP 200 · application/json · 57 bytes · compressed
Response time
47 ms (median of 3) · fastest 45 ms
Transport
TLSv1.3 · TLS_AES_256_GCM_SHA384 · certificate issued by Google Trust Services
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Served by
cloudflare
Answered
8 of 8 weekly checks (100%, since 2026-07-31)
Recorded
2026-09-21

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
c integer 0
p integer 100
url string (url) https://example.com/

Captured Response

Captured from a real request to https://api.websitecarbon.com/b?url=example.com on 2026-09-21. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "c": 0,
  "p": 100,
  "url": "https://example.com/"
}

Field Reference

url The URL that was analyzed

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://api.websitecarbon.com/b?url=example.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.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-09-21. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist application/json
{}
HTTP 500 Sending an invalid value for "url" text/plain
error code: 1101

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

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

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 24/30
Consistency 20/20
Security 20/20
Browser access 15/15
Transparency 8/15
Endpoint Response Time 47ms

Fully tested on Sep 21, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Environment
Difficulty Beginner
Endpoint last called: 2026-09-21

Related Tags

Similar APIs

View All →