# Catalog Reconciler (`noysa/catalog-reconciler`) Actor

- **URL**: https://apify.com/noysa/catalog-reconciler.md
- **Developed by:** [Anakin](https://apify.com/noysa) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$100.00 / 1,000 catalog comparison completeds

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

## Catalog Reconciler

Supplier and store catalogs change over time, but spotting exactly what changed between two snapshots can mean maintaining custom comparison code. Catalog Reconciler compares two product catalog snapshots and returns clear records for price changes, newly added products, discontinued products, and unchanged matches—without building that comparison logic yourself.

Typical uses include reconciling supplier feeds, synchronizing e-commerce catalogs, and passing product changes into automated monitoring workflows. Each successfully completed comparison is priced at **$0.10** on Apify.

```json
{
  "matchBySku": true,
  "catalogA": [{"sku": "ITEM-001", "price": 19.99}],
  "catalogB": [{"sku": "ITEM-001", "price": 17.99}]
}
```

**Ready to reconcile your catalogs?** Provide two JSON snapshots in the Actor input and run Catalog Reconciler. Enable SKU matching only if both catalogs share the same SKU namespace.

### Input

```json
{
  "matchBySku": true,
  "catalogA": [{"sku":"LAPTOP-001","name":"Laptop Pro 15","price":899}],
  "catalogB": [{"sku":"LAPTOP-001","name":"Laptop Pro 15","price":849}]
}
```

Each catalog must be an array of JSON objects. Products may contain `gtin`, `ean`, `sku`, `name`, and `price` (other source fields are preserved in output). GTIN/EAN values are normalized by removing spaces and hyphens and must contain 8, 12, 13, or 14 digits. If both are present, they must agree. SKU matching is disabled by default and should only be enabled when both feeds share a SKU namespace. Names are not matching identifiers. Maximum combined catalog size: 10,000 records.

Prices are compared using decimal arithmetic. Both catalogs are assumed to use one common currency; no currency detection or conversion is performed.

### Results

Every dataset item has `productKey`, `status`, `productA`, and `productB`; `priceDifference` is present for price changes and equals price B minus price A. Statuses are `added`, `removed`, `price_changed`, `unchanged`, or `invalid_price`. The Actor also stores a `SUMMARY` object in the default key-value store, including totals, per-status counts, and per-catalog record errors.

### Pay-per-event billing

On Apify, each successfully persisted comparison is charged once as the `comparison-completed` event at **$0.10**. The run's maximum charge must allow at least one event. The Actor checks its pricing and remaining run budget before reconciliation, then writes all dataset results and `SUMMARY` before requesting the charge. A rejected or failed charge causes the run to fail rather than being reported as a paid success; persisted output may still be present if the charge request fails after persistence. Charging and storage persistence are separate platform operations, so a successful comparison cannot be guaranteed to be charged if the charge request fails after persistence.

Configure pay-per-event pricing in Apify Console with `comparison-completed` priced at $0.10. Disable/remove the `apify-actor-start` and `apify-default-dataset-item` synthetic events to avoid startup and per-dataset-item charges. The Actor checks for these synthetic events and refuses to compare when a nonzero price is configured. The startup event, if enabled, may already be charged by Apify before Actor code can perform this check, so it must be disabled in Console before running. Apify's Console pricing settings are separate from the source repository and must be configured by the Actor owner.

Duplicate identifiers and invalid/conflicting GTIN/EAN values are reported in summary errors and excluded from matching. Records without identifiers are reported as errors. SKU matching is blocked when both records have conflicting GTINs. Invalid or missing prices on matched products result in `invalid_price`. Invalid top-level structure fails the run with a clear validation error.

### Run

On Apify, provide the JSON in the Actor's **Input** tab and start a run. For local development, install the requirements and run `apify run` (this initializes Apify local storage); place the input in `storage/key_value_stores/default/INPUT.json`. Tests can be run with `python -m pytest`.

### Limitations

No fuzzy/name matching, scraping, enrichment, currency conversion, or historical price storage. Input catalogs must be supplied directly and share a common currency. Identifier equivalence beyond exact normalized GTIN/EAN or explicitly enabled SKU is not inferred.

# Actor input Schema

## `matchBySku` (type: `boolean`):

Match by SKU only when both catalogs share the same SKU namespace. GTIN/EAN matching always has priority.

## `catalogA` (type: `array`):

First catalog. Products should include GTIN or EAN where available, optional SKU, name, and price.

## `catalogB` (type: `array`):

Second catalog to compare against Catalog A.

## Actor input object example

```json
{
  "matchBySku": true,
  "catalogA": [
    {
      "sku": "LAPTOP-001",
      "name": "Laptop Pro 15",
      "price": 899
    },
    {
      "sku": "MOUSE-002",
      "name": "Wireless Mouse",
      "price": 25
    },
    {
      "sku": "KEYBOARD-003",
      "name": "Mechanical Keyboard",
      "price": 79
    }
  ],
  "catalogB": [
    {
      "sku": "LAPTOP-001",
      "name": "Laptop Pro 15",
      "price": 849
    },
    {
      "sku": "MOUSE-002",
      "name": "Wireless Mouse",
      "price": 25
    },
    {
      "sku": "MONITOR-004",
      "name": "4K Monitor",
      "price": 199
    }
  ]
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (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 = {
    "matchBySku": true,
    "catalogA": [
        {
            "sku": "LAPTOP-001",
            "name": "Laptop Pro 15",
            "price": 899
        },
        {
            "sku": "MOUSE-002",
            "name": "Wireless Mouse",
            "price": 25
        },
        {
            "sku": "KEYBOARD-003",
            "name": "Mechanical Keyboard",
            "price": 79
        }
    ],
    "catalogB": [
        {
            "sku": "LAPTOP-001",
            "name": "Laptop Pro 15",
            "price": 849
        },
        {
            "sku": "MOUSE-002",
            "name": "Wireless Mouse",
            "price": 25
        },
        {
            "sku": "MONITOR-004",
            "name": "4K Monitor",
            "price": 199
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("noysa/catalog-reconciler").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 = {
    "matchBySku": True,
    "catalogA": [
        {
            "sku": "LAPTOP-001",
            "name": "Laptop Pro 15",
            "price": 899,
        },
        {
            "sku": "MOUSE-002",
            "name": "Wireless Mouse",
            "price": 25,
        },
        {
            "sku": "KEYBOARD-003",
            "name": "Mechanical Keyboard",
            "price": 79,
        },
    ],
    "catalogB": [
        {
            "sku": "LAPTOP-001",
            "name": "Laptop Pro 15",
            "price": 849,
        },
        {
            "sku": "MOUSE-002",
            "name": "Wireless Mouse",
            "price": 25,
        },
        {
            "sku": "MONITOR-004",
            "name": "4K Monitor",
            "price": 199,
        },
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("noysa/catalog-reconciler").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 '{
  "matchBySku": true,
  "catalogA": [
    {
      "sku": "LAPTOP-001",
      "name": "Laptop Pro 15",
      "price": 899
    },
    {
      "sku": "MOUSE-002",
      "name": "Wireless Mouse",
      "price": 25
    },
    {
      "sku": "KEYBOARD-003",
      "name": "Mechanical Keyboard",
      "price": 79
    }
  ],
  "catalogB": [
    {
      "sku": "LAPTOP-001",
      "name": "Laptop Pro 15",
      "price": 849
    },
    {
      "sku": "MOUSE-002",
      "name": "Wireless Mouse",
      "price": 25
    },
    {
      "sku": "MONITOR-004",
      "name": "4K Monitor",
      "price": 199
    }
  ]
}' |
apify call noysa/catalog-reconciler --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,noysa/catalog-reconciler"
        }
    }
}
```

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/wJ4R0RoNCPYxatzHT/builds/LhSVkDM9s9fHCdIo8/openapi.json
