# Purchase Order Confirmation Diff (`afkdigital/purchase-order-confirmation-diff`) Actor

Compare purchase orders and supplier confirmations from CSV/XLSX. Flag quantity, price, date and SKU changes with source-row evidence.

- **URL**: https://apify.com/afkdigital/purchase-order-confirmation-diff.md
- **Developed by:** [AFK Digital](https://apify.com/afkdigital) (community)
- **Categories:** Business, E-commerce
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.50 / 1,000 successfully compared original po lines

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

## Purchase Order Confirmation Diff

Compare purchase orders with supplier acknowledgments in CSV or XLSX. Review quantity, price, date and SKU discrepancies with source-row evidence.

### Quick start

Run with an empty JSON object or the prefilled synthetic sample. Open the Dataset for JSON and CSV, or use the Output links for the spreadsheet-safe CSV and SUMMARY record.

### Inputs

Provide both `purchaseOrdersFile` and `supplierConfirmationsFile`. Each object specifies `format` (csv or xlsx) and exactly one content source.

- `csvText` contains inline UTF-8 CSV. Set `delimiter` for semicolon, tab or pipe.
- `xlsxBase64` contains a Base64-encoded XLSX. Select `sheet` for workbooks with several sheets. Export formula cells as literal values.
- `url` identifies an accessible HTTPS Apify key-value store record. Keep account credentials out of the URL.

In `columnMapping`, map the canonical keys below to exact and distinct source headers, separately under `purchaseOrders` and `supplierConfirmations`. The prefilled demo shows the complete mapping.

| Canonical field | PO file | Confirmation file |
|---|---|---|
| po_number, po_line_id | Original PO and line IDs | Referenced PO and line IDs |
| supplier_item_id | Ordered supplier SKU | Confirmed supplier SKU |
| qty, unit_price | Ordered quantity and price | Confirmed quantity and price |
| unit, currency | Order unit and ISO currency | Confirmation unit and ISO currency |
| date | Requested delivery date | Supplier-confirmed delivery date |
| schedule_id (optional) | Unused | Unique segment identifier |

Store IDs as text to preserve leading zeros. Use ISO YYYY-MM-DD or native Excel dates, and a period as the decimal separator. Each file is limited to 5 MiB. The combined row cap is controlled by `maxLines` (default 10,000, maximum 20,000). Exceeding it fails the run.

### Matching and results

The Actor matches trimmed PO and line IDs exactly. Missing keys, duplicate original keys and unresolved repeated confirmation rows are marked ambiguous. Repeated confirmations qualify as a split when they have distinct schedule IDs or, when IDs are all blank, distinct confirmed dates. Complete confirmation keys absent from the PO are added rows. PO lines without an acknowledgment are unconfirmed.

Prices use decimal arithmetic with an absolute `priceTolerance` (default 0.10). Date changes use calendar days and `dateToleranceDays` (default 1). The exact threshold is within tolerance. Price deltas are suppressed if currency or unit differs or is missing. Split results show segment dates and price deltas in source order. Review `changed_fields` for simultaneous split, partial, and SKU changes.

`confirmed_date` is the supplier's promised delivery date. Source files remain read-only. This Actor performs no ERP or EDI writeback. Commercial values are returned in results and omitted from logs.

### Metering

One event represents one uniquely keyed, successfully compared original PO line with comparable quantity, price and date and identified SKUs. Splits and multiple differences produce one event per original line. Added, unconfirmed, ambiguous and needs-review rows are excluded. The standard demo has no custom events. An insufficient configured budget stops the run before results are written.

### Store description

Spot supplier acknowledgment discrepancies before purchasing or receiving teams act. Compare CSV or XLSX exports by purchase order and line ID. Review partial quantities, split delivery commitments, SKU substitutions, unit-price differences and delivery-date changes. Export JSON or CSV and trace each result to its source rows.

# Actor input Schema

## `purchaseOrdersFile` (type: `object`):

CSV/XLSX object. Supply format and one of csvText, xlsxBase64, or Apify key-value store record url.

## `supplierConfirmationsFile` (type: `object`):

CSV/XLSX object with the same file options. Use sheet for a multi-sheet XLSX.

## `columnMapping` (type: `object`):

Map canonical fields to exact source headers under purchaseOrders and supplierConfirmations. Optional schedule_id distinguishes split rows.

## `priceTolerance` (type: `number`):

Absolute tolerance in the line currency. Values at the threshold are within tolerance.

## `dateToleranceDays` (type: `integer`):

Absolute calendar-day tolerance for supplier-confirmed dates.

## `maxLines` (type: `integer`):

Hard combined limit for both files. The entire request fails if exceeded.

## Actor input object example

```json
{
  "purchaseOrdersFile": {
    "format": "csv",
    "csvText": "po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id\nPO-DEMO,1,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,2,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,3,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,4,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,5,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,7,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,8,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,9,A,10,5,2026-12-01,EA,USD,\n"
  },
  "supplierConfirmationsFile": {
    "format": "csv",
    "csvText": "po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id\nPO-DEMO,1,A,6,5,2026-12-01,EA,USD,\nPO-DEMO,2,A,4,5,2026-12-01,EA,USD,A\nPO-DEMO,2,A,6,5,2026-12-04,EA,USD,B\nPO-DEMO,3,A,10,5.25,2026-12-01,EA,USD,\nPO-DEMO,4,A,10,5,2026-12-04,EA,USD,\nPO-DEMO,5,B,10,5,2026-12-01,EA,USD,\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,8,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,9,A,10,5,2026-12-01,EA,EUR,\nPO-DEMO,10,A,10,5,2026-12-01,EA,USD,\n"
  },
  "columnMapping": {
    "purchaseOrders": {
      "po_number": "po_number",
      "po_line_id": "po_line_id",
      "supplier_item_id": "supplier_item_id",
      "qty": "qty",
      "unit_price": "unit_price",
      "date": "date",
      "unit": "unit",
      "currency": "currency",
      "schedule_id": "schedule_id"
    },
    "supplierConfirmations": {
      "po_number": "po_number",
      "po_line_id": "po_line_id",
      "supplier_item_id": "supplier_item_id",
      "qty": "qty",
      "unit_price": "unit_price",
      "date": "date",
      "unit": "unit",
      "currency": "currency",
      "schedule_id": "schedule_id"
    }
  },
  "priceTolerance": 0.1,
  "dateToleranceDays": 1,
  "maxLines": 10000
}
```

# Actor output Schema

## `datasetJson` (type: `string`):

No description

## `datasetCsv` (type: `string`):

No description

## `safeCsv` (type: `string`):

No description

## `summary` (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 = {
    "purchaseOrdersFile": {
        "format": "csv",
        "csvText": "po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id\nPO-DEMO,1,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,2,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,3,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,4,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,5,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,7,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,8,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,9,A,10,5,2026-12-01,EA,USD,\n"
    },
    "supplierConfirmationsFile": {
        "format": "csv",
        "csvText": "po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id\nPO-DEMO,1,A,6,5,2026-12-01,EA,USD,\nPO-DEMO,2,A,4,5,2026-12-01,EA,USD,A\nPO-DEMO,2,A,6,5,2026-12-04,EA,USD,B\nPO-DEMO,3,A,10,5.25,2026-12-01,EA,USD,\nPO-DEMO,4,A,10,5,2026-12-04,EA,USD,\nPO-DEMO,5,B,10,5,2026-12-01,EA,USD,\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,8,A,10,5,2026-12-01,EA,USD,\nPO-DEMO,9,A,10,5,2026-12-01,EA,EUR,\nPO-DEMO,10,A,10,5,2026-12-01,EA,USD,\n"
    },
    "columnMapping": {
        "purchaseOrders": {
            "po_number": "po_number",
            "po_line_id": "po_line_id",
            "supplier_item_id": "supplier_item_id",
            "qty": "qty",
            "unit_price": "unit_price",
            "date": "date",
            "unit": "unit",
            "currency": "currency",
            "schedule_id": "schedule_id"
        },
        "supplierConfirmations": {
            "po_number": "po_number",
            "po_line_id": "po_line_id",
            "supplier_item_id": "supplier_item_id",
            "qty": "qty",
            "unit_price": "unit_price",
            "date": "date",
            "unit": "unit",
            "currency": "currency",
            "schedule_id": "schedule_id"
        }
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("afkdigital/purchase-order-confirmation-diff").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 = {
    "purchaseOrdersFile": {
        "format": "csv",
        "csvText": """po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id
PO-DEMO,1,A,10,5,2026-12-01,EA,USD,
PO-DEMO,2,A,10,5,2026-12-01,EA,USD,
PO-DEMO,3,A,10,5,2026-12-01,EA,USD,
PO-DEMO,4,A,10,5,2026-12-01,EA,USD,
PO-DEMO,5,A,10,5,2026-12-01,EA,USD,
PO-DEMO,6,A,10,5,2026-12-01,EA,USD,
PO-DEMO,7,A,10,5,2026-12-01,EA,USD,
PO-DEMO,8,A,10,5,2026-12-01,EA,USD,
PO-DEMO,9,A,10,5,2026-12-01,EA,USD,
""",
    },
    "supplierConfirmationsFile": {
        "format": "csv",
        "csvText": """po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id
PO-DEMO,1,A,6,5,2026-12-01,EA,USD,
PO-DEMO,2,A,4,5,2026-12-01,EA,USD,A
PO-DEMO,2,A,6,5,2026-12-04,EA,USD,B
PO-DEMO,3,A,10,5.25,2026-12-01,EA,USD,
PO-DEMO,4,A,10,5,2026-12-04,EA,USD,
PO-DEMO,5,B,10,5,2026-12-01,EA,USD,
PO-DEMO,6,A,10,5,2026-12-01,EA,USD,
PO-DEMO,6,A,10,5,2026-12-01,EA,USD,
PO-DEMO,8,A,10,5,2026-12-01,EA,USD,
PO-DEMO,9,A,10,5,2026-12-01,EA,EUR,
PO-DEMO,10,A,10,5,2026-12-01,EA,USD,
""",
    },
    "columnMapping": {
        "purchaseOrders": {
            "po_number": "po_number",
            "po_line_id": "po_line_id",
            "supplier_item_id": "supplier_item_id",
            "qty": "qty",
            "unit_price": "unit_price",
            "date": "date",
            "unit": "unit",
            "currency": "currency",
            "schedule_id": "schedule_id",
        },
        "supplierConfirmations": {
            "po_number": "po_number",
            "po_line_id": "po_line_id",
            "supplier_item_id": "supplier_item_id",
            "qty": "qty",
            "unit_price": "unit_price",
            "date": "date",
            "unit": "unit",
            "currency": "currency",
            "schedule_id": "schedule_id",
        },
    },
}

# Run the Actor and wait for it to finish
run = client.actor("afkdigital/purchase-order-confirmation-diff").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 '{
  "purchaseOrdersFile": {
    "format": "csv",
    "csvText": "po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id\\nPO-DEMO,1,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,2,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,3,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,4,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,5,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,7,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,8,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,9,A,10,5,2026-12-01,EA,USD,\\n"
  },
  "supplierConfirmationsFile": {
    "format": "csv",
    "csvText": "po_number,po_line_id,supplier_item_id,qty,unit_price,date,unit,currency,schedule_id\\nPO-DEMO,1,A,6,5,2026-12-01,EA,USD,\\nPO-DEMO,2,A,4,5,2026-12-01,EA,USD,A\\nPO-DEMO,2,A,6,5,2026-12-04,EA,USD,B\\nPO-DEMO,3,A,10,5.25,2026-12-01,EA,USD,\\nPO-DEMO,4,A,10,5,2026-12-04,EA,USD,\\nPO-DEMO,5,B,10,5,2026-12-01,EA,USD,\\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,6,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,8,A,10,5,2026-12-01,EA,USD,\\nPO-DEMO,9,A,10,5,2026-12-01,EA,EUR,\\nPO-DEMO,10,A,10,5,2026-12-01,EA,USD,\\n"
  },
  "columnMapping": {
    "purchaseOrders": {
      "po_number": "po_number",
      "po_line_id": "po_line_id",
      "supplier_item_id": "supplier_item_id",
      "qty": "qty",
      "unit_price": "unit_price",
      "date": "date",
      "unit": "unit",
      "currency": "currency",
      "schedule_id": "schedule_id"
    },
    "supplierConfirmations": {
      "po_number": "po_number",
      "po_line_id": "po_line_id",
      "supplier_item_id": "supplier_item_id",
      "qty": "qty",
      "unit_price": "unit_price",
      "date": "date",
      "unit": "unit",
      "currency": "currency",
      "schedule_id": "schedule_id"
    }
  }
}' |
apify call afkdigital/purchase-order-confirmation-diff --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,afkdigital/purchase-order-confirmation-diff"
        }
    }
}
```

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/HiJdZ6RFQQTkvxi2U/builds/E3DLOVWbcNcKbO8a3/openapi.json
