# Product Catalog Field and Schema Change Monitor (`thirdwatch/catalog-field-drift-monitor`) Actor

Track fields on your own product pages. Distinguish a stock or price change from a missing field, and see the page evidence behind each value.

- **URL**: https://apify.com/thirdwatch/catalog-field-drift-monitor.md
- **Developed by:** [Thirdwatch](https://apify.com/thirdwatch) (community)
- **Categories:** E-commerce
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 8.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 catalog page checkeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Product Catalog Field and Schema Change Monitor

> Track fields on your own product pages. Distinguish a stock or price change from a missing field, and see the page evidence behind each value.

### What you get

A catalog operator can route missing required price fields to the web team while sending an actual out-of-stock value to inventory planning.

Run it on a schedule and each run compares against the last one automatically, with nothing to copy between runs. You get an event when a value changes, a field stops resolving or a field comes back.

A completed check counts once for each distinct catalog page successfully captured, including an unchanged page or one with a missing or invalid field. Several variants on the same page count as one check. Failed captures add no page check.

### Output fields

The default example produces these top-level fields. Nested records can be expanded in JSON or selected during export.

| Field | Meaning |
| --- | --- |
| `productId` | Product identity within the authorized source. |
| `url` | URL reported or calculated for this record. |
| `status` | Reported status for this record at the time of observation. |
| `fields` | Typed fields and the source evidence for each extracted value. |
| `events` | Changes or extraction issues found for this product. An unchanged product has an empty list. |

### Example output

Selected fields from a verified run on supplied illustrative data. The JSON below is an excerpt from one row. This is a first run, so each field is reported as `first_observed`. Run the same input again and `events` is empty, because nothing changed.

```json
{
  "productId": "MUG",
  "status": "checked",
  "events": [
    {
      "type": "first_observed",
      "field": "title",
      "value": "Enamel mug"
    },
    {
      "type": "first_observed",
      "field": "price",
      "value": 12.5
    },
    {
      "type": "first_observed",
      "field": "stock",
      "value": "out_of_stock"
    }
  ],
  "url": "https://catalog.example.com/products/mug"
}
```

### Input parameters

In the input form, switch to JSON, paste the input below and start the actor. Open the run’s dataset to inspect or export the result.

Supply a product ID, page URL and eligible page content. Each named field has a type and ordered source rules. Each run is compared with the last saved state for the same site, catalog and field rules, which separates a later value change from a field that stopped resolving.

<details>
<summary>Copy the complete, runnable input</summary>

```json
{
  "authorized": true,
  "siteOrigin": "https://catalog.example.com",
  "catalogId": "authorized-demo",
  "fields": [{"name": "title", "type": "text", "sources": [{"selector": "h1"}]}, {"name": "price", "type": "number", "sources": [{"selector": "[data-price]", "attribute": "data-price"}]}, {"name": "stock", "type": "availability", "sources": [{"selector": "[data-stock]", "attribute": "data-stock"}]}],
  "pages": [{"productId": "MUG", "url": "https://catalog.example.com/products/mug", "html": "<main><h1>Enamel mug</h1><span data-price='12.50' data-stock='OutOfStock'>Unavailable</span></main>"}]
}
```

</details>

| Parameter | Use | Meaning |
| --- | --- | --- |
| `authorized` | Required | Confirm you own or may process the specified catalog and its content. Default: `false`. |
| `siteOrigin` | Required | Exact origin covered by your permission, without a path. |
| `catalogId` | Optional | A name for this group of products, covering up to 200 products. Keep it the same between runs so each run compares against the last one. A new name starts a fresh comparison. Default: `catalog`. |
| `fields` | Required | Give each field a name, type and list of sources in order of preference. Specify the page element and optional attribute to read, or the field path in the embedded product record. Changing these rules starts a fresh comparison. |
| `pages` | Required | Each page accepts a URL and either HTML, fetch=true or error, up to 256 KB of HTML per page. Use fetch=true on a schedule so every run reads the live page. Set productId to the stable merchant ID. Supply sku when the page describes several products and you want one of them. |
| `rememberState` | Optional | Save this catalog's state in a key-value store in your account and compare the next run against it, so scheduled runs need no manual step. Each site, catalog identifier and set of field rules has its own saved state. Default: `true`. |
| `previousState` | Optional | Paste NEXT_STATE from an earlier run of the same catalog and field rules to compare against it instead of the saved state. That run leaves the saved state as it is. |

### Scheduled monitoring

1. Save your input as an Apify Task, with `fetch` set to `true` on each page so every run reads the live page. HTML supplied in the input stays the same until you change it.
2. Leave `rememberState` on and add a schedule to the Task.
3. Read each run's dataset. The first run reports each field as `first_observed`. Later runs report only what changed.

State is kept in a key-value store named `catalog-field-drift-monitor-state` in your own account, with one record for each combination of `siteOrigin`, `catalogId` and `fields`. Changing any of them starts a fresh comparison and leaves the others alone. A product left out of a run keeps its saved values until it returns.

State is saved only after a run's results are delivered, so the changes from a failed run are reported again by the next one. A run in which no page could be checked leaves the saved state as it is. Schedule each catalog so its runs do not overlap. If two runs do overlap, the saved state can come from either run, and the next run compares against it.

Every successful run leaves at least one dataset row. If a run has nothing else to report, it writes one `no_changes` row, which adds no page check.

Each run also writes two records to its own key-value store. `RUN_REPORT` shows the pages checked and what the run compared against under `baseline`: `savedState`, `previousState` or `none`. `NEXT_STATE` holds the state after the run. A `previousState` you supply takes priority over the saved state. To manage state entirely yourself, set `rememberState` to `false`.

### Use cases and integration

For an API integration, submit JSON to [this actor’s run endpoint](https://api.apify.com/v2/acts/thirdwatch~catalog-field-drift-monitor/runs). On success, read `defaultDatasetId` from the run and export its items as JSON or CSV.

### Limitations

A missing field can reflect a changed template or unavailable page. Stable product IDs and comparable field rules are needed between runs.

One `catalogId` tracks up to 200 products, and one run checks up to 100 pages. Each page can hold up to 256 KB of HTML, and a larger page gets a `page_error` row. A run that would take a catalog past 200 products stops with a message and adds no page checks. Use a separate `catalogId` for each group of products.

Live checks read the HTML a page returns, without running scripts or following redirects. A page that cannot be read this way gets a `page_error` row and adds no page check. A run in which every page fails still finishes as succeeded, so check `status` in your integration.

A run reads pages one at a time and delivers its rows at the end, within a 3-minute time limit by default. To check many live pages on a slow site, raise the timeout in the run options. A run that reaches its limit delivers no rows and adds no page checks, and the next run still reports every change.

[Source documentation](https://apify.com/apify/ai-web-scraper)

### Compared to alternatives

A page extractor can return the current price. This monitor also shows which field stopped resolving and which source supplied its last value. Related options: [apify/ai-web-scraper](https://apify.com/apify/ai-web-scraper) and [eloquent_mountain/ai-web-scraper-extract-data-with-ease](https://apify.com/eloquent_mountain/ai-web-scraper-extract-data-with-ease).

### FAQ

**How can I tell that a page template broke?**

Inspect the field status, value and source evidence. An unavailable required field has a different event from a successfully extracted stock change.

**Do I need to copy NEXT_STATE between runs?**

No. With `rememberState` on, each run picks up the saved state for the same site, catalog and field rules.

**How do I start the comparison again?**

Use a new `catalogId`. The new name starts a fresh comparison, and the earlier saved state stays in your key-value store.

Last verified: 2026-11. The verified sample run returned 2 dataset rows. [Thirdwatch](https://thirdwatch.dev)

# Actor input Schema

## `authorized` (type: `boolean`):

Confirm you own or may process the specified catalog and its content.

## `siteOrigin` (type: `string`):

Exact origin covered by your permission, without a path.

## `catalogId` (type: `string`):

A name for this group of products, covering up to 200 products. Keep it the same between runs so each run compares against the last one. A new name starts a fresh comparison.

## `fields` (type: `array`):

Give each field a name, type and list of sources in order of preference. Specify the page element and optional attribute to read, or the field path in the embedded product record. Changing these rules starts a fresh comparison.

## `pages` (type: `array`):

Each page accepts a URL and either HTML, fetch=true or error, up to 256 KB of HTML per page. Use fetch=true on a schedule so every run reads the live page. Set productId to the stable merchant ID. Supply sku when the page describes several products and you want one of them.

## `rememberState` (type: `boolean`):

Save this catalog's state in a key-value store in your account and compare the next run against it, so scheduled runs need no manual step. Each site, catalog identifier and set of field rules has its own saved state.

## `previousState` (type: `object`):

Optional. Paste NEXT_STATE from an earlier run of the same catalog and field rules to compare against it instead of the saved state. That run leaves the saved state as it is.

## Actor input object example

```json
{
  "authorized": true,
  "siteOrigin": "https://catalog.example.com",
  "catalogId": "catalog",
  "fields": [
    {
      "name": "stock",
      "type": "availability",
      "sources": [
        {
          "selector": "[data-stock]",
          "attribute": "data-stock"
        }
      ]
    }
  ],
  "pages": [
    {
      "url": "https://catalog.example.com/products/mug",
      "productId": "MUG",
      "html": "<article><span data-stock='InStock'>Available</span></article>"
    }
  ],
  "rememberState": 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 = {
    "authorized": true,
    "siteOrigin": "https://catalog.example.com",
    "fields": [
        {
            "name": "stock",
            "type": "availability",
            "sources": [
                {
                    "selector": "[data-stock]",
                    "attribute": "data-stock"
                }
            ]
        }
    ],
    "pages": [
        {
            "url": "https://catalog.example.com/products/mug",
            "productId": "MUG",
            "html": "<article><span data-stock='InStock'>Available</span></article>"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("thirdwatch/catalog-field-drift-monitor").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 = {
    "authorized": True,
    "siteOrigin": "https://catalog.example.com",
    "fields": [{
            "name": "stock",
            "type": "availability",
            "sources": [{
                    "selector": "[data-stock]",
                    "attribute": "data-stock",
                }],
        }],
    "pages": [{
            "url": "https://catalog.example.com/products/mug",
            "productId": "MUG",
            "html": "<article><span data-stock='InStock'>Available</span></article>",
        }],
}

# Run the Actor and wait for it to finish
run = client.actor("thirdwatch/catalog-field-drift-monitor").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 '{
  "authorized": true,
  "siteOrigin": "https://catalog.example.com",
  "fields": [
    {
      "name": "stock",
      "type": "availability",
      "sources": [
        {
          "selector": "[data-stock]",
          "attribute": "data-stock"
        }
      ]
    }
  ],
  "pages": [
    {
      "url": "https://catalog.example.com/products/mug",
      "productId": "MUG",
      "html": "<article><span data-stock='\''InStock'\''>Available</span></article>"
    }
  ]
}' |
apify call thirdwatch/catalog-field-drift-monitor --silent --output-dataset

```

## MCP server setup

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

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/2vAjIOhAd7Yl5gBp9/builds/D2WP2vrKi6b2jOsA4/openapi.json
