# Website Change Monitor & Diff API (`craigtechservicesllc/website-change-monitor-diff-api`) Actor

Track website and API changes automatically. Detect meaningful text, HTML, regex, JSON, redirect, status, outage, and recovery changes with persistent baselines and structured diffs. Ideal for price monitoring, competitor tracking, compliance checks, and automation workflows.

- **URL**: https://apify.com/craigtechservicesllc/website-change-monitor-diff-api.md
- **Developed by:** [Daniel Craig](https://apify.com/craigtechservicesllc) (community)
- **Categories:** Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.65 / 1,000 url checks

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/platform/actors/running/actors-in-store#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

## Website Change Monitor & Diff API

Monitor public websites and JSON endpoints for meaningful changes without paying the browser/screenshot cost on every check. Run one URL or hundreds at once, save persistent baselines between runs, suppress predictable noise, and receive a structured record describing exactly what changed.

Use an Apify Schedule to turn the Actor into a recurring website monitor, or call it from the API, Make, Zapier, n8n, or another Actor.

### What this Actor monitors

- **Text changes** — strips scripts, styles, SVG, comments, and HTML markup before comparison.
- **HTML changes** — compares normalized returned HTML when markup changes matter.
- **Prices and selected values** — regex mode compares only extracted matches, so unrelated page updates do not trigger a change.
- **JSON/API fields** — compares stable JSON with object-key ordering normalized, optionally using an RFC 6901 JSON Pointer such as `/product/price`.
- **HTTP status and availability** — detects status changes, request failures, repeated failures, and recovery.
- **Redirect destinations** — detects when the final URL changes.

Every run writes one structured dataset row per page check. Filter `changed = true` to isolate only changes.

### Why use it

Many website monitors are optimized for screenshots and browser interaction. This Actor is deliberately optimized for **fast, repeatable HTTP checks and automation pipelines**:

- Up to 500 monitors in one run.
- No CSS selector required for ordinary text monitoring.
- Regex extraction for prices, inventory labels, versions, dates, counts, IDs, or any value you can match.
- JSON Pointer support for APIs.
- Persistent state across scheduled runs.
- Ignore regexes for timestamps, rotating IDs, counters, and other known dynamic content.
- Conditional ETag and Last-Modified requests; HTTP 304 responses reuse the previous body instead of downloading it again.
- Structured current/previous previews and focused diff snippets.
- Predictable pay-per-check billing.
- Limited-permission compatible. The Actor does not need access to unrelated account data.
- Private, loopback, link-local, and reserved destinations are blocked to reduce SSRF risk.

### Quick start

The default input monitors `https://example.com/` in text mode. The first run creates a baseline, so `baseline = true` and `changed = false`. Run the same input again to compare the current page with that baseline.

```json
{
  "monitors": [
    {
      "id": "example-homepage",
      "url": "https://example.com/",
      "mode": "text"
    }
  ]
}
```

### Monitor a competitor price

Use regex mode to compare only the value you care about. When a capture group is present, the Actor compares capture group 1.

```json
{
  "stateNamespace": "competitor-prices",
  "monitors": [
    {
      "id": "competitor-pro-plan",
      "url": "https://example.com/pricing",
      "mode": "regex",
      "extractRegex": "Pro Plan\\s*\\$([0-9,.]+)",
      "regexFlags": "gi"
    }
  ]
}
```

### Ignore timestamps and other noise

Known dynamic text can be removed before hashing and comparison.

```json
{
  "monitors": [
    {
      "id": "policy-page",
      "url": "https://example.com/policy",
      "mode": "text",
      "ignorePatterns": [
        "Last updated: \\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}",
        "request-id=[A-F0-9-]+"
      ]
    }
  ]
}
```

Use `globalIgnorePatterns` when the same dynamic pattern appears on every monitored page.

### Monitor one JSON API field

`jsonPointer` follows RFC 6901. Leave it empty to compare the full JSON payload. Object key order is normalized automatically.

```json
{
  "stateNamespace": "api-watch",
  "monitors": [
    {
      "id": "inventory-count",
      "url": "https://api.example.com/product/123",
      "mode": "json",
      "jsonPointer": "/inventory/available"
    }
  ]
}
```

### Monitor uptime or a status page

Status mode intentionally ignores response-body changes and watches the request/status/redirect state.

```json
{
  "monitors": [
    {
      "id": "vendor-health",
      "url": "https://status.example.com/",
      "mode": "status"
    }
  ]
}
```

### Output

Each checked monitor produces one dataset item. Important fields include:

| Field | Meaning |
| --- | --- |
| `baseline` | `true` when no prior state existed for this monitor configuration. |
| `changed` | Whether the current observation differs from the prior observation. |
| `changeTypes` | Reasons such as `content`, `status`, `redirect-target`, `request-failed`, `recovered`, or `error-type`. |
| `statusCode` / `previousStatusCode` | Current and previous effective HTTP status. |
| `currentPreview` / `previousPreview` | Bounded previews of compared content. |
| `diff` | Focused removed/added snippets and an approximate changed-span percentage. |
| `notModified` | `true` when the server returned HTTP 304 and the previous body was reused. |
| `error` | Safe error code and message if the request or extraction failed. |

Example changed result:

```json
{
  "monitorId": "competitor-pro-plan",
  "url": "https://example.com/pricing",
  "mode": "regex",
  "baseline": false,
  "changed": true,
  "changeTypes": ["content"],
  "requestSucceeded": true,
  "statusCode": 200,
  "previousStatusCode": 200,
  "currentPreview": "[\"12\"]",
  "previousPreview": "[\"10\"]",
  "diff": {
    "removed": "0",
    "added": "2"
  }
}
```

### Persistent baselines and namespaces

The Actor stores comparison state in its own named key-value store (`website-change-monitor-diff-api-state-v1`). State is isolated by `stateNamespace`, monitor identity, and monitoring configuration. The Actor-owned state includes the normalized comparison content needed to create future before/after diffs; it is not sent to any third-party service by this Actor.

Use a distinct `stateNamespace` for separate Apify Tasks that may monitor the same URL. Changing a monitor's URL, comparison mode, extraction regex, JSON Pointer, or normalization configuration automatically establishes a fresh baseline rather than comparing incompatible values.

Set `resetBaseline` to `true` when you intentionally want the current values to become new baselines.

### Scheduling

For continuous monitoring:

1. Save the input as an Apify Task.
2. Add a Schedule (for example hourly or daily).
3. Use the dataset output directly, or connect the run/dataset to your preferred automation workflow.
4. Filter for `changed = true` when the downstream workflow should act only on changes.

A page check is the billable unit, including a baseline check or a check that reports an HTTP/network failure. The result is still useful because it records the observed state.

### Reliability and safety limits

The Actor is built for public HTTP/HTTPS content and includes bounded defaults:

- Request timeout: 20 seconds.
- Retry attempts: 1 for transient network errors and common retryable HTTP statuses.
- Redirects: maximum 5.
- Response body: 1 MB per check by default, configurable up to a hard maximum of 1.5 MB.
- Concurrency: 8 by default, configurable from 1 to 16.
- Monitors per run: maximum 500.

Private, loopback, link-local, reserved, and local-network targets are blocked, including redirects that attempt to reach those destinations.

### Limitations

- This release monitors the HTTP response returned by the server. It does **not** execute page JavaScript or take screenshots.
- Pages whose important content exists only after browser-side rendering, login, clicking, scrolling, or CAPTCHA interaction need a browser-based Actor instead.
- Anti-bot protections may block datacenter requests on some websites.
- Regex extraction is intentionally deterministic and restricted to a conservative safety subset; backreferences, lookarounds, named groups, and potentially unsafe nested quantified groups are rejected.
- Automated monitoring does not grant permission to access content. Follow the target website's terms, applicable law, and reasonable request rates.

### Recommended use cases

- Competitor pricing and plan changes.
- Product availability or inventory labels.
- Terms, policy, compliance, and vendor-document changes.
- Documentation and changelog monitoring.
- Career page and announcement monitoring.
- API field changes.
- Status, outage, redirect, and recovery monitoring.
- Landing-page or offer-copy monitoring.

### Cost control

This Actor uses pay-per-event pricing with a `page-check` event. One delivered dataset row equals one page check. Apify also lets you set a maximum charge per run before starting it.

See the **Pricing** tab on the Actor page for the current per-check price and subscription-tier discounts.

# Actor input Schema

## `monitors` (type: `array`):

Each item is an independent monitor. Give repeated URLs unique IDs if you want to watch them in different ways.

## `stateNamespace` (type: `string`):

Separates one monitoring workflow from another. Use a different value for separate Tasks that might monitor the same URL.

## `globalIgnorePatterns` (type: `array`):

Dynamic patterns removed from every monitored value before comparison.

## `requestTimeoutSecs` (type: `integer`):

Maximum time allowed for each request attempt.

## `maxRetries` (type: `integer`):

Retries for transient network errors, 408/425/429, and common 5xx responses.

## `maxRedirects` (type: `integer`):

Maximum validated redirect hops per check.

## `maxResponseBytes` (type: `integer`):

Safety cap on downloaded response size for each page check.

## `maxConcurrency` (type: `integer`):

Number of monitors checked in parallel. Lower this for sensitive websites or very large pages.

## `resetBaseline` (type: `boolean`):

Delete the matching stored baselines before this run. The current values become new baselines and changed=false.

## Actor input object example

```json
{
  "monitors": [
    {
      "id": "example-homepage",
      "url": "https://example.com/",
      "mode": "text"
    }
  ],
  "stateNamespace": "default",
  "globalIgnorePatterns": [],
  "requestTimeoutSecs": 20,
  "maxRetries": 1,
  "maxRedirects": 5,
  "maxResponseBytes": 1000000,
  "maxConcurrency": 8,
  "resetBaseline": false
}
```

# Actor output Schema

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

One structured result per URL check.

## `summary` (type: `string`):

Counts of checks, changes, baselines, request failures, and budget state.

# 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 = {
    "monitors": [
        {
            "id": "example-homepage",
            "url": "https://example.com/",
            "mode": "text"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("craigtechservicesllc/website-change-monitor-diff-api").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 = { "monitors": [{
            "id": "example-homepage",
            "url": "https://example.com/",
            "mode": "text",
        }] }

# Run the Actor and wait for it to finish
run = client.actor("craigtechservicesllc/website-change-monitor-diff-api").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 '{
  "monitors": [
    {
      "id": "example-homepage",
      "url": "https://example.com/",
      "mode": "text"
    }
  ]
}' |
apify call craigtechservicesllc/website-change-monitor-diff-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,craigtechservicesllc/website-change-monitor-diff-api"
        }
    }
}

```

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/mqZUAwhUwi2H2CD6Y/builds/T3p25W6C3R0MUGdVP/openapi.json
