# Product Unit Price Audit (`theonlyxic/my-actor-2`) Actor

Compare declared pack and unit prices across saved product snapshots using exact arithmetic.

- **URL**: https://apify.com/theonlyxic/my-actor-2.md
- **Developed by:** [IGNITE Tools](https://apify.com/theonlyxic) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$100.00 / 1,000 completed unit-price audits

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

## Product Unit Price Audit

Compare supplier prices without confusing a pack price with a per-unit price. The report preserves exact SKUs, shows effective unit-cost changes, and flags declarations that cannot be compared.

Launch price: US$0.10 per completed audit report, covering both snapshots within the limits below. One unit-price-audit-completed event per report; no start fee, per-row fee or separate platform-usage charge. Malformed input fails before the report event. Reports with review findings or incompatible products are completed reports and are charged. A new run creates another report and charge. The Store Pricing tab is authoritative.

Compare previous_json and current_json JSON text arrays. Each product has exactly seven string fields: sku, price, price_basis, pack_quantity, unit, currency, tax_basis. Exact unique nonblank SKUs preserve leading zeros, case and whitespace (128 characters maximum). Other fields: 64 characters maximum.

price and pack_quantity use plain decimal text, maximum 24 characters, 15 integer digits and 8 fractional digits. Positive amounts only. Explicit price_basis is pack or unit; positive pack_quantity is required for both. Currency is uppercase three-letter syntax only. Unit labels must match exactly. tax_basis is inclusive or exclusive. The caller must establish meaning and accuracy of all declarations.

Pack effective unit price equals price divided by pack_quantity; unit pricing uses price directly. Different currency, unit or tax basis is not compared. Calculations use exact fractions; display values use eight decimal places and half-even rounding. Every result is review_required. Missing SKUs mean absent from this snapshot, not discontinued.

Malformed JSON, duplicate properties, invalid Unicode, missing/extra fields, non-string values, blank/duplicate SKUs reject the input. Other invalid declarations produce explicit row-not-comparable findings. Each snapshot: 2 MiB UTF-8, 10000 rows, nesting 16 and 200000 JSON nodes. Report: 4 MiB; split large batches when necessary. No report is written when the cap is exceeded.

No fetching, FX conversion, tax calculation, fuzzy matching, store writes or safety certification. Only submit authorised non-sensitive data; Apify stores input/output.

Apify SDK 4.1.0. Use 256 MiB, timeout 60 seconds, restart-on-error and standby off. Existing dataset reports are retained on restart; no exactly-once concurrency guarantee. The implementation passed 46 shared core/boundary/adapter tests. Prior synthetic cloud output confirmed unchanged pack/unit cost, a 100% unit-cost increase from pack shrinkage, and an excluded currency mismatch. This does not establish production reliability or customer adoption.

### Quick start

Run the prefilled Input example. SKU001 changes from AUD30 per pack of 12 to AUD2.50 per unit, so its effective cost is unchanged. Added and missing SKUs remain explicit. For pack shrinkage, compare the same SKU at AUD30 per pack with quantity 12 before and quantity 6 after: unit cost rises from 2.50 to 5.00, a 100% increase.

### Who it fits

Purchasing and catalogue workflow builders who already have two structured snapshots and confirmed product identities, units, currency and tax treatment. Use previous_json/current_json in Apify Console or through the API. This does not fetch supplier files, parse Excel/PDF, infer units or change a shop.

# Actor input Schema

## `previous_json` (type: `string`):

JSON text only. Use authorised non-sensitive synthetic or public data. See README for exact fields and limits.

## `current_json` (type: `string`):

JSON text only. Use authorised non-sensitive synthetic or public data. See README for exact fields and limits.

## Actor input object example

```json
{
  "previous_json": "[{\"sku\":\"001\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"},{\"sku\":\"002\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"}]",
  "current_json": "[{\"sku\":\"001\",\"price\":\"2.50\",\"price_basis\":\"unit\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"},{\"sku\":\"003\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"6\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"}]"
}
```

# Actor output Schema

## `report` (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 = {
    "previous_json": "[{\"sku\":\"001\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"},{\"sku\":\"002\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"}]",
    "current_json": "[{\"sku\":\"001\",\"price\":\"2.50\",\"price_basis\":\"unit\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"},{\"sku\":\"003\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"6\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"}]"
};

// Run the Actor and wait for it to finish
const run = await client.actor("theonlyxic/my-actor-2").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 = {
    "previous_json": "[{\"sku\":\"001\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"},{\"sku\":\"002\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"}]",
    "current_json": "[{\"sku\":\"001\",\"price\":\"2.50\",\"price_basis\":\"unit\",\"pack_quantity\":\"12\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"},{\"sku\":\"003\",\"price\":\"30.00\",\"price_basis\":\"pack\",\"pack_quantity\":\"6\",\"unit\":\"each\",\"currency\":\"AUD\",\"tax_basis\":\"exclusive\"}]",
}

# Run the Actor and wait for it to finish
run = client.actor("theonlyxic/my-actor-2").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 '{
  "previous_json": "[{\\"sku\\":\\"001\\",\\"price\\":\\"30.00\\",\\"price_basis\\":\\"pack\\",\\"pack_quantity\\":\\"12\\",\\"unit\\":\\"each\\",\\"currency\\":\\"AUD\\",\\"tax_basis\\":\\"exclusive\\"},{\\"sku\\":\\"002\\",\\"price\\":\\"30.00\\",\\"price_basis\\":\\"pack\\",\\"pack_quantity\\":\\"12\\",\\"unit\\":\\"each\\",\\"currency\\":\\"AUD\\",\\"tax_basis\\":\\"exclusive\\"}]",
  "current_json": "[{\\"sku\\":\\"001\\",\\"price\\":\\"2.50\\",\\"price_basis\\":\\"unit\\",\\"pack_quantity\\":\\"12\\",\\"unit\\":\\"each\\",\\"currency\\":\\"AUD\\",\\"tax_basis\\":\\"exclusive\\"},{\\"sku\\":\\"003\\",\\"price\\":\\"30.00\\",\\"price_basis\\":\\"pack\\",\\"pack_quantity\\":\\"6\\",\\"unit\\":\\"each\\",\\"currency\\":\\"AUD\\",\\"tax_basis\\":\\"exclusive\\"}]"
}' |
apify call theonlyxic/my-actor-2 --silent --output-dataset

```

## MCP server setup

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

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/Ga9vLgB1AcGZSmLv2/builds/yIdwROeN1q2t1KW0y/openapi.json
