Skip to main content

Canonical URL

free
GET/v1/domain/canonical

Comprehensive canonical URL audit: extracts canonical tags from HTML and HTTP headers, validates placement, checks for conflicts, analyzes hreflang annotations, detects redirect chains, and cross-references with og:url. Returns a scored assessment with actionable SEO recommendations.

What It Does

Fetches the page with redirect tracking, parses both HTML <link> tags and HTTP Link headers for canonical URLs, validates tag placement in <head>, detects multiple/conflicting canonicals, checks og:url consistency, analyzes hreflang annotations, and grades the overall canonical configuration.

Why It's Useful

Canonical URLs tell search engines which version of a page to index. Incorrect canonicals — duplicates, conflicting signals, wrong placement, or cross-domain misconfigurations — can cause indexing failures and lost rankings. This endpoint catches all common canonical issues in a single request.

Use Cases

SEO Specialist

SEO Audit

Verify canonical URLs are correctly set across the site to prevent duplicate content issues.

Catch critical issues like multiple canonicals, body placement, and og:url mismatches that tools like Screaming Frog would flag.

Global Marketing Manager

International SEO

Verify hreflang annotations correctly link language/region versions and include x-default.

Ensure correct regional versions appear in local search results with validated language codes.

SEO Engineer

Site Migration

After migration, verify canonical URLs point to the new domain and redirect chains are clean.

Detect cross-domain canonicals, redirect chains, and HTTP/HTTPS mismatches before they impact rankings.

DevOps Engineer

Continuous Monitoring

Integrate into CI/CD to catch canonical regressions before deployment.

Prevent SEO-breaking changes from reaching production using the score and grade system.

Parameters

NameTypeRequiredDescription
domainstringRequiredThe domain to find canonical URL forExample: example.com

Response Fields

FieldTypeDescription
domainstringThe queried domain
requestedUrlstringThe initial URL that was fetched
finalUrlstringThe URL after following all redirects
redirectChainarrayURLs in the redirect chain before reaching final content
canonicalobjectCanonical URL details (url, source, httpHeaderUrl, isAbsolute, isHttps, isSelfReferencing, isCrossDomain, canonicalCount, inHead)
targetValidationobjectCanonical target URL validation (status, isReachable, hasNoindex, isChain, chainTarget, targetRedirected) — null if self-referencing
ogUrlstringThe og:url meta tag value for cross-signal comparison
ogUrlMatchbooleanWhether og:url matches the canonical URL
hreflangobjectHreflang analysis (alternates array, count, hasXDefault)
scorenumberCanonical health score from 0-100
gradestringLetter grade (A-F) based on score
issuesarraySeverity-graded issues with codes and recommendations (critical, warning, info)

Code Examples

cURL
curl "https://api.edgedns.dev/v1/domain/canonical" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "domain=example.com"
JavaScript
const response = await fetch(
  'https://api.edgedns.dev/v1/domain/canonical?domain=example.com',
  {
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  }
);

const data = await response.json();
console.log(data);
Python
import requests

response = requests.get(
    'https://api.edgedns.dev/v1/domain/canonical',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    params={
    'domain': 'example.com'
    }
)

data = response.json()
print(data)

Read the full Canonical URL guide

Why it matters, real-world use cases, parameters, response fields, and how to call it from Claude, ChatGPT, or Gemini via MCP.

Read the guide →

Related Endpoints

External References

Learn more about the standards and protocols behind this endpoint.

Try This Endpoint

Test the Canonical URL endpoint live in the playground.