# Catalog Import Guard (`tuyphongbtp/my-actor`) Actor

Check supplier catalog CSV or TSV files before import. Block duplicate SKUs, unexpected removals, currency changes, or price jumps and drops beyond your thresholds. Return a PASS or BLOCK decision for your workflow.

- **URL**: https://apify.com/tuyphongbtp/my-actor.md
- **Developed by:** [Bảo Lý](https://apify.com/tuyphongbtp) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 catalog validation reports

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

Compare two supplier catalog snapshots before an import. Review duplicate SKUs, removed products, currency changes and price movement outside your configured thresholds. The report provides a PASS or BLOCK decision for your workflow.

### Quick start

1. Export a baseline catalog and the proposed replacement as UTF-8 CSV or TSV.
2. Include sku, price and currency columns in both snapshots. Preserve SKU identifiers as text, including leading zeros.
3. Paste each file into baseline and candidate, select the matching format and review the thresholds.
4. Run the Actor and review the report before allowing the import.

### Example input

```json
{
  "baseline": "sku,price,currency\n00042,10.00,USD\n00043,12.00,USD\n",
  "candidate": "sku,price,currency\n00042,7.00,USD\n00043,12.00,USD\n",
  "format": "csv",
  "maxRemovedPct": 5,
  "maxPriceDropPct": 20,
  "maxPriceRisePct": 25
}
```

SKU 00042 falls from 10.00 to 7.00, a 30% decrease. This example is intended to trigger BLOCK because the decrease exceeds 20%.

### Inputs

| Field | Required | Default | Purpose |
| --- | --- | --- | --- |
| baseline | Yes | | Previous catalog as a string |
| candidate | Yes | | Proposed catalog as a string |
| format | No | csv | csv or tsv delimiter |
| maxRemovedPct | No | 5 | Maximum removed SKUs as a percentage |
| maxPriceDropPct | No | 20 | Maximum permitted price decrease |
| maxPriceRisePct | No | 25 | Maximum permitted price increase |

Threshold fields accept integers from 0 to 100. Values strictly above a threshold block the import, as described in the input schema.

### Using the result

Route BLOCK reports to a review step and inspect the flagged catalog changes. Validate a small representative catalog before connecting the decision to a production import. Retain the original files so corrections can be reviewed.

### Scope

This Actor compares the snapshots you provide. Check the source exports and business rules before relying on a PASS result. Include only catalog fields needed for validation and omit credentials and customer information.

### Pricing and support

Current event prices are shown in the Pricing tab. Platform usage and any configured startup event are listed by Apify. Use the Issues tab to report a reproducible problem with a small anonymized input and the run ID.

# Actor input Schema

## `baseline` (type: `string`):

Paste UTF-8 CSV or TSV with sku, price and currency columns.

## `candidate` (type: `string`):

Paste UTF-8 CSV or TSV with sku, price and currency columns.

## `format` (type: `string`):

Delimiter used by both snapshots.

## `maxRemovedPct` (type: `integer`):

Values strictly above this percentage block import.

## `maxPriceDropPct` (type: `integer`):

Values strictly above this percentage block import.

## `maxPriceRisePct` (type: `integer`):

Values strictly above this percentage block import.

## Actor input object example

```json
{
  "baseline": "sku,price,currency\n001,100.00,USD\n002,39.00,USD\n003,15.00,USD\n004,10.00,USD\n",
  "candidate": "sku,price,currency\n001,65.00,USD\n002,39.00,EUR\n003,15.00,USD\n",
  "format": "csv",
  "maxRemovedPct": 5,
  "maxPriceDropPct": 20,
  "maxPriceRisePct": 25
}
```

# 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 = {
    "baseline": `sku,price,currency
001,100.00,USD
002,39.00,USD
003,15.00,USD
004,10.00,USD`,
    "candidate": `sku,price,currency
001,65.00,USD
002,39.00,EUR
003,15.00,USD`
};

// Run the Actor and wait for it to finish
const run = await client.actor("tuyphongbtp/my-actor").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 = {
    "baseline": """sku,price,currency
001,100.00,USD
002,39.00,USD
003,15.00,USD
004,10.00,USD
""",
    "candidate": """sku,price,currency
001,65.00,USD
002,39.00,EUR
003,15.00,USD
""",
}

# Run the Actor and wait for it to finish
run = client.actor("tuyphongbtp/my-actor").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 '{
  "baseline": "sku,price,currency\\n001,100.00,USD\\n002,39.00,USD\\n003,15.00,USD\\n004,10.00,USD\\n",
  "candidate": "sku,price,currency\\n001,65.00,USD\\n002,39.00,EUR\\n003,15.00,USD\\n"
}' |
apify call tuyphongbtp/my-actor --silent --output-dataset

```

## MCP server setup

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

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/G2vwk2KYbwxSOsnBQ/builds/MtdbVkDqw8AJPB3UI/openapi.json
