# Hreflang & Canonical Validator - Bulk Hreflang Audit (`digivibetech/hreflang-canonical-validator`) Actor

Check hreflang across pages or a whole sitemap: return links between every language version, self-references, x-default, language and region codes, canonical conflicts, noindex and redirecting alternates. Reciprocity CSV included. $0.0005 per page, no start fee.

- **URL**: https://apify.com/digivibetech/hreflang-canonical-validator.md
- **Developed by:** [DigiVibeTech](https://apify.com/digivibetech) (community)
- **Categories:** SEO tools, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.50 / 1,000 page checked (hreflang and canonical validated)s

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Hreflang & Canonical Validator - Bulk Hreflang Audit

**Hreflang & Canonical Validator** — check hreflang across pages or a whole sitemap: return links between every language version, self-references, x-default, language and region codes, canonical conflicts, noindex and redirecting alternates.

> **Try it free:** press **Start** — the prefilled input runs a small real job (up to 20 × page checked, about $0.010 in events). Apify's free plan includes monthly platform credit, so a first test costs you nothing. You can also set a maximum cost per run.

- **What you get:** `url`, `state`, `selfCode`, `hreflangCount`, `canonical`, `status`
- **Who it's for:** international SEO teams and multilingual site owners
- **Price:** $0.0005 per page checked
- **Data source:** Reads the public pages and sitemaps of sites you enter; respects robots.txt.

### What is Hreflang & Canonical Validator?

Check the hreflang setup of a multilingual or multi-country site: paste a few page URLs or a whole sitemap and get, per page, every hreflang tag, the canonical, and a plain list of problems. Alternates are fetched too, so **return links** are checked across the whole language cluster.

### ✅ Why this one

- Fetches every alternate and checks return links across the whole language cluster, plus self-reference, x-default and ISO language/region codes with a suggested fix (`en-UK` -> `en-GB`).
- Finds canonical conflicts and compares sitemap `xhtml:link` hreflang with the tags on the page. The most-used rival on the Store (Hreflang Tag Checker API, 9 users) does not list either.
- $0.0005 per page checked with no start fee, against $0.001 per URL at that rival. Pages skipped by robots.txt are not charged.
- Also reads hreflang and canonical from HTTP Link headers (PDFs and other files), noindex pages and redirecting alternates.

### 📸 Real-run screenshots

From real run `kbK7cwvQIYLEEzHoz` on Apify, 20 Nov 2026 (build 1.0.3). Images are rendered from that run's own input, dataset and charged events.

![Input of the real run](https://api.apify.com/v2/key-value-stores/8dx7mDMr71NbvtKdp/records/hreflang-canonical-validator-std-01-input.png)
![Results table (dataset)](https://api.apify.com/v2/key-value-stores/8dx7mDMr71NbvtKdp/records/hreflang-canonical-validator-std-02-results-table.png)
![One result item](https://api.apify.com/v2/key-value-stores/8dx7mDMr71NbvtKdp/records/hreflang-canonical-validator-std-03-result-item.png)
![Charged events and run cost](https://api.apify.com/v2/key-value-stores/8dx7mDMr71NbvtKdp/records/hreflang-canonical-validator-std-04-run-cost.png)

### ⬇️ What data you get

- **Return links (reciprocity)**: if page A lists B as an alternate, B must list A. Missing return links make search engines ignore the pair.
- **Self-reference**: each page should list itself.
- **x-default**: flagged when missing (can be switched off).
- **Language and region codes**: ISO 639-1 language and ISO 3166-1 country codes, with a suggested fix: `en-UK` -> `en-GB`, `en_US` -> `en-US`, `us-en` -> `en-US`, `jp` -> `ja`, and regions that hreflang does not support (`EU`, `419`).
- **Duplicate codes** pointing to different URLs, **relative URLs**, and hreflang placed in `<body>` instead of `<head>`.
- **Alternates that redirect, return 4xx/5xx or cannot be fetched.**
- **Canonical conflicts**: hreflang on a page whose canonical points elsewhere, alternates that are not canonical, more than one canonical.
- **noindex** pages inside a hreflang cluster.
- `<html lang>` that does not match the page's own hreflang code.
- **Sitemap vs page**: hreflang in sitemap `xhtml:link` entries compared with the tags on the page.
- Hreflang and canonical sent in the HTTP **Link header** (used for PDFs and other files) are read too.

### 🎯 Use cases

- Audit hreflang return links across all language versions
- Find canonical conflicts and noindex alternates
- Export a reciprocity CSV for developers

### ▶️ How to use

1. Open the actor; the input is prefilled with a small real example.
2. Replace it with your own input and set `maxUrls` to control the cost.
3. Press **Start**. Results appear in the **Output** tab (Overview view).
4. Download JSON, CSV or Excel, call the results via API, or schedule the actor.

### ⚙️ Input

| Field | Default | Meaning |
|---|---|---|
| `urls` | | Pages to check (one page per language cluster is enough) |
| `sitemapUrls` | | Sitemaps or sitemap indexes (.xml or .xml.gz); every page in them is checked |
| `checkAlternates` | true | Fetch every alternate to check return links, status, canonical and noindex |
| `requireXDefault` | true | Flag pages without x-default |
| `compareSitemap` | true | Compare sitemap hreflang with the page |
| `maxUrls` | 2000 | Most pages checked per run, alternates included |

#### Example input

```json
{
  "urls": [
    "https://www.apple.com/uk/"
  ],
  "maxUrls": 6
}
```

### ⬆️ Output

One row per page: `url`, `state` (ok, issues, no hreflang, not checkable), `status`, `selfCode`, `hreflangCount`, `alternates` (code, URL, source: head, body or http header), `canonical`, `htmlLang`, `noindex`, `issues`, `ok`.

Key-value store: **RECIPROCITY** (CSV: page, hreflang, alternate, alternate status, return link yes/no, return code), **ISSUES** (only pages with problems), **SUMMARY** and **ERRORS**.

#### Example output (one record, alternates shortened)

Real record from a test run on the input above.

```json
{
  "url": "https://www.apple.com/uk/",
  "state": "issues",
  "status": 200,
  "hreflangCount": 137,
  "selfCode": "en-gb",
  "alternates": [
    {
      "hreflang": "en-US",
      "url": "https://www.apple.com/",
      "source": "head"
    },
    {
      "hreflang": "ar-AE",
      "url": "https://www.apple.com/ae-ar/",
      "source": "head"
    },
    {
      "hreflang": "en-AE",
      "url": "https://www.apple.com/ae/",
      "source": "head"
    },
    {
      "...": "134 more"
    }
  ],
  "canonical": "https://www.apple.com/uk/",
  "htmlLang": "en-GB",
  "noindex": false,
  "issues": [
    "no x-default"
  ],
  "ok": false,
  "checkedAt": "2026-10-22T15:04:28.753765+00:00"
}
```

### 💵 Pricing and cost estimate

| Event | Price |
|---|---|
| Page checked (hreflang and canonical validated) | $0.0005 |

Every alternate that is fetched counts as a checked page. Pages skipped by robots.txt are free and there is no start fee. Set a maximum cost per run and the actor stops before going over it.

#### Cost estimate

| Page checkeds | Cost |
|---|---|
| 100 | $0.050 |
| 1,000 | $0.50 |
| 10,000 | $5.00 |

You pay only for these events: no subscription.

### 🔌 Integrations and API

Run it from **n8n, Make, Zapier, Clay** or any tool that can call an HTTP endpoint, connect a **webhook** to get notified when a run finishes, or let AI agents call it through the **Apify MCP server** (`mcp.apify.com`).

Run it and get the results in one call:

```bash
curl -X POST "https://api.apify.com/v2/acts/digivibetech~hreflang-canonical-validator/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.apple.com/uk/"], "maxUrls": 20}'
```

Python (`pip install apify-client`):

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("digivibetech/hreflang-canonical-validator").call(run_input={"urls": ["https://www.apple.com/uk/"], "maxUrls": 20})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

### ⚠️ Limits

- robots.txt is respected for every page and sitemap; at most about one request per second per site.
- Only link tags, canonical tags, `<html lang>`, robots meta and HTTP status are read. No page text is stored.
- URLs are compared exactly (after lower-casing the host and removing `#fragments`), the same way search engines match hreflang targets: `/page` and `/page/` are different URLs.

### 🛡️ Data source, privacy and legality

Reads the public pages and sitemaps of sites you enter; respects robots.txt.

You are responsible for using the results in line with the source's terms and data-protection law (for example GDPR).

### ❓ FAQ

#### How much does Hreflang & Canonical Validator cost?

$0.0005 per page checked. See the cost estimate table above. There is no monthly fee.

#### Can I try it for free?

Yes. Press Start with the prefilled input: it runs a small real job (up to 20 × page checked, about $0.010 in events). Apify's free plan includes monthly platform credit, which covers a first test.

#### Is it legal to use Hreflang & Canonical Validator?

Reads the public pages and sitemaps of sites you enter; respects robots.txt. Use the results lawfully (terms of the source, GDPR where it applies). This is not legal advice.

#### Can I use it through the API or an MCP server?

Yes. Every run is available through the Apify API and the official client libraries, and AI agents can call the actor through the Apify MCP server. See Integrations and API above.

#### Something does not work. Where do I get help?

Open an issue on the Issues tab or use [digivibetech.com/support](https://digivibetech.com/support/). Include the run ID so we can reproduce it.

### 📝 Changelog

#### 20 Nov 2026 — listing refresh

- README, listing text and input form restructured to the DigiVibeTech Apify quality standard v1. No feature or price change.

#### 1.0 — builds 1.0.1 to 1.0.2

- First build 2026-10-26, latest build 2026-10-26 (2 successful builds).

### 🧩 More DigiVibeTech actors

- [Website SEO & AI Search Audit (GEO/AEO)](https://apify.com/digivibetech/ai-search-citation-readiness)
- [Broken Link & Image Checker - Sitemap or Crawl](https://apify.com/digivibetech/broken-link-image-checker)
- [Bulk WHOIS & DNS Lookup - Domain Expiry, RDAP, SPF, DMARC](https://apify.com/digivibetech/domain-whois-rdap-dns)
- [Redirect Chain & Migration Map Checker](https://apify.com/digivibetech/redirect-chain-migration-checker)

*Maintained by DigiVibeTech. Questions or bugs: use the Issues tab or [digivibetech.com/support](https://digivibetech.com/support/); we reply within 2–5 business days.*

# Changelog

This Actor's version history is a separate document: https://apify.com/digivibetech/hreflang-canonical-validator/changelog.md

# Actor input Schema

## `urls` (type: `array`):

Pages to check. Their hreflang alternates are fetched too, so one URL per language cluster is enough.

## `sitemapUrls` (type: `array`):

Sitemap or sitemap index URLs. Every page in them is checked, and xhtml:link hreflang in the sitemap is compared with the page.

## `checkAlternates` (type: `boolean`):

Fetch every hreflang alternate (also when it is not in your list) to check status, return link, canonical and noindex. Each fetched alternate is a checked page.

## `requireXDefault` (type: `boolean`):

Report pages with hreflang but no x-default.

## `compareSitemap` (type: `boolean`):

Report pages whose hreflang in the sitemap differs from the tags on the page.

## `maxUrls` (type: `integer`):

Most pages checked (and charged) per run, alternates included.

## Actor input object example

```json
{
  "urls": [
    "https://www.apple.com/uk/"
  ],
  "checkAlternates": true,
  "requireXDefault": true,
  "compareSitemap": true,
  "maxUrls": 20
}
```

# Actor output Schema

## `results` (type: `string`):

All result items (overview view)

## `errors` (type: `string`):

Inputs that could not be processed, with the reason

## `summary` (type: `string`):

Counts of processed, billed and failed items

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://www.apple.com/uk/"
    ],
    "maxUrls": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("digivibetech/hreflang-canonical-validator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": ["https://www.apple.com/uk/"],
    "maxUrls": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("digivibetech/hreflang-canonical-validator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.apple.com/uk/"
  ],
  "maxUrls": 20
}' |
apify call digivibetech/hreflang-canonical-validator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,digivibetech/hreflang-canonical-validator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/z2JpFLetHoc2yiRIn/builds/ZJIAoaYoxRqwsrhBI/openapi.json
