Skip to content

Hreflang Tag Generator API

POST https://api.findutils.com/api/tools/hreflang-tag-generator/execute

Generate hreflang annotations for multilingual pages and return them as HTML <link> tags, an HTTP Link header, and an XML sitemap block, plus validation issues (invalid URL, language, or region code, duplicate language-region pairs, missing x-default). Pass one page group as variants, or several as groups.

Request body

application/json
  • variants

    array optional

    Shortcut for a single page group: array of { language, region?, url, x_default? }. language is an ISO 639-1 code (en, de, tr); region is an ISO 3166-1 alpha-2 code (US, GB).

  • groups

    array optional

    Several page groups: array of { base_url?, variants: [...] }. Each group is one page and its translations.

  • format

    string optional

    Which output to fill. "all" fills html, http_headers, and xml_sitemap; a single format leaves the others empty. Default "all". One of all · html · http · xml. Default "all".

Example arguments

Verified
{
  "variants": [
    {
      "language": "en",
      "region": "US",
      "url": "https://example.com/en-us/",
      "x_default": true
    },
    {
      "language": "de",
      "url": "https://example.com/de/"
    }
  ]
}