All Tools

  1. SEORCH
  2. SEO API
  3. Hreflang API

Hreflang API

Request

Checks the hreflang tags of a page or XML sitemap: language codes, status and canonical of all alternates and whether they link back.

https://seorch.net/api/hreflang/?key=YOUR_KEY&url=https://www.apple.com/de/

Parameters

ParametersRequiredMeaning
keyyesYour API key, alternatively in the X-API-Key header
urlyesA page or XML sitemap

Response

FieldMeaning
found, sourceWhether tags were found and where: html, http_header or sitemap
alternatesUp to 30 alternates with lang, url, http_status, canonical_matches, links_back
errorsErrors found with code: invalid_lang_code, relative_url, bad_status, canonical_mismatch, no_return_link, no_self_reference, sitemap_conflict
truncatedtrue if not all alternates were checked
Sample response, shortened
{
  "api_version": 1,
  "url": "https://www.apple.com/de/",
  "url_effective": "https://www.apple.com/de/",
  "used_headless": false,
  "type": "page",
  "source": "html",
  "robots_txt": {
    "url": "https://www.apple.com/robots.txt",
    "found": true,
    "sitemaps": [
      "https://www.apple.com/shop/sitemap.xml"
    ]
  },
  "canonical": "https://www.apple.com/de/",
  "found": true,
  "alternates": [
    {
      "lang": "en-us",
      "url": "https://www.apple.com/",
      "valid_code": true,
      "absolute_url": true,
      "http_status": 200,
      "canonical": "https://www.apple.com/",
      "canonical_matches": true,
      "hreflang_count": 137,
      "links_back": true
    }
  ],
  "truncated": true,
  "errors": []
}

Errors

Errors are returned as JSON with a fixed code. All APIs use missing_key and invalid_key (401), rate_limited (429) and missing or invalid parameters (400). Additionally for this API: url_not_allowed, url_unreachable, bad_status.

Limits

Each key allows 10 requests per minute and 500 per day. Higher limits are available on request.