# Redirect Map Guard — Shopify CSV Loops & Chains (`analytical_gratefulness/shopify-redirect-map-guard`) Actor

Check Shopify redirect CSVs before import for loops, conflicting sources and chains. Structured row-level report; no crawling or shop login. $0.25/report, platform usage included.

- **URL**: https://apify.com/analytical\_gratefulness/shopify-redirect-map-guard.md
- **Developed by:** [black cow](https://apify.com/analytical_gratefulness) (community)
- **Categories:** SEO tools, E-commerce
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$250.00 / 1,000 completed redirect map reports

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Redirect Map Guard — Shopify CSV Loop & Chain Check

Check a proposed redirect map **before importing it**. Find loops, sources with conflicting destinations, duplicate mappings and multi-hop chains in one structured report. Designed for Shopify migrations and AI-generated redirect CSVs. No shop login, crawling or destination requests.

**$0.25 per completed report**, including reports with risks. Platform usage included. No per-row charge. Synthetic demo and rejected inputs have no report event. This launch price is a hypothesis, not evidence of customer demand.

### A concrete example

```csv
Redirect from,Redirect to
/old-a,/old-b
/old-b,/old-a
/sale,/old-a
/legacy,/new
```

The first two rows form a loop; the third reaches that loop. Expected result: `BLOCK`, `REDIRECT_LOOP=2`, `LEADS_TO_LOOP=1`, `cycle_count=1`. The report references CSV row numbers without copying URL values.

### Input

- `mode=demo`: built-in synthetic example, no supplied CSV.
- `mode=check`: inspect `csv_text`, with exactly `Redirect from` and `Redirect to` headers in either order.
- `delete_input_after_read=true` by default: removes this run's INPUT record before processing. A storage deletion failure stops processing. Setting false retains input for reruns.
- UTF-8 CSV, maximum **2 MiB and 20,000 redirect rows**. Both cells must be nonempty; extra columns are rejected. Findings are limited to 500 entries, but totals include every finding.

### For AI agents

Use this tool after producing a redirect CSV and before presenting it for import. It checks the supplied map, not the live storefront. [Apify MCP](https://mcp.apify.com?actors=analytical_gratefulness/shopify-redirect-map-guard\&telemetry-enabled=false) exposes Actor calls using the caller's Apify authentication and spending budget.

Synthetic paid-check request:

```json
{"mode":"check","csv_text":"Redirect from,Redirect to\n/old-a,/old-b\n/old-b,/old-a\n/sale,/old-a\n/legacy,/new\n","delete_input_after_read":true}
```

| Decision | Meaning | Next action |
|---|---|---|
| BLOCK | A modeled map error such as a loop, conflict or reserved source was found | Review the indicated rows |
| REVIEW | A chain, duplicate or excluded URL syntax needs review | Resolve warnings and coverage gaps |
| NO\_FLAGGED\_RISKS | No modeled risk was found in this input | Verify live pages and import behavior |
| REJECTED | Input cannot be processed or hosted pricing is unavailable | Correct mode/CSV; no report event |

`workflow.import_authorized` is always false. `report_kind=synthetic_demo` never means the caller's map was inspected. `complete=true` means the bounded input inspection finished, not that live redirects work.

Each new completed check run can incur a new $0.25 report event. If a client times out, retrieve the existing run and dataset before starting another run; this Actor does not provide cross-run idempotency. A low spending cap can prevent output/charge completion. The dataset may show an event-requested billing state; the platform run event counts are the authoritative charge record.

### What the report checks

- Self redirects, multi-node cycles and incoming paths that lead into cycles.
- Duplicate sources; conflicting destinations exclude that source from traversal.
- Multi-hop paths through the supplied map, including chains leading to excluded rows.
- Selected Shopify reserved-source restrictions, collection-tag route review and `.html` alias risks.
- Iterative graph traversal with exact case and trailing-slash matching.

### Limits that matter

Only literal ASCII relative paths participate in graph traversal. Absolute HTTP(S) destinations are reported for separate review and are not fetched. Queries, fragments, percent encoding, non-ASCII, Liquid, wildcards, dot segments and unsupported syntax are excluded and flagged. A path can be syntactically valid for Shopify yet outside this tool's modeled subset. Case/slash equivalence is not inferred.

No live HTTP statuses, destination content, existing store rules, SEO outcomes, market routing or actual Shopify import acceptance are verified. Shopify redirects depend on the source being a broken page; a structurally clean map cannot establish that. `BLOCK` is this tool's review decision, not Shopify's official import result. Use the [Shopify redirect documentation](https://help.shopify.com/en/manual/online-store/menus-and-links/url-redirect) for platform behavior. Rules reviewed 2026-09-10; no import or storefront modification is performed.

### Privacy and offline use

Apify receives the CSV supplied to a hosted run. Do not submit credentials, signed links, customer data or confidential paths without permission. INPUT deletion does not guarantee deletion from platform backups, other copies, earlier runs or stored reports. Reports contain the CSV hash, row references, fixed codes and counts; raw URLs are omitted. No external AI model receives the CSV.

The core has no third-party runtime dependencies and can run locally from the source package:

```text
python -m redirect_guard your-redirect-map.csv
```

Local inspection uses your computer. Hosted inspection uses Apify infrastructure. This product neither connects to your shop nor repairs/imports the CSV automatically.

# Actor input Schema

## `mode` (type: `string`):

Demo uses only synthetic data. Check inspects the supplied CSV. A completed check with risks also costs $0.25.

## `csv_text` (type: `string`):

Two columns: Redirect from and Redirect to. Up to 2 MiB and 20000 rows. No extra personal data columns. Supplied CSV is accepted only in check mode.

## `delete_input_after_read` (type: `boolean`):

Deletes the current INPUT record before processing. Platform backups, prior runs and other copies are excluded.

## Actor input object example

```json
{
  "mode": "demo",
  "delete_input_after_read": true
}
```

# Actor output Schema

## `reports` (type: `string`):

No description

## `report_json` (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 = {
    "mode": "demo",
    "delete_input_after_read": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("analytical_gratefulness/shopify-redirect-map-guard").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 = {
    "mode": "demo",
    "delete_input_after_read": True,
}

# Run the Actor and wait for it to finish
run = client.actor("analytical_gratefulness/shopify-redirect-map-guard").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 '{
  "mode": "demo",
  "delete_input_after_read": true
}' |
apify call analytical_gratefulness/shopify-redirect-map-guard --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,analytical_gratefulness/shopify-redirect-map-guard"
        }
    }
}
```

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/ZQxn11W6D3OdWHlfT/builds/YzQaQLabK1mZUIL1P/openapi.json
