Skip to main content

Page Weight API

developer
GET/v1/domain/page-weight

Analyzes total page size and resource breakdown including JavaScript, CSS, images, fonts, render-blocking resources, and estimated load times across different network speeds.

What It Does

Fetches the page and all its resources, measuring the size of each resource type. Breaks down page weight by JavaScript, CSS, images, fonts, and other assets. Identifies render-blocking resources, lists the largest resources, and estimates load times for slow 3G, regular 4G, and broadband connections.

Why It's Useful

Page weight directly impacts load time, data costs, and Core Web Vitals. Understanding which resource types contribute most to page weight helps prioritize optimization efforts for the biggest impact.

Use Cases

Frontend Developer

Performance Optimization

Identify the largest resources and resource types contributing to slow page loads.

Focus optimization on the highest-impact resource types.

Performance Engineer

Budget Monitoring

Track page weight over time to ensure it stays within performance budgets.

Prevent page bloat from creeping in with new features.

Mobile Developer

Mobile Optimization

Analyze page weight with estimated load times on 3G/4G to ensure acceptable mobile performance.

Optimize for mobile users on slower connections.

Parameters

NameLocationTypeRequiredDescription
domainquerystringRequiredDomain or full URL — accepts `example.com` or `https://example.com/path`.Example: https://example.com

Response Fields

Result fields below are inside the JSON data object. Any row named meta describes the sibling response metadata object. See response and error handling for status codes and error responses. Optional observations may be absent or null; inspect warnings and partial-failure fields before treating a missing result as a negative finding.

FieldTypeDescription
domainstringThe analyzed domain (bare hostname).
urlstringFull URL that was fetched, echoing the protocol used in the request.
coveragestringAnalysis coverage indicator — "static-html-only". JavaScript-injected resources are not visible to non-rendering analysis
totalSizeBytesnumberTotal page size in bytes
totalSizeFormattedstringHuman-readable total size
htmlSizeBytesnumberHTML document size in bytes
breakdownobjectSize breakdown by resource type (JS, CSS, images, fonts, media, other) with percentages
resourcesMetaobjectResource extraction metadata (extracted, analyzed, failed, unmeasuredCount, truncated)
compressionobjectPer-resource compression coverage — { compressed, uncompressed, unknown, uncompressedExamples }
byOriginarrayPer-origin breakdown — { origin, count, sizeBytes, percentage, isThirdParty }. Reveals third-party weight
lcpCandidateobjectHeuristic LCP candidate from above-the-fold HTML — { url, type, sizeBytes, sizeFormatted, hasFetchPriorityHigh, isPreloaded }
imageFormatAuditarrayJPEG/PNG/GIF >50KB that could be served as AVIF/WebP — typical 30–50% savings
fontDisplayCoverageobject@font-face audit across external CSS — { cssScanned, withFontDisplay, fontResourcesFound, missingDisplay[] }
requestCountnumberTotal number of HTTP requests
renderBlockingobjectRender-blocking resources — { count, resources, largest } where largest is the prime optimization target
largestResourcesarrayTop resources by size with URLs
estimatedLoadTimeobjectEstimated load times for 3G, 4G, broadband, with protocolModel (http1 vs http2-or-3) accounting for connection multiplexing
scorenumberPage weight score 0-100
gradestringLetter grade A-F
breakdown_scoresobjectIndividual score components with details
recommendationsarrayOptimization suggestions tied to detected issues (uncompressed assets, legacy image formats, third-party weight, missing font-display, blocking JS)

Code Examples

Replace YOUR_API_KEY with your API key. This endpoint requires the developer plan or higher; see plans and usage limits.

cURL
curl --request GET 'https://api.edgedns.dev/v1/domain/page-weight?domain=https%3A%2F%2Fsiteproxy.ruqli.workers.dev%3A443%2Fhttps%2Fexample.com' \
  --header "Authorization: Bearer YOUR_API_KEY"
JavaScript
const response = await fetch(
  "https://api.edgedns.dev/v1/domain/page-weight?domain=https%3A%2F%2Fsiteproxy.ruqli.workers.dev%3A443%2Fhttps%2Fexample.com",
  {
    "method": "GET",
    "headers": {
      "Authorization": "Bearer YOUR_API_KEY"
    }
  }
);

if (!response.ok) {
  throw new Error(`EdgeDNS returned HTTP ${response.status}`);
}
const data = await response.json();
console.log(data);
Python
import requests

response = requests.request(
    'GET',
    "https://api.edgedns.dev/v1/domain/page-weight?domain=https%3A%2F%2Fsiteproxy.ruqli.workers.dev%3A443%2Fhttps%2Fexample.com",
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    timeout=60,
)
response.raise_for_status()
data = response.json()
print(data)

Read the full Page Weight guide

Learn the concepts, choose a practical workflow, and interpret the observations from Page Weight before acting on them. Run supported checks via MCP or through REST.

Read the guide →

Related Endpoints

External References

Learn more about the standards and protocols behind this endpoint.

Try This Endpoint

Test the Page Weight endpoint live in the playground.

Page Weight API Reference | EdgeDNS