# Supplier Rebate Checker (`nathancole1992/supplier-rebate-checker`) Actor

Read supplier rebate contracts with GPT-6 Luna, review source-linked draft rules, then reconcile purchases and received rebates with decimal calculations.

- **URL**: https://apify.com/nathancole1992/supplier-rebate-checker.md
- **Developed by:** [Nathan Cole](https://apify.com/nathancole1992) (community)
- **Stats:** 2 total users, 1 monthly users, 71.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$500.00 / 1,000 completed calculations

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

## Supplier Rebate Checker

Turn a supplier rebate agreement into reviewable rules, then reconcile those rules against purchase records and rebates already received. Designed for bookkeepers, finance teams and procurement analysts checking one supplier and completed period at a time.

AI reads the contract; a separate decimal calculator checks the money. Source excerpts and included/excluded ledger rows make the result traceable. The result identifies a difference to review, not a guaranteed payment or an automatically submitted claim.

The input form starts with a labelled fictional example. AI processing and all review/completeness confirmations are off, so running it unchanged returns a `needs_review` report with no final rebate or difference and no calculation fee. Replace every example field with your own records and review the agreement before confirming it. API requests must supply their own audit fields; missing data is never filled with the example.

### Two operations

#### 1. Read an agreement

Select **Read contract with GPT-6 Luna**. Supply complete `contractText`, set `allowAI` to true, and enter your OpenAI API key in the encrypted `openaiApiKey` field. Your OpenAI project must have access to `gpt-6-luna`. No other model is substituted.

You can instead supply `document` as an object with `name` and base64-encoded `content`. Accepted files: text PDFs, TXT and Markdown, up to 5 MB and 80 PDF pages. Extraction accepts up to 120,000 characters. Scanned pages need OCR before upload; oversized or unreadable input is rejected rather than silently omitted.

The run writes `DRAFT` (JSON) and `DRAFT_REPORT` (HTML). Review every proposed field and source quote against the complete agreement. Missing fields, unverified quotations and unsupported conditions remain unresolved. AI can miss or misunderstand clauses even when its quotations match.

Every returned agreement has `confirmed: false`. Extraction never calculates money or confirms data completeness.

#### 2. Audit reviewed rules

Select **Audit confirmed rules**. Copy the reviewed `agreement` object from the draft into this input, supply the purchase and statement CSVs, and set `asOfDate` to the review date. Only set `agreement.confirmed`, `ledgerComplete` and `statementComplete` to true once you have checked them.

Do not delete a genuine unresolved condition to force a calculation. Caps, growth targets, discretionary payment, missing schedules and other unsupported obligations require separate review or another calculation method.

The audit supports retrospective and marginal percentage tiers, net goods after discounts excluding tax and freight, linked same-period credits, and final-period half-up rounding to two decimal places. Supported currencies are GBP, EUR and USD; one currency per audit. Tier minima and percentages are decimal strings, with the first minimum at zero. An empty included-product list means all products; an empty excluded-product list means no exclusions. Enter these only when the scope has been established.

**Purchase CSV headers:**

```csv
lineId,invoiceId,date,supplierId,currency,productCode,type,netAmount,originalLineId
```

Use `purchase` for positive goods lines and `credit` for negative returns. Each credit links to an included original purchase through `originalLineId`. Up to 20,000 rows per CSV, maximum 8 MB of CSV text.

**Statement CSV headers:**

```csv
lineId,supplierId,agreementId,periodStart,periodEnd,currency,rebateAmount,status
```

Statuses are `paid`, `credited` or `pending`. Supply header-only CSV if the complete statement genuinely contains no payments. Avoid counting the same settlement as both paid and credited. Overlapping periods, pending amounts, incomplete records and unresolved credits prevent a final comparison.

### Results

| Operation | Key-value store records | Dataset summary |
|---|---|---|
| Extract | `DRAFT` JSON, `DRAFT_REPORT` HTML | Draft status, model, source fingerprint, missing fields, unresolved count |
| Audit | `OUTPUT` JSON, `REPORT` HTML, `ROWS` CSV | Review status, spend, expected/received rebates, difference, findings and input fingerprint |

Only records for the chosen operation exist. `needs_review` withholds final expected rebate and difference as `null`. A failed input or model request produces an `ERROR` record and a failed run, with no successful dataset item. Correct input or credentials before retrying.

A fictional worked example with £24,000 eligible spend and a 3% retrospective rate calculates £720. With £600 received, the difference to review is £120. This is synthetic demonstration data, not a customer recovery or earnings claim.

JSON monetary values remain decimal strings. CSV exports escape potentially executable spreadsheet cells, including negative amount strings; use JSON for machine processing.

### Processing, privacy and costs

The Actor report fee is **$0.50 per completed calculation**. It applies once to an audit with a final calculated rebate and difference, including a matched result or an amount received above the calculation. AI drafts, blocked audits (`needs_review`) and failed inputs have no report fee. Set a run spending limit that covers one calculation. OpenAI usage remains separate and is billed to your own key.

Apify receives the input and stores run outputs under its storage and access settings. Keep contracts, purchase records and reports private. AI extraction additionally sends the supplied agreement text to OpenAI; the model request excludes separate purchase and statement inputs. Do not include credentials in contract text.

OpenAI usage is billed to your own key separately from Apify run and any displayed Actor charges. The encrypted key input is read through the Apify SDK and is never deliberately included in results or application logs. Audit mode makes no model requests. Extraction makes one request with a 90-second connection timeout, an 8,192-output-token limit and no automatic retries. A timed-out request may still incur provider usage.

Responses use `store: false`; this does not mean zero retention. The OpenAI account's applicable data controls still apply. See [OpenAI data controls](https://developers.openai.com/api/docs/guides/your-data).

This version is a review aid for the supported calculation rules. It does not establish legal entitlement, connect to accounting systems, send supplier claims, perform OCR or guarantee that every contract condition has been identified.

# Actor input Schema

## `operation` (type: `string`):

Extract returns an unconfirmed draft, without calculating money. Audit uses rules you have reviewed.

## `contractText` (type: `string`):

Extract mode: paste the complete contract, including relevant schedules. Maximum 120,000 characters; never truncated.

## `document` (type: `object`):

Extract mode alternative to contractText: {"name":"agreement.pdf","content":"BASE64"}. Text PDF/TXT/MD, up to 5 MB and 80 PDF pages. OCR is not included.

## `allowAI` (type: `boolean`):

Required true for extract mode. Sends only agreement text to OpenAI, not purchase or statement data. Response storage is disabled; applicable OpenAI retention controls still apply.

## `openaiApiKey` (type: `string`):

Extract mode: your OpenAI key with GPT-6 Luna access. Stored encrypted by Apify on the platform. Alternatively configure OPENAI_API_KEY in your private Actor environment. Never put a key in source text or examples.

## `agreement` (type: `object`):

The prefilled rules are a clearly labelled fictional example and remain unconfirmed. Replace them with your reviewed agreement, or follow examples/input.json. Confirm the full agreement; excerpt matching is not legal interpretation.

## `purchases` (type: `string`):

The prefilled rows are fictional example purchases. Replace them with your data. Headers: lineId,invoiceId,date,supplierId,currency,productCode,type,netAmount,originalLineId. Amounts exclude tax and freight; negative credits link to an eligible original line.

## `statement` (type: `string`):

The prefilled rows are a fictional example statement. Replace them with your data. Headers: lineId,supplierId,agreementId,periodStart,periodEnd,currency,rebateAmount,status. Status: paid, credited or pending. Supply header only for an explicitly complete zero-payment statement.

## `asOfDate` (type: `string`):

YYYY-MM-DD. The prefilled date belongs to the fictional example; replace it for your review. An open agreement period blocks a final comparison.

## `ledgerComplete` (type: `boolean`):

All relevant purchases and credits for this period are included.

## `statementComplete` (type: `boolean`):

All paid/credited rebates, including reversals, are included and no settlements are double-counted.

## Actor input object example

```json
{
  "operation": "audit",
  "allowAI": false,
  "agreement": {
    "confirmed": false,
    "sourceText": "FICTIONAL DEMONSTRATION AGREEMENT — NOT A REAL SUPPLIER CONTRACT\n\nAgreement ID: HW-2026-Q3\nSupplier ID: HW001\nSupplier name: Harbour Wholesale\nCurrency: GBP\nPeriod start: 2026-01-01\nPeriod end: 2026-09-30\nRebate mode: retrospective\nCalculation basis: net_goods_ex_tax_freight\nReturns policy: deduct_linked_credits\nRounding: period_half_up\nIncluded products: all\nExcluded products: NONREBATE\nTier: 0 => 0%\nTier: 10000 => 2%\nTier: 20000 => 3%\nClaim deadline: 2026-11-30\n\nThe highest spend tier reached applies to the entire eligible net purchase amount.\nAmounts are after discounts, excluding tax and freight. Deduct credits linked to\npurchases within this agreement period. Round the final period rebate half up\nto two decimal places. No other conditions apply to this synthetic example.\n",
    "evidence": [
      {
        "field": "agreementId",
        "quote": "Agreement ID: HW-2026-Q3"
      },
      {
        "field": "supplierId",
        "quote": "Supplier ID: HW001"
      },
      {
        "field": "supplierName",
        "quote": "Supplier name: Harbour Wholesale"
      },
      {
        "field": "currency",
        "quote": "Currency: GBP"
      },
      {
        "field": "periodStart",
        "quote": "Period start: 2026-01-01"
      },
      {
        "field": "periodEnd",
        "quote": "Period end: 2026-09-30"
      },
      {
        "field": "mode",
        "quote": "Rebate mode: retrospective"
      },
      {
        "field": "basis",
        "quote": "Calculation basis: net_goods_ex_tax_freight"
      },
      {
        "field": "returnsPolicy",
        "quote": "Returns policy: deduct_linked_credits"
      },
      {
        "field": "rounding",
        "quote": "Rounding: period_half_up"
      },
      {
        "field": "claimDeadline",
        "quote": "Claim deadline: 2026-11-30"
      },
      {
        "field": "tiers",
        "quote": "Tier: 0 => 0%"
      },
      {
        "field": "tiers",
        "quote": "Tier: 10000 => 2%"
      },
      {
        "field": "tiers",
        "quote": "Tier: 20000 => 3%"
      },
      {
        "field": "includedProductCodes",
        "quote": "Included products: all"
      },
      {
        "field": "excludedProductCodes",
        "quote": "Excluded products: NONREBATE"
      }
    ],
    "unresolvedTerms": [],
    "includedProductCodes": [],
    "excludedProductCodes": [
      "NONREBATE"
    ],
    "tiers": [
      {
        "minimumSpend": "0",
        "ratePercent": "0"
      },
      {
        "minimumSpend": "10000",
        "ratePercent": "2"
      },
      {
        "minimumSpend": "20000",
        "ratePercent": "3"
      }
    ],
    "agreementId": "HW-2026-Q3",
    "supplierId": "HW001",
    "supplierName": "Harbour Wholesale",
    "currency": "GBP",
    "periodStart": "2026-01-01",
    "periodEnd": "2026-09-30",
    "mode": "retrospective",
    "basis": "net_goods_ex_tax_freight",
    "returnsPolicy": "deduct_linked_credits",
    "rounding": "period_half_up",
    "claimDeadline": "2026-11-30"
  },
  "purchases": "lineId,invoiceId,date,supplierId,currency,productCode,type,netAmount,originalLineId\nP001,INV-1001,2026-01-15,HW001,GBP,GOODS-A,purchase,12500.00,\nP002,INV-1002,2026-07-20,HW001,GBP,GOODS-A,purchase,12500.00,\nC001,CR-1003,2026-08-03,HW001,GBP,GOODS-A,credit,-1000.00,P002\nP003,INV-1004,2026-09-20,HW001,GBP,NONREBATE,purchase,500.00,\nP004,INV-1005,2026-10-01,HW001,GBP,GOODS-A,purchase,1000.00,\nP005,INV-OTHER,2026-06-01,OTHER001,GBP,GOODS-A,purchase,3000.00,\n",
  "statement": "lineId,supplierId,agreementId,periodStart,periodEnd,currency,rebateAmount,status\nS001,HW001,HW-2026-Q3,2026-01-01,2026-09-30,GBP,600.00,paid\n",
  "asOfDate": "2026-10-15",
  "ledgerComplete": false,
  "statementComplete": false
}
```

# Actor output Schema

## `summary` (type: `string`):

One summary identifies whether this run extracted draft terms or audited confirmed rules. Financial amounts are decimal strings and are absent from extraction summaries.

## `auditJson` (type: `string`):

Audit operation only. Complete reconciliation, blocking findings and source references. Expected rebate and difference are null when review is required. This record is absent from extraction runs.

## `auditHtml` (type: `string`):

Audit operation only. Printable report of the confirmed-rule calculation and findings. A difference is not proof of a recoverable debt. This record is absent from extraction runs.

## `auditCsv` (type: `string`):

Audit operation only. Included and excluded source rows. Potential spreadsheet formulas are escaped; use the JSON report for exact machine-readable decimal text. This record is absent from extraction runs.

## `draftJson` (type: `string`):

Extraction operation only. Proposed agreement terms, missing fields and unresolved conditions. It is not an audit or a calculated rebate. The agreement must remain unconfirmed until a person reviews the full source. This record is absent from audit runs.

## `draftHtml` (type: `string`):

Extraction operation only. Human-readable proposed terms and uncertainties for source review. No financial conclusion is produced. This record is absent from audit runs.

# 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 = {
    "operation": "audit",
    "allowAI": false,
    "agreement": {
        "confirmed": false,
        "sourceText": "FICTIONAL DEMONSTRATION AGREEMENT — NOT A REAL SUPPLIER CONTRACT\n\nAgreement ID: HW-2026-Q3\nSupplier ID: HW001\nSupplier name: Harbour Wholesale\nCurrency: GBP\nPeriod start: 2026-01-01\nPeriod end: 2026-09-30\nRebate mode: retrospective\nCalculation basis: net_goods_ex_tax_freight\nReturns policy: deduct_linked_credits\nRounding: period_half_up\nIncluded products: all\nExcluded products: NONREBATE\nTier: 0 => 0%\nTier: 10000 => 2%\nTier: 20000 => 3%\nClaim deadline: 2026-11-30\n\nThe highest spend tier reached applies to the entire eligible net purchase amount.\nAmounts are after discounts, excluding tax and freight. Deduct credits linked to\npurchases within this agreement period. Round the final period rebate half up\nto two decimal places. No other conditions apply to this synthetic example.\n",
        "evidence": [
            {
                "field": "agreementId",
                "quote": "Agreement ID: HW-2026-Q3"
            },
            {
                "field": "supplierId",
                "quote": "Supplier ID: HW001"
            },
            {
                "field": "supplierName",
                "quote": "Supplier name: Harbour Wholesale"
            },
            {
                "field": "currency",
                "quote": "Currency: GBP"
            },
            {
                "field": "periodStart",
                "quote": "Period start: 2026-01-01"
            },
            {
                "field": "periodEnd",
                "quote": "Period end: 2026-09-30"
            },
            {
                "field": "mode",
                "quote": "Rebate mode: retrospective"
            },
            {
                "field": "basis",
                "quote": "Calculation basis: net_goods_ex_tax_freight"
            },
            {
                "field": "returnsPolicy",
                "quote": "Returns policy: deduct_linked_credits"
            },
            {
                "field": "rounding",
                "quote": "Rounding: period_half_up"
            },
            {
                "field": "claimDeadline",
                "quote": "Claim deadline: 2026-11-30"
            },
            {
                "field": "tiers",
                "quote": "Tier: 0 => 0%"
            },
            {
                "field": "tiers",
                "quote": "Tier: 10000 => 2%"
            },
            {
                "field": "tiers",
                "quote": "Tier: 20000 => 3%"
            },
            {
                "field": "includedProductCodes",
                "quote": "Included products: all"
            },
            {
                "field": "excludedProductCodes",
                "quote": "Excluded products: NONREBATE"
            }
        ],
        "unresolvedTerms": [],
        "includedProductCodes": [],
        "excludedProductCodes": [
            "NONREBATE"
        ],
        "tiers": [
            {
                "minimumSpend": "0",
                "ratePercent": "0"
            },
            {
                "minimumSpend": "10000",
                "ratePercent": "2"
            },
            {
                "minimumSpend": "20000",
                "ratePercent": "3"
            }
        ],
        "agreementId": "HW-2026-Q3",
        "supplierId": "HW001",
        "supplierName": "Harbour Wholesale",
        "currency": "GBP",
        "periodStart": "2026-01-01",
        "periodEnd": "2026-09-30",
        "mode": "retrospective",
        "basis": "net_goods_ex_tax_freight",
        "returnsPolicy": "deduct_linked_credits",
        "rounding": "period_half_up",
        "claimDeadline": "2026-11-30"
    },
    "purchases": `lineId,invoiceId,date,supplierId,currency,productCode,type,netAmount,originalLineId
P001,INV-1001,2026-01-15,HW001,GBP,GOODS-A,purchase,12500.00,
P002,INV-1002,2026-07-20,HW001,GBP,GOODS-A,purchase,12500.00,
C001,CR-1003,2026-08-03,HW001,GBP,GOODS-A,credit,-1000.00,P002
P003,INV-1004,2026-09-20,HW001,GBP,NONREBATE,purchase,500.00,
P004,INV-1005,2026-10-01,HW001,GBP,GOODS-A,purchase,1000.00,
P005,INV-OTHER,2026-06-01,OTHER001,GBP,GOODS-A,purchase,3000.00,`,
    "statement": `lineId,supplierId,agreementId,periodStart,periodEnd,currency,rebateAmount,status
S001,HW001,HW-2026-Q3,2026-01-01,2026-09-30,GBP,600.00,paid`,
    "asOfDate": "2026-10-15",
    "ledgerComplete": false,
    "statementComplete": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("nathancole1992/supplier-rebate-checker").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 = {
    "operation": "audit",
    "allowAI": False,
    "agreement": {
        "confirmed": False,
        "sourceText": """FICTIONAL DEMONSTRATION AGREEMENT — NOT A REAL SUPPLIER CONTRACT

Agreement ID: HW-2026-Q3
Supplier ID: HW001
Supplier name: Harbour Wholesale
Currency: GBP
Period start: 2026-01-01
Period end: 2026-09-30
Rebate mode: retrospective
Calculation basis: net_goods_ex_tax_freight
Returns policy: deduct_linked_credits
Rounding: period_half_up
Included products: all
Excluded products: NONREBATE
Tier: 0 => 0%
Tier: 10000 => 2%
Tier: 20000 => 3%
Claim deadline: 2026-11-30

The highest spend tier reached applies to the entire eligible net purchase amount.
Amounts are after discounts, excluding tax and freight. Deduct credits linked to
purchases within this agreement period. Round the final period rebate half up
to two decimal places. No other conditions apply to this synthetic example.
""",
        "evidence": [
            {
                "field": "agreementId",
                "quote": "Agreement ID: HW-2026-Q3",
            },
            {
                "field": "supplierId",
                "quote": "Supplier ID: HW001",
            },
            {
                "field": "supplierName",
                "quote": "Supplier name: Harbour Wholesale",
            },
            {
                "field": "currency",
                "quote": "Currency: GBP",
            },
            {
                "field": "periodStart",
                "quote": "Period start: 2026-01-01",
            },
            {
                "field": "periodEnd",
                "quote": "Period end: 2026-09-30",
            },
            {
                "field": "mode",
                "quote": "Rebate mode: retrospective",
            },
            {
                "field": "basis",
                "quote": "Calculation basis: net_goods_ex_tax_freight",
            },
            {
                "field": "returnsPolicy",
                "quote": "Returns policy: deduct_linked_credits",
            },
            {
                "field": "rounding",
                "quote": "Rounding: period_half_up",
            },
            {
                "field": "claimDeadline",
                "quote": "Claim deadline: 2026-11-30",
            },
            {
                "field": "tiers",
                "quote": "Tier: 0 => 0%",
            },
            {
                "field": "tiers",
                "quote": "Tier: 10000 => 2%",
            },
            {
                "field": "tiers",
                "quote": "Tier: 20000 => 3%",
            },
            {
                "field": "includedProductCodes",
                "quote": "Included products: all",
            },
            {
                "field": "excludedProductCodes",
                "quote": "Excluded products: NONREBATE",
            },
        ],
        "unresolvedTerms": [],
        "includedProductCodes": [],
        "excludedProductCodes": ["NONREBATE"],
        "tiers": [
            {
                "minimumSpend": "0",
                "ratePercent": "0",
            },
            {
                "minimumSpend": "10000",
                "ratePercent": "2",
            },
            {
                "minimumSpend": "20000",
                "ratePercent": "3",
            },
        ],
        "agreementId": "HW-2026-Q3",
        "supplierId": "HW001",
        "supplierName": "Harbour Wholesale",
        "currency": "GBP",
        "periodStart": "2026-01-01",
        "periodEnd": "2026-09-30",
        "mode": "retrospective",
        "basis": "net_goods_ex_tax_freight",
        "returnsPolicy": "deduct_linked_credits",
        "rounding": "period_half_up",
        "claimDeadline": "2026-11-30",
    },
    "purchases": """lineId,invoiceId,date,supplierId,currency,productCode,type,netAmount,originalLineId
P001,INV-1001,2026-01-15,HW001,GBP,GOODS-A,purchase,12500.00,
P002,INV-1002,2026-07-20,HW001,GBP,GOODS-A,purchase,12500.00,
C001,CR-1003,2026-08-03,HW001,GBP,GOODS-A,credit,-1000.00,P002
P003,INV-1004,2026-09-20,HW001,GBP,NONREBATE,purchase,500.00,
P004,INV-1005,2026-10-01,HW001,GBP,GOODS-A,purchase,1000.00,
P005,INV-OTHER,2026-06-01,OTHER001,GBP,GOODS-A,purchase,3000.00,
""",
    "statement": """lineId,supplierId,agreementId,periodStart,periodEnd,currency,rebateAmount,status
S001,HW001,HW-2026-Q3,2026-01-01,2026-09-30,GBP,600.00,paid
""",
    "asOfDate": "2026-10-15",
    "ledgerComplete": False,
    "statementComplete": False,
}

# Run the Actor and wait for it to finish
run = client.actor("nathancole1992/supplier-rebate-checker").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 '{
  "operation": "audit",
  "allowAI": false,
  "agreement": {
    "confirmed": false,
    "sourceText": "FICTIONAL DEMONSTRATION AGREEMENT — NOT A REAL SUPPLIER CONTRACT\\n\\nAgreement ID: HW-2026-Q3\\nSupplier ID: HW001\\nSupplier name: Harbour Wholesale\\nCurrency: GBP\\nPeriod start: 2026-01-01\\nPeriod end: 2026-09-30\\nRebate mode: retrospective\\nCalculation basis: net_goods_ex_tax_freight\\nReturns policy: deduct_linked_credits\\nRounding: period_half_up\\nIncluded products: all\\nExcluded products: NONREBATE\\nTier: 0 => 0%\\nTier: 10000 => 2%\\nTier: 20000 => 3%\\nClaim deadline: 2026-11-30\\n\\nThe highest spend tier reached applies to the entire eligible net purchase amount.\\nAmounts are after discounts, excluding tax and freight. Deduct credits linked to\\npurchases within this agreement period. Round the final period rebate half up\\nto two decimal places. No other conditions apply to this synthetic example.\\n",
    "evidence": [
      {
        "field": "agreementId",
        "quote": "Agreement ID: HW-2026-Q3"
      },
      {
        "field": "supplierId",
        "quote": "Supplier ID: HW001"
      },
      {
        "field": "supplierName",
        "quote": "Supplier name: Harbour Wholesale"
      },
      {
        "field": "currency",
        "quote": "Currency: GBP"
      },
      {
        "field": "periodStart",
        "quote": "Period start: 2026-01-01"
      },
      {
        "field": "periodEnd",
        "quote": "Period end: 2026-09-30"
      },
      {
        "field": "mode",
        "quote": "Rebate mode: retrospective"
      },
      {
        "field": "basis",
        "quote": "Calculation basis: net_goods_ex_tax_freight"
      },
      {
        "field": "returnsPolicy",
        "quote": "Returns policy: deduct_linked_credits"
      },
      {
        "field": "rounding",
        "quote": "Rounding: period_half_up"
      },
      {
        "field": "claimDeadline",
        "quote": "Claim deadline: 2026-11-30"
      },
      {
        "field": "tiers",
        "quote": "Tier: 0 => 0%"
      },
      {
        "field": "tiers",
        "quote": "Tier: 10000 => 2%"
      },
      {
        "field": "tiers",
        "quote": "Tier: 20000 => 3%"
      },
      {
        "field": "includedProductCodes",
        "quote": "Included products: all"
      },
      {
        "field": "excludedProductCodes",
        "quote": "Excluded products: NONREBATE"
      }
    ],
    "unresolvedTerms": [],
    "includedProductCodes": [],
    "excludedProductCodes": [
      "NONREBATE"
    ],
    "tiers": [
      {
        "minimumSpend": "0",
        "ratePercent": "0"
      },
      {
        "minimumSpend": "10000",
        "ratePercent": "2"
      },
      {
        "minimumSpend": "20000",
        "ratePercent": "3"
      }
    ],
    "agreementId": "HW-2026-Q3",
    "supplierId": "HW001",
    "supplierName": "Harbour Wholesale",
    "currency": "GBP",
    "periodStart": "2026-01-01",
    "periodEnd": "2026-09-30",
    "mode": "retrospective",
    "basis": "net_goods_ex_tax_freight",
    "returnsPolicy": "deduct_linked_credits",
    "rounding": "period_half_up",
    "claimDeadline": "2026-11-30"
  },
  "purchases": "lineId,invoiceId,date,supplierId,currency,productCode,type,netAmount,originalLineId\\nP001,INV-1001,2026-01-15,HW001,GBP,GOODS-A,purchase,12500.00,\\nP002,INV-1002,2026-07-20,HW001,GBP,GOODS-A,purchase,12500.00,\\nC001,CR-1003,2026-08-03,HW001,GBP,GOODS-A,credit,-1000.00,P002\\nP003,INV-1004,2026-09-20,HW001,GBP,NONREBATE,purchase,500.00,\\nP004,INV-1005,2026-10-01,HW001,GBP,GOODS-A,purchase,1000.00,\\nP005,INV-OTHER,2026-06-01,OTHER001,GBP,GOODS-A,purchase,3000.00,\\n",
  "statement": "lineId,supplierId,agreementId,periodStart,periodEnd,currency,rebateAmount,status\\nS001,HW001,HW-2026-Q3,2026-01-01,2026-09-30,GBP,600.00,paid\\n",
  "asOfDate": "2026-10-15",
  "ledgerComplete": false,
  "statementComplete": false
}' |
apify call nathancole1992/supplier-rebate-checker --silent --output-dataset

```

## MCP server setup

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

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/WZlI0uev3v3mVnkOl/builds/VcdrvXzhBuRJevuHC/openapi.json
