# Catalog Release Guard - Price and Stock Regression Audit (`wheresprada/catalog-release-guard`) Actor

Compare two catalog snapshots before a release. Catch mass removals, stockout spikes, currency changes and large price movements, with expected-change allowances and traceable release gates.

- **URL**: https://apify.com/wheresprada/catalog-release-guard.md
- **Developed by:** [Mahruf Hossain](https://apify.com/wheresprada) (community)
- **Categories:** E-commerce, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.05 / completed catalog release audit

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 Release Guard

Compare a baseline catalog with a proposed replacement before publishing a product-feed or pricing update. Get a machine-readable **PASS/HOLD** decision, per-product changes, explicit review gates and SHA-256 fingerprints of both inputs.

Built for commerce operations teams and agencies reviewing catalog releases. Unlike a live-page scraper or a simple list of price changes, this Actor checks aggregate release risk and supports expected-change allowances. It does not crawl stores, submit feeds or modify products.

### Quick start

```json
{"before":[{"id":"DEMO-1","price":"19.99","currency":"USD","availability":"in_stock"}],"after":[{"id":"DEMO-1","price":"1.99","currency":"USD","availability":"out_of_stock"}]}
```

The example intentionally returns HOLD: a large price drop and an unexpected stockout need review. Use your own catalog snapshots, not customer/order records.

### Inputs

Both snapshots accept at most 1,000 products; total JSON input must fit within 2 MB. `before` must be nonempty. Each row requires:

| Field | Value |
|---|---|
| id | Stable product ID, 1–100 characters |
| price | Nonnegative decimal **string**, up to 12 whole digits and 6 decimals |
| currency | Three uppercase currency-code letters; code membership is not validated |
| availability | in_stock, out_of_stock, preorder or backorder |
| group | Optional label, 1–100 characters; retained for input fingerprinting, not segmented gating |

Unknown fields are rejected to prevent accidentally passing customer data. No URLs, API keys, cookies or personal contact details are required. Do not put secrets or personal information in product IDs or group labels.

Optional `thresholds` (percentages, 0–100): `maxRemovedPercent` (default 5), `maxOutOfStockIncreasePercent` (10), `maxPriceChangePercent` (25). A movement equal to a threshold passes; a greater movement holds. Price movements compare absolute change against the baseline price, using integer arithmetic at six decimal places. Both increases and decreases are checked.

`expectedChanges` accepts `{ "id": "SKU-1", "field": "price" }`, with fields price, availability, removed or added. Allowances prevent those changes from triggering related movement gates; changes remain visible and labeled expected. Currency switches, duplicate IDs and zero prices cannot be waived this way. Removal and stockout percentages use baseline unique product count; stockouts count in_stock → out_of_stock transitions among retained, unambiguous IDs.

### Output and integration

One completed audit record is written to the default dataset and `OUTPUT` key-value record. It contains `releaseDecision`, `summary`, `gates`, `changes`, `thresholds`, `baselineSha256` and `candidateSha256`. Export JSON for a release checklist or a CI/workflow condition. A HOLD is a successful audit result, not a failed Actor run. Invalid inputs fail the run with a safe message and no completed-audit event charge.

### Pricing

One `audit-completed` event per successfully saved report, covering up to 1,000 products per snapshot. The Store pricing panel is authoritative. Expected initial price: $0.05 per completed audit; any platform/start charges are shown separately there. No subscription or third-party paid API is required.

### Limits, privacy and interpretation

Only supplied snapshots are checked. PASS means the configured checks passed, not that a catalog is commercially correct or eligible for Google Shopping. This is not a complete Google Merchant specification validator, tax validator, currency registry, stock-level reconciliation or live website consistency check. No data is sent to third-party websites or AI models. Input/output are stored in your Apify run storage under Apify's retention/access rules; do not submit confidential or personal data. Logs contain summary counts only.

Relevant guidance: [Google product data specification](https://support.google.com/merchants/answer/7052112) and [price mismatch guidance](https://support.google.com/merchants/answer/12159029). These explain the operational context, not certification or endorsement.

### Development

Run `node --test test.mjs`. The comparison core has no external dependencies. The cloud wrapper uses the official Apify SDK in the Apify Node 24 base image. Development fixtures are synthetic and labeled DEMO.

# Actor input Schema

## `before` (type: `array`):

1–1000 products: id, price as decimal string, currency as three uppercase letters, availability (in_stock/out_of_stock/preorder/backorder), optional group.

## `after` (type: `array`):

0–1000 products with the same fields. Empty means the entire catalog was removed.

## `thresholds` (type: `object`):

Percentages between 0 and 100: maxRemovedPercent (5), maxOutOfStockIncreasePercent (10), maxPriceChangePercent (25).

## `expectedChanges` (type: `array`):

Optional {id, field} allowances. Field: price, availability, removed or added. Duplicate IDs, zero prices and currency changes always remain review gates.

## Actor input object example

```json
{
  "before": [
    {
      "id": "DEMO-1",
      "price": "19.99",
      "currency": "USD",
      "availability": "in_stock"
    }
  ],
  "after": [
    {
      "id": "DEMO-1",
      "price": "1.99",
      "currency": "USD",
      "availability": "out_of_stock"
    }
  ],
  "thresholds": {
    "maxRemovedPercent": 5,
    "maxOutOfStockIncreasePercent": 10,
    "maxPriceChangePercent": 25
  },
  "expectedChanges": []
}
```

# Actor output Schema

## `report` (type: `string`):

No description

## `dataset` (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 = {
    "before": [
        {
            "id": "DEMO-1",
            "price": "19.99",
            "currency": "USD",
            "availability": "in_stock"
        }
    ],
    "after": [
        {
            "id": "DEMO-1",
            "price": "1.99",
            "currency": "USD",
            "availability": "out_of_stock"
        }
    ],
    "thresholds": {
        "maxRemovedPercent": 5,
        "maxOutOfStockIncreasePercent": 10,
        "maxPriceChangePercent": 25
    },
    "expectedChanges": []
};

// Run the Actor and wait for it to finish
const run = await client.actor("wheresprada/catalog-release-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 = {
    "before": [{
            "id": "DEMO-1",
            "price": "19.99",
            "currency": "USD",
            "availability": "in_stock",
        }],
    "after": [{
            "id": "DEMO-1",
            "price": "1.99",
            "currency": "USD",
            "availability": "out_of_stock",
        }],
    "thresholds": {
        "maxRemovedPercent": 5,
        "maxOutOfStockIncreasePercent": 10,
        "maxPriceChangePercent": 25,
    },
    "expectedChanges": [],
}

# Run the Actor and wait for it to finish
run = client.actor("wheresprada/catalog-release-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 '{
  "before": [
    {
      "id": "DEMO-1",
      "price": "19.99",
      "currency": "USD",
      "availability": "in_stock"
    }
  ],
  "after": [
    {
      "id": "DEMO-1",
      "price": "1.99",
      "currency": "USD",
      "availability": "out_of_stock"
    }
  ],
  "thresholds": {
    "maxRemovedPercent": 5,
    "maxOutOfStockIncreasePercent": 10,
    "maxPriceChangePercent": 25
  },
  "expectedChanges": []
}' |
apify call wheresprada/catalog-release-guard --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,wheresprada/catalog-release-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/oc6zUFSj8DK9sowE8/builds/zLuOYTYo6bzZ4DjE1/openapi.json
