# Return Serial Provenance Evidence (`h_murdock/return-serial-provenance-evidence`) Actor

Compare serialized return units with declared original fulfillment and prior receipt exports. Retain wrong-source serials, missing serials, duplicate records and ambiguous fulfillment cycles. JSON or mapped CSV; no refund or fraud decisions.

- **URL**: https://apify.com/h_murdock/return-serial-provenance-evidence.md
- **Developed by:** [Gilad Ronen](https://apify.com/h_murdock) (community)
- **Categories:** E-commerce, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.25 / completed report

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

## Return Serial Provenance Evidence

Review a serialized returns intake batch against the original fulfillment units and prior receipt records you supply. The report shows which serials have supported original-shipment provenance, which appear only outside the declared source, and which remain unresolved because a serial, source record or fulfillment link is missing or ambiguous.

This is useful when a returns specialist already works with exports or disconnected warehouse records and needs a repeatable evidence report before a human completes the returns workflow. It does not connect to NetSuite, modify an ERP, authenticate a physical unit, or decide whether to issue a refund. It does not determine fraud, warranty coverage, recalls or restocking eligibility.

### What you supply

Use opaque identifiers rather than names, email addresses or contact details. Each source row represents one physical serialized unit; aggregate quantities are unsupported.

- Original shipment rows contain `rowId`, `fulfillmentId`, `orderId`, `customerId`, `itemId` and `serialNumber`.
- Current receipt rows contain `rowId`, `receiptId`, `rmaId`, `sourceOrderId`, `customerId`, `itemId` and `serialNumber`. An optional `sourceFulfillmentId` restricts the original candidates to that exact fulfillment.
- Optional prior receipt rows use the same format as current receipts.
- `shipmentCoverage` and `priorReceiptCoverage` explicitly declare `complete`, `partial` or `none` for the submitted export scope. Complete prior coverage requires an explicit array or CSV, even when empty. These declarations are not independently checked against a live system.

All identifiers remain strings. Case, leading zeros and nonblank whitespace are significant. A null, empty or whitespace-only receipt serial produces an unknown result. No serial normalization, timestamp ordering or “latest fulfillment” selection occurs.

JSON arrays are the easiest starting point. Alternatively, provide strict CSV for each table and remove that table's array. CSV accepts a BOM and quoted cells, requires exactly the unique declared headers and rejects irregular row widths. A complete column mapping supports renamed headers. For receipt CSV include the optional `sourceFulfillmentId` header; a blank cell means it was not supplied. Blank serial cells are unknown. Unknown fields and quantity columns are rejected so an aggregate export cannot silently become unit evidence.

### How the evidence works

A supported row requires one unambiguous submitted shipment with the exact serial, item, customer and declared source order, plus the explicit fulfillment when provided. If two fulfillment candidates match, the report preserves both and chooses neither. Duplicate shipment row IDs or duplicate/conflicting fulfillment units block a clean conclusion.

A known serial found only outside those source restrictions becomes outside-declared-source evidence with references to the submitted records. No match means only no match in this export. Neither outcome establishes that a unit was never sold or that a return is ineligible.

The same receipt/item/serial re-exported is duplicate-record evidence, rather than another physical return. Distinct receipt IDs are grouped for human review only when they claim the same serial against the same uniquely established original fulfillment cycle. A refurbished serial legitimately shipped again on a different order or fulfillment remains a separate cycle. Conflicting receipt source records remain unresolved. Missing or ambiguous related prior units prevent an absence-of-prior-record conclusion even with complete declared coverage. Partial or absent prior coverage always leaves unobserved history incomplete.

### Results and downloads

Each completed run produces one dataset item containing the full report, a `rows` array for the current receipt units, findings, duplicate/conflicting record groups, repeated receipt groups, and all submitted rows. References include the original table, zero-based array index and row ID. Displayed reference lists are capped at 50 and clearly flagged when abbreviated; the complete supplied rows remain in JSON.

Download full JSON, current-unit CSV, findings CSV and standalone HTML. CSV cells are formula-neutralized and HTML escapes supplied content. Download the HTML attachment and open it locally. Results describe supplied evidence and need a human review; they are not a certification or live inventory report.

### Limits and pricing

The input must fit within 4 MB and contain at most 2,000 combined shipment, current receipt and prior receipt unit rows. Full JSON must stay below 8 MB and each export below 9 MB. Highly repetitive evidence can exceed the report limit even within the input limits; split that batch. Output limits are checked before a report charge.

The configured price is **$0.25 per completed report**, with platform usage included and no startup or per-row fee. Invalid input or insufficient report budget produces no completed report event. A fresh run creates a new report and is billable again. Resuming the same run verifies saved input/result integrity and repairs missing exports without intentionally adding another dataset item or report charge. An interrupted export write can leave partial files; completion is confirmed only after the report dataset and event receipt. Apify stores inputs and results in your run's storage, so upload only exports you are authorized to process.

# Actor input Schema

## `batchId` (type: `string`):

Exact opaque batch identifier. Strings only, maximum160characters; leading zeros/case/whitespace remain exact. Do not include contact details.

## `shipmentCoverage` (type: `string`):

Caller declaration for submitted original shipment export scope. Partial/none prevent an overall supported conclusion. None requires an explicit empty array or header-only CSV. No current live ERP coverage is verified.

## `priorReceiptCoverage` (type: `string`):

Caller declaration for supplied prior returns. Complete requires an explicit array/CSV, even if empty. Partial/none cannot establish no prior return. None requires zero prior rows.

## `shipmentRows` (type: `array`):

Each physical serialized unit: rowId,fulfillmentId,orderId,customerId,itemId,serialNumber, all exact strings. No quantities. Duplicate rowId or fulfillment/item/serial units retained and flagged as ambiguous. Supply array OR shipmentsCsv. Maximum2000total rows and4MBJSON.

## `receiptRows` (type: `array`):

Each unit: rowId,receiptId,rmaId,sourceOrderId,optional sourceFulfillmentId,customerId,itemId,serialNumber. Serial may be null/empty/whitespace-only (unknown). Explicit source fulfillment restricts candidates. No timing or chronology inference. Array OR receiptsCsv.

## `priorReceiptRows` (type: `array`):

Same fields as current rows. Re-exported same receipt/item/serial is duplicate evidence, not a second return. Distinct receipts repeat only within the SAME unambiguous shipment cycle. Prior unknown/conflicting records leave history unresolved. Array OR priorReceiptsCsv.

## `shipmentsCsv` (type: `string`):

Remove shipmentRows when using CSV. BOM/quoted cells accepted; exactly mapped unique headers, no irregular rows. Each row one unit. Header-only means empty.

## `receiptsCsv` (type: `string`):

Remove receiptRows when using CSV. All eight mapped headers required; blank sourceFulfillmentId means unprovided, blank serialNumber means unknown. No ID coercion.

## `priorReceiptsCsv` (type: `string`):

Remove priorReceiptRows when using CSV. Same eight headers as receipts. Strict BOM/quotes/uniqueheaders/rowwidth validation; header-only explicitly empty.

## `shipmentColumns` (type: `object`):

Complete exact mapping rowId,fulfillmentId,orderId,customerId,itemId,serialNumber to distinct headers. Canonical mapping harmless with arrays; custom mapping requires CSV.

## `receiptColumns` (type: `object`):

Complete mapping of all eight receipt fields including sourceFulfillmentId and serialNumber to distinct headers. No automatic header guesses.

## `priorReceiptColumns` (type: `object`):

Complete same eightfield mapping for prior CSV. Canonical mapping harmless with arrays, custom mapping requires CSV.

## Actor input object example

```json
{
  "batchId": "returns-demo-0",
  "shipmentCoverage": "complete",
  "priorReceiptCoverage": "complete",
  "shipmentRows": [
    {
      "rowId": "s1",
      "fulfillmentId": "f1",
      "orderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-001"
    },
    {
      "rowId": "s2",
      "fulfillmentId": "f2",
      "orderId": "o2",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-002"
    },
    {
      "rowId": "s3",
      "fulfillmentId": "f3",
      "orderId": "o3",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003"
    },
    {
      "rowId": "s4",
      "fulfillmentId": "f4",
      "orderId": "o4",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003"
    },
    {
      "rowId": "s5",
      "fulfillmentId": "f5",
      "orderId": "o5",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-AMB"
    },
    {
      "rowId": "s6",
      "fulfillmentId": "f6",
      "orderId": "o5",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-AMB"
    },
    {
      "rowId": "dup",
      "fulfillmentId": "f7",
      "orderId": "o7",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-DUP"
    },
    {
      "rowId": "dup",
      "fulfillmentId": "f8",
      "orderId": "o8",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-OTHER"
    }
  ],
  "receiptRows": [
    {
      "rowId": "r1",
      "receiptId": "rec1",
      "rmaId": "rma-rec1",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-001",
      "sourceFulfillmentId": "f1"
    },
    {
      "rowId": "r2",
      "receiptId": "rec2",
      "rmaId": "rma-rec2",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-002"
    },
    {
      "rowId": "r3",
      "receiptId": "rec3",
      "rmaId": "rma-rec3",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": null
    },
    {
      "rowId": "r4",
      "receiptId": "rec4",
      "rmaId": "rma-rec4",
      "sourceOrderId": "o3",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003",
      "sourceFulfillmentId": "f3"
    },
    {
      "rowId": "r5",
      "receiptId": "rec5",
      "rmaId": "rma-rec5",
      "sourceOrderId": "o4",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003",
      "sourceFulfillmentId": "f4"
    },
    {
      "rowId": "r6",
      "receiptId": "rec6",
      "rmaId": "rma-rec6",
      "sourceOrderId": "o5",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-AMB"
    },
    {
      "rowId": "r7",
      "receiptId": "rec7",
      "rmaId": "rma-rec7",
      "sourceOrderId": "o7",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-DUP"
    },
    {
      "rowId": "r8",
      "receiptId": "rec8",
      "rmaId": "rma-rec8",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-NO"
    }
  ],
  "priorReceiptRows": [
    {
      "rowId": "p1",
      "receiptId": "prior-rec1",
      "rmaId": "rma-prior-rec1",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-001",
      "sourceFulfillmentId": "f1"
    },
    {
      "rowId": "p2",
      "receiptId": "prior-rec3",
      "rmaId": "rma-prior-rec3",
      "sourceOrderId": "o3",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003",
      "sourceFulfillmentId": "f3"
    }
  ],
  "shipmentColumns": {
    "rowId": "rowId",
    "fulfillmentId": "fulfillmentId",
    "orderId": "orderId",
    "customerId": "customerId",
    "itemId": "itemId",
    "serialNumber": "serialNumber"
  },
  "receiptColumns": {
    "rowId": "rowId",
    "receiptId": "receiptId",
    "rmaId": "rmaId",
    "sourceOrderId": "sourceOrderId",
    "sourceFulfillmentId": "sourceFulfillmentId",
    "customerId": "customerId",
    "itemId": "itemId",
    "serialNumber": "serialNumber"
  },
  "priorReceiptColumns": {
    "rowId": "rowId",
    "receiptId": "receiptId",
    "rmaId": "rmaId",
    "sourceOrderId": "sourceOrderId",
    "sourceFulfillmentId": "sourceFulfillmentId",
    "customerId": "customerId",
    "itemId": "itemId",
    "serialNumber": "serialNumber"
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

One full report item including original submissions, all current unit outcomes, duplicate and repeated receipt evidence.

## `json` (type: `string`):

No description

## `evidence` (type: `string`):

No description

## `findings` (type: `string`):

No description

## `html` (type: `string`):

Download then open the escaped standalone report locally.

# 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 = {
    "batchId": "returns-demo-0",
    "shipmentCoverage": "complete",
    "priorReceiptCoverage": "complete",
    "shipmentRows": [
        {
            "rowId": "s1",
            "fulfillmentId": "f1",
            "orderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-001"
        },
        {
            "rowId": "s2",
            "fulfillmentId": "f2",
            "orderId": "o2",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-002"
        },
        {
            "rowId": "s3",
            "fulfillmentId": "f3",
            "orderId": "o3",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003"
        },
        {
            "rowId": "s4",
            "fulfillmentId": "f4",
            "orderId": "o4",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003"
        },
        {
            "rowId": "s5",
            "fulfillmentId": "f5",
            "orderId": "o5",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-AMB"
        },
        {
            "rowId": "s6",
            "fulfillmentId": "f6",
            "orderId": "o5",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-AMB"
        },
        {
            "rowId": "dup",
            "fulfillmentId": "f7",
            "orderId": "o7",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-DUP"
        },
        {
            "rowId": "dup",
            "fulfillmentId": "f8",
            "orderId": "o8",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-OTHER"
        }
    ],
    "receiptRows": [
        {
            "rowId": "r1",
            "receiptId": "rec1",
            "rmaId": "rma-rec1",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-001",
            "sourceFulfillmentId": "f1"
        },
        {
            "rowId": "r2",
            "receiptId": "rec2",
            "rmaId": "rma-rec2",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-002"
        },
        {
            "rowId": "r3",
            "receiptId": "rec3",
            "rmaId": "rma-rec3",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": null
        },
        {
            "rowId": "r4",
            "receiptId": "rec4",
            "rmaId": "rma-rec4",
            "sourceOrderId": "o3",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
            "sourceFulfillmentId": "f3"
        },
        {
            "rowId": "r5",
            "receiptId": "rec5",
            "rmaId": "rma-rec5",
            "sourceOrderId": "o4",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
            "sourceFulfillmentId": "f4"
        },
        {
            "rowId": "r6",
            "receiptId": "rec6",
            "rmaId": "rma-rec6",
            "sourceOrderId": "o5",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-AMB"
        },
        {
            "rowId": "r7",
            "receiptId": "rec7",
            "rmaId": "rma-rec7",
            "sourceOrderId": "o7",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-DUP"
        },
        {
            "rowId": "r8",
            "receiptId": "rec8",
            "rmaId": "rma-rec8",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-NO"
        }
    ],
    "priorReceiptRows": [
        {
            "rowId": "p1",
            "receiptId": "prior-rec1",
            "rmaId": "rma-prior-rec1",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-001",
            "sourceFulfillmentId": "f1"
        },
        {
            "rowId": "p2",
            "receiptId": "prior-rec3",
            "rmaId": "rma-prior-rec3",
            "sourceOrderId": "o3",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
            "sourceFulfillmentId": "f3"
        }
    ],
    "shipmentsCsv": "",
    "receiptsCsv": "",
    "priorReceiptsCsv": "",
    "shipmentColumns": {
        "rowId": "rowId",
        "fulfillmentId": "fulfillmentId",
        "orderId": "orderId",
        "customerId": "customerId",
        "itemId": "itemId",
        "serialNumber": "serialNumber"
    },
    "receiptColumns": {
        "rowId": "rowId",
        "receiptId": "receiptId",
        "rmaId": "rmaId",
        "sourceOrderId": "sourceOrderId",
        "sourceFulfillmentId": "sourceFulfillmentId",
        "customerId": "customerId",
        "itemId": "itemId",
        "serialNumber": "serialNumber"
    },
    "priorReceiptColumns": {
        "rowId": "rowId",
        "receiptId": "receiptId",
        "rmaId": "rmaId",
        "sourceOrderId": "sourceOrderId",
        "sourceFulfillmentId": "sourceFulfillmentId",
        "customerId": "customerId",
        "itemId": "itemId",
        "serialNumber": "serialNumber"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("h_murdock/return-serial-provenance-evidence").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 = {
    "batchId": "returns-demo-0",
    "shipmentCoverage": "complete",
    "priorReceiptCoverage": "complete",
    "shipmentRows": [
        {
            "rowId": "s1",
            "fulfillmentId": "f1",
            "orderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-001",
        },
        {
            "rowId": "s2",
            "fulfillmentId": "f2",
            "orderId": "o2",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-002",
        },
        {
            "rowId": "s3",
            "fulfillmentId": "f3",
            "orderId": "o3",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
        },
        {
            "rowId": "s4",
            "fulfillmentId": "f4",
            "orderId": "o4",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
        },
        {
            "rowId": "s5",
            "fulfillmentId": "f5",
            "orderId": "o5",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-AMB",
        },
        {
            "rowId": "s6",
            "fulfillmentId": "f6",
            "orderId": "o5",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-AMB",
        },
        {
            "rowId": "dup",
            "fulfillmentId": "f7",
            "orderId": "o7",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-DUP",
        },
        {
            "rowId": "dup",
            "fulfillmentId": "f8",
            "orderId": "o8",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-OTHER",
        },
    ],
    "receiptRows": [
        {
            "rowId": "r1",
            "receiptId": "rec1",
            "rmaId": "rma-rec1",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-001",
            "sourceFulfillmentId": "f1",
        },
        {
            "rowId": "r2",
            "receiptId": "rec2",
            "rmaId": "rma-rec2",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-002",
        },
        {
            "rowId": "r3",
            "receiptId": "rec3",
            "rmaId": "rma-rec3",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": None,
        },
        {
            "rowId": "r4",
            "receiptId": "rec4",
            "rmaId": "rma-rec4",
            "sourceOrderId": "o3",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
            "sourceFulfillmentId": "f3",
        },
        {
            "rowId": "r5",
            "receiptId": "rec5",
            "rmaId": "rma-rec5",
            "sourceOrderId": "o4",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
            "sourceFulfillmentId": "f4",
        },
        {
            "rowId": "r6",
            "receiptId": "rec6",
            "rmaId": "rma-rec6",
            "sourceOrderId": "o5",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-AMB",
        },
        {
            "rowId": "r7",
            "receiptId": "rec7",
            "rmaId": "rma-rec7",
            "sourceOrderId": "o7",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-DUP",
        },
        {
            "rowId": "r8",
            "receiptId": "rec8",
            "rmaId": "rma-rec8",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-NO",
        },
    ],
    "priorReceiptRows": [
        {
            "rowId": "p1",
            "receiptId": "prior-rec1",
            "rmaId": "rma-prior-rec1",
            "sourceOrderId": "o1",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-001",
            "sourceFulfillmentId": "f1",
        },
        {
            "rowId": "p2",
            "receiptId": "prior-rec3",
            "rmaId": "rma-prior-rec3",
            "sourceOrderId": "o3",
            "customerId": "cust-0",
            "itemId": "item-A",
            "serialNumber": "SN-003",
            "sourceFulfillmentId": "f3",
        },
    ],
    "shipmentsCsv": "",
    "receiptsCsv": "",
    "priorReceiptsCsv": "",
    "shipmentColumns": {
        "rowId": "rowId",
        "fulfillmentId": "fulfillmentId",
        "orderId": "orderId",
        "customerId": "customerId",
        "itemId": "itemId",
        "serialNumber": "serialNumber",
    },
    "receiptColumns": {
        "rowId": "rowId",
        "receiptId": "receiptId",
        "rmaId": "rmaId",
        "sourceOrderId": "sourceOrderId",
        "sourceFulfillmentId": "sourceFulfillmentId",
        "customerId": "customerId",
        "itemId": "itemId",
        "serialNumber": "serialNumber",
    },
    "priorReceiptColumns": {
        "rowId": "rowId",
        "receiptId": "receiptId",
        "rmaId": "rmaId",
        "sourceOrderId": "sourceOrderId",
        "sourceFulfillmentId": "sourceFulfillmentId",
        "customerId": "customerId",
        "itemId": "itemId",
        "serialNumber": "serialNumber",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("h_murdock/return-serial-provenance-evidence").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 '{
  "batchId": "returns-demo-0",
  "shipmentCoverage": "complete",
  "priorReceiptCoverage": "complete",
  "shipmentRows": [
    {
      "rowId": "s1",
      "fulfillmentId": "f1",
      "orderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-001"
    },
    {
      "rowId": "s2",
      "fulfillmentId": "f2",
      "orderId": "o2",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-002"
    },
    {
      "rowId": "s3",
      "fulfillmentId": "f3",
      "orderId": "o3",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003"
    },
    {
      "rowId": "s4",
      "fulfillmentId": "f4",
      "orderId": "o4",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003"
    },
    {
      "rowId": "s5",
      "fulfillmentId": "f5",
      "orderId": "o5",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-AMB"
    },
    {
      "rowId": "s6",
      "fulfillmentId": "f6",
      "orderId": "o5",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-AMB"
    },
    {
      "rowId": "dup",
      "fulfillmentId": "f7",
      "orderId": "o7",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-DUP"
    },
    {
      "rowId": "dup",
      "fulfillmentId": "f8",
      "orderId": "o8",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-OTHER"
    }
  ],
  "receiptRows": [
    {
      "rowId": "r1",
      "receiptId": "rec1",
      "rmaId": "rma-rec1",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-001",
      "sourceFulfillmentId": "f1"
    },
    {
      "rowId": "r2",
      "receiptId": "rec2",
      "rmaId": "rma-rec2",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-002"
    },
    {
      "rowId": "r3",
      "receiptId": "rec3",
      "rmaId": "rma-rec3",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": null
    },
    {
      "rowId": "r4",
      "receiptId": "rec4",
      "rmaId": "rma-rec4",
      "sourceOrderId": "o3",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003",
      "sourceFulfillmentId": "f3"
    },
    {
      "rowId": "r5",
      "receiptId": "rec5",
      "rmaId": "rma-rec5",
      "sourceOrderId": "o4",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003",
      "sourceFulfillmentId": "f4"
    },
    {
      "rowId": "r6",
      "receiptId": "rec6",
      "rmaId": "rma-rec6",
      "sourceOrderId": "o5",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-AMB"
    },
    {
      "rowId": "r7",
      "receiptId": "rec7",
      "rmaId": "rma-rec7",
      "sourceOrderId": "o7",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-DUP"
    },
    {
      "rowId": "r8",
      "receiptId": "rec8",
      "rmaId": "rma-rec8",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-NO"
    }
  ],
  "priorReceiptRows": [
    {
      "rowId": "p1",
      "receiptId": "prior-rec1",
      "rmaId": "rma-prior-rec1",
      "sourceOrderId": "o1",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-001",
      "sourceFulfillmentId": "f1"
    },
    {
      "rowId": "p2",
      "receiptId": "prior-rec3",
      "rmaId": "rma-prior-rec3",
      "sourceOrderId": "o3",
      "customerId": "cust-0",
      "itemId": "item-A",
      "serialNumber": "SN-003",
      "sourceFulfillmentId": "f3"
    }
  ],
  "shipmentsCsv": "",
  "receiptsCsv": "",
  "priorReceiptsCsv": "",
  "shipmentColumns": {
    "rowId": "rowId",
    "fulfillmentId": "fulfillmentId",
    "orderId": "orderId",
    "customerId": "customerId",
    "itemId": "itemId",
    "serialNumber": "serialNumber"
  },
  "receiptColumns": {
    "rowId": "rowId",
    "receiptId": "receiptId",
    "rmaId": "rmaId",
    "sourceOrderId": "sourceOrderId",
    "sourceFulfillmentId": "sourceFulfillmentId",
    "customerId": "customerId",
    "itemId": "itemId",
    "serialNumber": "serialNumber"
  },
  "priorReceiptColumns": {
    "rowId": "rowId",
    "receiptId": "receiptId",
    "rmaId": "rmaId",
    "sourceOrderId": "sourceOrderId",
    "sourceFulfillmentId": "sourceFulfillmentId",
    "customerId": "customerId",
    "itemId": "itemId",
    "serialNumber": "serialNumber"
  }
}' |
apify call h_murdock/return-serial-provenance-evidence --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,h_murdock/return-serial-provenance-evidence"
        }
    }
}
```

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/TOOmTFOFwLl8OcvxR/builds/AWM4l1Xu2OxdXs9ef/openapi.json
