# CPSC Recall Delta Monitor (`tom_the_builder/cpsc-recall-delta-monitor`) Actor

Monitor official CPSC recalls and return only new or changed records in normalized JSON.

- **URL**: https://apify.com/tom\_the\_builder/cpsc-recall-delta-monitor.md
- **Developed by:** [Danil Iarmolchik](https://apify.com/tom_the_builder) (community)
- **Categories:** Automation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 recall alerts

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## CPSC Recall Delta Monitor

Monitor official CPSC recalls and return only the records that are new or changed since the previous run.

This is an unofficial Actor and is not affiliated with, endorsed by, or sponsored by the U.S. Consumer Product Safety Commission. It uses public official CPSC recall data as its source.

This Actor is designed for scheduled monitoring, webhook workflows, and low-noise recall alerts. It uses the official CPSC API and keeps state between runs through the Apify key-value store.

### What it does

- fetches official recall records from the CPSC API
- normalizes the response into a stable JSON shape
- compares the current run with the previous state using a stable item id and fingerprint
- returns only `new` or `changed` records by default
- pushes selected items to the default dataset
- writes `OUTPUT`, `RUN_SUMMARY`, and `WEBHOOK_PAYLOAD` to the default key-value store

### Typical use cases

- monitor new product recalls for a category or manufacturer
- watch for hazard-specific recalls such as fire, choking, or electrocution
- trigger downstream alerts when a new recall appears
- keep a normalized recall feed without scraping raw HTML pages

### First target workflow

The first productized workflow is a narrow high-risk hazard monitor:

- fire
- electrocution
- choking
- related severe safety signals such as shock or burn

This keeps the actor focused on alerting value instead of becoming a broad recalls database.

### Input

The actor supports:

- recall date range
- free text query
- product name filter
- manufacturer filter
- hazard filter
- category filter
- keyword list filtering
- snapshot or delta mode

### Output

The Actor pushes selected records to the default dataset and writes compact payloads to the default key-value store:

- `OUTPUT`: full run payload with summary, items, and webhook payload
- `RUN_SUMMARY`: counts and run configuration
- `WEBHOOK_PAYLOAD`: compact alert payload for downstream tools

Each dataset item includes normalized fields such as:

- `recall_number`
- `recall_date`
- `last_publish_date`
- `title`
- `product_name`
- `hazard`
- `remedy`
- `manufacturer`
- `importer`
- `importers`
- `distributors`
- `retailers`
- `sold_at`
- `upcs`
- `injuries`
- `image_urls`
- `source_url`
- `change_type`
- `change_fields`
- `matched_keywords`
- `matched_fields`

### Recommended first run

Use `snapshot` mode for the first run if you want to inspect the current filtered universe without relying on an empty state. Use `delta` mode on scheduled runs after that.

For a focused first setup, use the high-risk hazard preset:

```json
{
  "mode": "delta",
  "changeMode": "new_and_changed",
  "stateKey": "cpsc-high-risk-hazards",
  "maxItems": 50,
  "relativeDateFromDays": 120,
  "keywordList": ["fire", "electrocution", "choking", "shock", "burn"],
  "requireKeywordMatch": true,
  "webhookMode": "summary"
}
````

### Integration notes

- Use the default dataset for tabular exports, API calls, Zapier, or Make.
- Use `RUN_SUMMARY` to detect empty runs and monitor health.
- Use `WEBHOOK_PAYLOAD` when a downstream step needs a compact alert object instead of the full dataset.
- Use a separate `stateKey` for each distinct monitor configuration.

### Current limitations

- single-agency scope: CPSC only
- no delivery adapters beyond JSON/webhook payload generation
- no automatic multi-agency deduplication

# Actor input Schema

## `mode` (type: `string`):

Use delta for monitor-style runs or snapshot to return the current filtered set.

## `changeMode` (type: `string`):

When mode is delta, choose whether to return new items only or both new and changed items.

## `stateKey` (type: `string`):

Logical state bucket. Use a different value for each distinct monitor configuration.

## `maxItems` (type: `integer`):

Limit the number of items returned in the output. State is still computed from the full filtered set.

## `dateFrom` (type: `string`):

Optional lower bound for recall date in YYYY-MM-DD format. Applied server-side when supported.

## `dateTo` (type: `string`):

Optional upper bound for recall date in YYYY-MM-DD format.

## `relativeDateFromDays` (type: `integer`):

If Recall date from is empty, derive it automatically as today minus this many days.

## `query` (type: `string`):

Free text query for title/description/product matching.

## `productName` (type: `string`):

Restrict results to recalls matching the product name.

## `manufacturer` (type: `string`):

Restrict results to recalls matching the manufacturer field.

## `recallNumber` (type: `string`):

Fetch a specific recall number when known.

## `keywordList` (type: `array`):

Optional keyword list matched against title, description, product, hazard, and manufacturer fields.

## `requireKeywordMatch` (type: `boolean`):

If enabled, records are returned only when at least one keyword matches.

## `hazardContains` (type: `string`):

Case-insensitive substring filter for the normalized hazard field.

## `categoryContains` (type: `string`):

Case-insensitive substring filter for the normalized product category field.

## `includeRaw` (type: `boolean`):

Attach the raw CPSC object to each item. Useful for debugging but increases output size.

## `includeUnchanged` (type: `boolean`):

When mode is delta, include unchanged items in the selected set.

## `webhookMode` (type: `string`):

Choose whether to disable webhook payloads, send only a summary, or include all selected items.

## Actor input object example

```json
{
  "mode": "delta",
  "changeMode": "new_and_changed",
  "stateKey": "default",
  "maxItems": 100,
  "dateFrom": "",
  "dateTo": "",
  "relativeDateFromDays": 0,
  "query": "",
  "productName": "",
  "manufacturer": "",
  "recallNumber": "",
  "keywordList": [],
  "requireKeywordMatch": false,
  "hazardContains": "",
  "categoryContains": "",
  "includeRaw": false,
  "includeUnchanged": false,
  "webhookMode": "summary"
}
```

# Actor output Schema

## `recallAlerts` (type: `string`):

Default dataset items containing new or changed normalized recall records.

## `runSummary` (type: `string`):

Compact summary with counts and selected configuration.

## `webhookPayload` (type: `string`):

Compact payload suitable for downstream alerting workflows.

## `fullOutput` (type: `string`):

Full JSON output object containing summary, items, and webhook payload.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("tom_the_builder/cpsc-recall-delta-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("tom_the_builder/cpsc-recall-delta-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call tom_the_builder/cpsc-recall-delta-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=tom_the_builder/cpsc-recall-delta-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "CPSC Recall Delta Monitor",
        "description": "Monitor official CPSC recalls and return only new or changed records in normalized JSON.",
        "version": "0.1",
        "x-build-id": "pewEgqjxX9VYDyEsu"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/tom_the_builder~cpsc-recall-delta-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-tom_the_builder-cpsc-recall-delta-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/tom_the_builder~cpsc-recall-delta-monitor/runs": {
            "post": {
                "operationId": "runs-sync-tom_the_builder-cpsc-recall-delta-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/tom_the_builder~cpsc-recall-delta-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-tom_the_builder-cpsc-recall-delta-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "mode": {
                        "title": "Run mode",
                        "enum": [
                            "delta",
                            "snapshot"
                        ],
                        "type": "string",
                        "description": "Use delta for monitor-style runs or snapshot to return the current filtered set.",
                        "default": "delta"
                    },
                    "changeMode": {
                        "title": "Delta selection",
                        "enum": [
                            "new_and_changed",
                            "new_only"
                        ],
                        "type": "string",
                        "description": "When mode is delta, choose whether to return new items only or both new and changed items.",
                        "default": "new_and_changed"
                    },
                    "stateKey": {
                        "title": "State key",
                        "type": "string",
                        "description": "Logical state bucket. Use a different value for each distinct monitor configuration.",
                        "default": "default"
                    },
                    "maxItems": {
                        "title": "Max output items",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Limit the number of items returned in the output. State is still computed from the full filtered set.",
                        "default": 100
                    },
                    "dateFrom": {
                        "title": "Recall date from",
                        "type": "string",
                        "description": "Optional lower bound for recall date in YYYY-MM-DD format. Applied server-side when supported.",
                        "default": ""
                    },
                    "dateTo": {
                        "title": "Recall date to",
                        "type": "string",
                        "description": "Optional upper bound for recall date in YYYY-MM-DD format.",
                        "default": ""
                    },
                    "relativeDateFromDays": {
                        "title": "Relative lookback window (days)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "If Recall date from is empty, derive it automatically as today minus this many days.",
                        "default": 0
                    },
                    "query": {
                        "title": "Free text query",
                        "type": "string",
                        "description": "Free text query for title/description/product matching.",
                        "default": ""
                    },
                    "productName": {
                        "title": "Product name filter",
                        "type": "string",
                        "description": "Restrict results to recalls matching the product name.",
                        "default": ""
                    },
                    "manufacturer": {
                        "title": "Manufacturer filter",
                        "type": "string",
                        "description": "Restrict results to recalls matching the manufacturer field.",
                        "default": ""
                    },
                    "recallNumber": {
                        "title": "Recall number",
                        "type": "string",
                        "description": "Fetch a specific recall number when known.",
                        "default": ""
                    },
                    "keywordList": {
                        "title": "Keyword list",
                        "type": "array",
                        "description": "Optional keyword list matched against title, description, product, hazard, and manufacturer fields.",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "requireKeywordMatch": {
                        "title": "Require keyword match",
                        "type": "boolean",
                        "description": "If enabled, records are returned only when at least one keyword matches.",
                        "default": false
                    },
                    "hazardContains": {
                        "title": "Hazard contains",
                        "type": "string",
                        "description": "Case-insensitive substring filter for the normalized hazard field.",
                        "default": ""
                    },
                    "categoryContains": {
                        "title": "Category contains",
                        "type": "string",
                        "description": "Case-insensitive substring filter for the normalized product category field.",
                        "default": ""
                    },
                    "includeRaw": {
                        "title": "Include raw source payload",
                        "type": "boolean",
                        "description": "Attach the raw CPSC object to each item. Useful for debugging but increases output size.",
                        "default": false
                    },
                    "includeUnchanged": {
                        "title": "Include unchanged items",
                        "type": "boolean",
                        "description": "When mode is delta, include unchanged items in the selected set.",
                        "default": false
                    },
                    "webhookMode": {
                        "title": "Webhook payload mode",
                        "enum": [
                            "off",
                            "summary",
                            "full"
                        ],
                        "type": "string",
                        "description": "Choose whether to disable webhook payloads, send only a summary, or include all selected items.",
                        "default": "summary"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
