# Shopify Store Catalog Diff Reporter (`practical_ai_lab_jp/pal-shopify-store-catalog-diff`) Actor

Compare two Shopify catalog snapshots: added/removed products and variants, vendor, price, tag and availability changes.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-shopify-store-catalog-diff.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** E-commerce, Developer tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 catalog diff 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?

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

## Shopify Store Catalog Diff Reporter

Compare two snapshots of a Shopify catalog and get a structured change report: added and removed products and variants, vendor changes, price and compare-at price moves, SKU, title, tag, handle and availability changes, plus per-vendor product count shifts.

Unlike a product scraper, this Actor is about **differences between two points in time**. You can paste snapshots you already hold (for example saved `products.json` files from earlier runs of any tool), so the default workflow makes **no network requests at all**.

### Who it is for

- Ecommerce analysts and agencies tracking a store or competitor's public assortment between two dates.
- Merchants auditing a migration or bulk edit by comparing the catalog before and after.
- Teams that already collect catalog data and need a repeatable delta report.

### Input

| Field | Description |
| --- | --- |
| `beforeSnapshot` / `afterSnapshot` | Shopify `products.json` format: `{"products": [...]}`. Inline snapshots take priority. |
| `beforeSnapshotUrl` / `afterSnapshotUrl` | Optional public `https://` feed URLs, used only when the inline snapshot for that side is empty. |
| `matchBy` | `id` (default) or `handle`. |
| `includeVariantChanges` | Report variant-level changes (default `true`). |
| `minPriceChangePercent` | Hide price moves smaller than this percentage (default `0`). |
| `maxChanges` | Cap on emitted change rows (default 5000). The summary always counts everything. |
| `maxFeedPages` | Pages of 250 products per URL (default 4, max 20). |

The prefilled input is a small copyable example: two tiny snapshots containing a vendor rename, a price rise, a new variant, a new tag, one removed product and one added product.

#### Minimal example

```json
{
  "beforeSnapshot": {"products": [{"id": 1, "handle": "mug", "title": "Mug", "vendor": "Acme",
    "variants": [{"id": 10, "sku": "M1", "title": "Default", "price": "10.00", "available": true}]}]},
  "afterSnapshot": {"products": [{"id": 1, "handle": "mug", "title": "Mug", "vendor": "Acme Home",
    "variants": [{"id": 10, "sku": "M1", "title": "Default", "price": "12.00", "available": true}]}]}
}
```

### Output

The dataset contains one `summary` record first, followed by `change` records.

- `summary`: product and variant counts before/after, `changeCounts` by type, `vendorProductCountChanges`, skipped/duplicate record counts, source details and `caveats`.
- `change`: `changeType` (`product_added`, `product_removed`, `variant_added`, `variant_removed`, `vendor_changed`, `title_changed`, `product_type_changed`, `handle_changed`, `published_at_changed`, `tags_changed`, `sku_changed`, `variant_title_changed`, `price_changed`, `compare_at_price_changed`, `availability_changed`), product and variant identifiers, `before`/`after` values and, for prices, `priceDelta` and `priceDeltaPercent`.

### Public feed mode (optional)

When you supply a URL, the Actor only accepts `https://` hosts with a public domain name whose `/products.json` path resolves to public IP addresses. It does not follow redirects, reads `robots.txt` first (and stops if it cannot be read or disallows the feed), limits page count and response size, and waits between pages. Only publicly visible feed data is read.

### Limitations and caveats

- Public `products.json` feeds do not expose inventory quantities, draft or hidden products, costs, or customer data. Only public fields are compared.
- A diff covers two moments only; changes made and reverted in between are invisible.
- Some stores disable or customize `/products.json`; those cannot be fetched by URL. Paste a snapshot instead.
- With `maxFeedPages` reached, only the first products are compared and the report says so. Differences in feed ordering between fetches can create false added/removed rows on large catalogs.
- `availability_changed` relies on the `available` flag, which stores may omit.
- Snapshots with fewer than 30 products are flagged as small samples; treat counts there as anecdotal.
- Matching by `id` treats a re-created product (new id) as one removal plus one addition. Use `matchBy: handle` for such migrations.
- DNS is checked before the request, but the HTTP client resolves again, so the guard is best-effort against DNS rebinding.
- Not tested against real stores in this repository's offline tests; verify on your own feeds before relying on results.

### Pricing

The code emits a single `catalog-diff-report` event once per successfully completed run, after results are stored. Failed runs (invalid input, rejected URL, robots denial, fetch errors) never reach that step. No payable plan is configured in this repository; any pricing is set separately on the platform.

### Local tests

Tests are offline unit tests: `python -m unittest discover -s tests -t .`

# Actor input Schema

## `beforeSnapshot` (type: `object`):

Older snapshot in Shopify products.json format: an object with a 'products' array. Takes priority over the URL field.

## `afterSnapshot` (type: `object`):

Newer snapshot in the same format. Takes priority over the URL field.

## `beforeSnapshotUrl` (type: `string`):

Public https URL such as https://example-store.com/products.json. Used only when no inline 'before' snapshot is given. robots.txt is checked; requests are paged and rate-limited.

## `afterSnapshotUrl` (type: `string`):

Public https URL of the newer feed. Used only when no inline 'after' snapshot is given.

## `matchBy` (type: `string`):

'id' follows a product even if its handle changes. 'handle' is useful when comparing exports whose ids differ.

## `includeVariantChanges` (type: `boolean`):

Report added/removed variants and SKU, price, compare-at price, title and availability changes.

## `minPriceChangePercent` (type: `number`):

Ignore price changes smaller than this percentage. 0 reports every change.

## `maxChanges` (type: `integer`):

Caps emitted change rows. The summary still counts every change.

## `maxFeedPages` (type: `integer`):

Each page holds up to 250 products. Applies only to URL inputs.

## Actor input object example

```json
{
  "beforeSnapshot": {
    "products": [
      {
        "id": 1001,
        "handle": "trail-bottle",
        "title": "Trail Bottle",
        "vendor": "Northline",
        "product_type": "Drinkware",
        "tags": "outdoor, steel",
        "variants": [
          {
            "id": 5001,
            "sku": "TB-500",
            "title": "500 ml",
            "price": "24.00",
            "available": true
          },
          {
            "id": 5002,
            "sku": "TB-750",
            "title": "750 ml",
            "price": "28.00",
            "available": true
          }
        ]
      },
      {
        "id": 1002,
        "handle": "camp-mug",
        "title": "Camp Mug",
        "vendor": "Northline",
        "product_type": "Drinkware",
        "tags": "outdoor",
        "variants": [
          {
            "id": 5003,
            "sku": "CM-1",
            "title": "Default",
            "price": "12.00",
            "available": true
          }
        ]
      }
    ]
  },
  "afterSnapshot": {
    "products": [
      {
        "id": 1001,
        "handle": "trail-bottle",
        "title": "Trail Bottle",
        "vendor": "Northline Outdoors",
        "product_type": "Drinkware",
        "tags": "outdoor, steel, bestseller",
        "variants": [
          {
            "id": 5001,
            "sku": "TB-500",
            "title": "500 ml",
            "price": "26.00",
            "available": true
          },
          {
            "id": 5004,
            "sku": "TB-1000",
            "title": "1 L",
            "price": "32.00",
            "available": false
          }
        ]
      },
      {
        "id": 1003,
        "handle": "camp-stove",
        "title": "Camp Stove",
        "vendor": "Northline Outdoors",
        "product_type": "Cooking",
        "tags": "outdoor",
        "variants": [
          {
            "id": 5005,
            "sku": "CS-1",
            "title": "Default",
            "price": "59.00",
            "available": true
          }
        ]
      }
    ]
  },
  "matchBy": "id",
  "includeVariantChanges": true,
  "minPriceChangePercent": 0,
  "maxChanges": 5000,
  "maxFeedPages": 4
}
```

# Actor output Schema

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

Download rows from the latest run in JSON/CSV.

# 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 = {
    "beforeSnapshot": {
        "products": [
            {
                "id": 1001,
                "handle": "trail-bottle",
                "title": "Trail Bottle",
                "vendor": "Northline",
                "product_type": "Drinkware",
                "tags": "outdoor, steel",
                "variants": [
                    {
                        "id": 5001,
                        "sku": "TB-500",
                        "title": "500 ml",
                        "price": "24.00",
                        "available": true
                    },
                    {
                        "id": 5002,
                        "sku": "TB-750",
                        "title": "750 ml",
                        "price": "28.00",
                        "available": true
                    }
                ]
            },
            {
                "id": 1002,
                "handle": "camp-mug",
                "title": "Camp Mug",
                "vendor": "Northline",
                "product_type": "Drinkware",
                "tags": "outdoor",
                "variants": [
                    {
                        "id": 5003,
                        "sku": "CM-1",
                        "title": "Default",
                        "price": "12.00",
                        "available": true
                    }
                ]
            }
        ]
    },
    "afterSnapshot": {
        "products": [
            {
                "id": 1001,
                "handle": "trail-bottle",
                "title": "Trail Bottle",
                "vendor": "Northline Outdoors",
                "product_type": "Drinkware",
                "tags": "outdoor, steel, bestseller",
                "variants": [
                    {
                        "id": 5001,
                        "sku": "TB-500",
                        "title": "500 ml",
                        "price": "26.00",
                        "available": true
                    },
                    {
                        "id": 5004,
                        "sku": "TB-1000",
                        "title": "1 L",
                        "price": "32.00",
                        "available": false
                    }
                ]
            },
            {
                "id": 1003,
                "handle": "camp-stove",
                "title": "Camp Stove",
                "vendor": "Northline Outdoors",
                "product_type": "Cooking",
                "tags": "outdoor",
                "variants": [
                    {
                        "id": 5005,
                        "sku": "CS-1",
                        "title": "Default",
                        "price": "59.00",
                        "available": true
                    }
                ]
            }
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-shopify-store-catalog-diff").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 = {
    "beforeSnapshot": { "products": [
            {
                "id": 1001,
                "handle": "trail-bottle",
                "title": "Trail Bottle",
                "vendor": "Northline",
                "product_type": "Drinkware",
                "tags": "outdoor, steel",
                "variants": [
                    {
                        "id": 5001,
                        "sku": "TB-500",
                        "title": "500 ml",
                        "price": "24.00",
                        "available": True,
                    },
                    {
                        "id": 5002,
                        "sku": "TB-750",
                        "title": "750 ml",
                        "price": "28.00",
                        "available": True,
                    },
                ],
            },
            {
                "id": 1002,
                "handle": "camp-mug",
                "title": "Camp Mug",
                "vendor": "Northline",
                "product_type": "Drinkware",
                "tags": "outdoor",
                "variants": [{
                        "id": 5003,
                        "sku": "CM-1",
                        "title": "Default",
                        "price": "12.00",
                        "available": True,
                    }],
            },
        ] },
    "afterSnapshot": { "products": [
            {
                "id": 1001,
                "handle": "trail-bottle",
                "title": "Trail Bottle",
                "vendor": "Northline Outdoors",
                "product_type": "Drinkware",
                "tags": "outdoor, steel, bestseller",
                "variants": [
                    {
                        "id": 5001,
                        "sku": "TB-500",
                        "title": "500 ml",
                        "price": "26.00",
                        "available": True,
                    },
                    {
                        "id": 5004,
                        "sku": "TB-1000",
                        "title": "1 L",
                        "price": "32.00",
                        "available": False,
                    },
                ],
            },
            {
                "id": 1003,
                "handle": "camp-stove",
                "title": "Camp Stove",
                "vendor": "Northline Outdoors",
                "product_type": "Cooking",
                "tags": "outdoor",
                "variants": [{
                        "id": 5005,
                        "sku": "CS-1",
                        "title": "Default",
                        "price": "59.00",
                        "available": True,
                    }],
            },
        ] },
}

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-shopify-store-catalog-diff").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 '{
  "beforeSnapshot": {
    "products": [
      {
        "id": 1001,
        "handle": "trail-bottle",
        "title": "Trail Bottle",
        "vendor": "Northline",
        "product_type": "Drinkware",
        "tags": "outdoor, steel",
        "variants": [
          {
            "id": 5001,
            "sku": "TB-500",
            "title": "500 ml",
            "price": "24.00",
            "available": true
          },
          {
            "id": 5002,
            "sku": "TB-750",
            "title": "750 ml",
            "price": "28.00",
            "available": true
          }
        ]
      },
      {
        "id": 1002,
        "handle": "camp-mug",
        "title": "Camp Mug",
        "vendor": "Northline",
        "product_type": "Drinkware",
        "tags": "outdoor",
        "variants": [
          {
            "id": 5003,
            "sku": "CM-1",
            "title": "Default",
            "price": "12.00",
            "available": true
          }
        ]
      }
    ]
  },
  "afterSnapshot": {
    "products": [
      {
        "id": 1001,
        "handle": "trail-bottle",
        "title": "Trail Bottle",
        "vendor": "Northline Outdoors",
        "product_type": "Drinkware",
        "tags": "outdoor, steel, bestseller",
        "variants": [
          {
            "id": 5001,
            "sku": "TB-500",
            "title": "500 ml",
            "price": "26.00",
            "available": true
          },
          {
            "id": 5004,
            "sku": "TB-1000",
            "title": "1 L",
            "price": "32.00",
            "available": false
          }
        ]
      },
      {
        "id": 1003,
        "handle": "camp-stove",
        "title": "Camp Stove",
        "vendor": "Northline Outdoors",
        "product_type": "Cooking",
        "tags": "outdoor",
        "variants": [
          {
            "id": 5005,
            "sku": "CS-1",
            "title": "Default",
            "price": "59.00",
            "available": true
          }
        ]
      }
    ]
  }
}' |
apify call practical_ai_lab_jp/pal-shopify-store-catalog-diff --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,practical_ai_lab_jp/pal-shopify-store-catalog-diff"
        }
    }
}
```

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/c8DCTdi4E5vk6nBCW/builds/zWzSiwgAeaXjcN5bb/openapi.json
