# Hreflang & Canonical Checker — Find SEO Errors (`kadro/hreflang-canonical-checker`) Actor

Check canonical and hreflang tags of pages you give: canonical target, self-reference, invalid codes, x-default, noindex. Respects robots.txt.

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

## Pricing

$2.00 / 1,000 page hreflang checkeds

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 Checker

Audit the canonical and hreflang tags of a multilingual site and get a list of exactly what to fix on each page.

### What you get

| Field | What it tells you |
|---|---|
| `page, finalUrl` | Page you gave and its final address after redirects |
| `statusCode, error` | HTTP status and any request error |
| `canonical` | The canonical URL declared by the page |
| `hreflangCount` | Number of hreflang alternates |
| `hreflangs` | Language code and URL pairs |
| `issues` | List of problems, or `ok` when nothing is wrong |

Typical issues: hreflang does not list the page itself, missing `x-default`, invalid codes such as `en_US` instead of `en-US`, and `noindex` pages that still declare hreflang.

### How to use it in 3 steps

1. Paste the page URLs you want to check, one per line (up to 2,000).
2. Leave `followRedirects` on to check the final page.
3. Press Start and filter rows where `issues` is not `ok`.

### Pricing

**$2 per 1,000 pages checked.** Example: 500 pages = $1.00. Pages with errors or blocked by robots.txt are free. Set a maximum cost per run and the robot stops when it is reached.

### Integrations

- **Apify API and webhooks**: start a run and read the dataset from any language.
- **Make, n8n and Zapier**: use the Apify module or node, run this robot and pass the dataset on.
- **Google Sheets**: export the dataset or use the Apify integration to fill a sheet on a schedule.
- **Claude, Cursor and other agents (MCP)**: Use the Apify MCP server (`https://mcp.apify.com?actors=kadro/hreflang-canonical-checker`) from Claude or Cursor and ask: "Check the hreflang and canonical tags of these 20 product pages and list the errors"

### FAQ

**Does it check that alternates link back?**
No. It reads only the page you give and does not visit its alternates, so it cannot confirm return links.

**Does it respect robots.txt?**
Yes. A page blocked for all bots returns "Blocked by robots.txt" and is not charged. If robots.txt cannot be read, the host is not crawled.

**Does it read hreflang in sitemaps or HTTP headers?**
No. It checks the tags in the page HTML.

**What is not charged?**
Pages with errors and pages blocked by robots.txt.

**Is it legal?**
It reads only public pages you list, one request each, with a clear User-Agent.

### Limitations

- Does not visit the hreflang alternates, so return links are not verified.
- Checks only the HTML of the given page; sitemap and HTTP-header hreflang are not read.
- Up to 2,000 URLs per run.
- Only public URLs: private and local addresses are blocked.

### Other Kadro tools

Part of the **Kadro SEO toolkit**: pair it with the full-page audit and the sitemap tools below.

- [SEO On-Page Audit Crawler](https://apify.com/kadro/seo-onpage-audit): crawls a whole site and gives every page a 0-100 SEO score.
- [JSON-LD Schema Extractor](https://apify.com/kadro/jsonld-extractor): extracts schema.org JSON-LD types and finds broken blocks.
- [Sitemap URL Extractor](https://apify.com/kadro/sitemap-url-extractor): exports every URL from a sitemap or sitemap index.
- [Website Links Extractor](https://apify.com/kadro/url-links-extractor): lists every internal and external link of a page with anchor and nofollow.
- [Bulk URL Status & Redirect Checker](https://apify.com/kadro/bulk-url-status-redirect-checker): checks status codes and full redirect chains in bulk.

Found it useful? Please leave a review ⭐ — it helps a lot. Bugs or feature ideas: open an issue, I answer within 24 h.

# Actor input Schema

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

Pages to check, one per line, up to 2,000 (public URLs only). The alternates are not visited.

## `followRedirects` (type: `boolean`):

Read the final page after redirects (on by default).

## Actor input object example

```json
{
  "urls": [
    "https://www.python.org/"
  ],
  "followRedirects": true
}
```

# Actor output Schema

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

No description

# 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.python.org/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kadro/hreflang-canonical-checker").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.python.org/"] }

# Run the Actor and wait for it to finish
run = client.actor("kadro/hreflang-canonical-checker").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.python.org/"
  ]
}' |
apify call kadro/hreflang-canonical-checker --silent --output-dataset

```

## MCP server setup

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

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/EHcANHLRhabcUVEJD/builds/o4zZXgoCqSqxBU6DR/openapi.json
