# Affiliate Program Terms & Commission Monitor (`kayorama/affiliate-program-terms-monitor`) Actor

Extract evidence-backed affiliate commission, cookie, payout, network, and application terms from public program pages and detect structured changes.

- **URL**: https://apify.com/kayorama/affiliate-program-terms-monitor.md
- **Developed by:** [Kayorama](https://apify.com/kayorama) (community)
- **Categories:** Marketing, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 affiliate program page processeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Affiliate Program Terms & Commission Monitor

Extract evidence-backed affiliate program terms from public pages and detect meaningful changes between runs.

### What it extracts

- percentage and fixed-amount commission claims;
- recurring versus one-time commission signals;
- cookie/attribution windows normalized to days;
- payout thresholds and payment cadence;
- named affiliate networks;
- open, closed, invite-only, or unknown application status;
- short evidence snippets, confidence level, hashes, redirects, and typed changes.

### Why use it

Affiliate publishers and partner teams often maintain terms in spreadsheets long after a program changes. This Actor produces structured snapshots that can be scheduled, compared, exported, or fed into an automation. It is designed for monitoring known public program pages—not for discovering every affiliate program on the web.

### Example input

```json
{
  "programUrls": [
    { "url": "https://vendor.example/affiliate-program" },
    { "url": "https://vendor.example/partners/terms" }
  ],
  "useStoredState": true,
  "stateStoreName": "affiliate-program-terms-monitor-aipick",
  "includeEvidence": true,
  "maxPrograms": 20
}
````

### Output

Each successful page produces one `program_snapshot`. Fetch failures produce `page_fetch_error` records. A final `summary` reports requested, attempted, analyzed, failed, and changed counts.

Snapshots include `terms`, `termsHash`, `contentHash`, `extractionConfidence`, and `changes`. A structured change is emitted only when an extracted term differs from the matching previous snapshot. A content-only change is reported separately when page text changed but extracted terms did not.

### Comparison modes

1. **Stored state** (default on Apify): the Actor compares with a named key-value store and replaces that record only when every requested page completed and spending did not stop the run. By default, its record key is a stable hash of the normalized URL set, so independent monitoring sets do not overwrite one another. `stateRecordKey` can override that namespace explicitly.
2. **Explicit snapshots**: pass prior `program_snapshot` rows in `previousSnapshots`. Explicit snapshots take precedence over stored state.

Named state is necessary because each Apify cloud run has its own default stores. Deleting the named key-value store or record resets the baseline. Explicit `previousSnapshots` take precedence without modifying how successful state is saved.

### Detection limits

Extraction is deterministic and heuristic. It does not use an LLM and does not provide legal advice. Dynamic client-rendered content, login walls, bot protection, unusual wording, images, PDFs, and ambiguous marketing copy can produce missing or inconclusive fields. Evidence snippets help a human verify each claim. `none` or `low` confidence means review is recommended.

The Actor does not claim that a program accepts a specific applicant, will pay, or still honors terms shown on a cached or stale public page.

### Network safety

User-controlled URLs and every redirect hop are limited to HTTP(S) public-network destinations. DNS results are checked before requests and again through a connection-time lookup policy. Redirect count, response size, request time, URL count, and concurrency are bounded. The Actor does not bypass logins, CAPTCHAs, or bot controls.

### Local use

```bash
npm ci
npm test
node src/cli.js examples/input.json examples/output.local.json
```

The CLI creates the output file exclusively and will not overwrite an existing file.

### Billing semantics

The primary event is `program-page-processed` at **$0.01 per attempted public program page**. It is charged immediately before the attempt. A page that later times out or returns an error may therefore still be billable, but the run emits a visible `page_fetch_error` record for that attempt. Processing stops cleanly if the spending cap rejects the next event. Dataset rows are not billed again.

Apify also charges its recommended `apify-actor-start` event at **$0.00005 per run** for memory allocations up to 1 GB. The minimum run budget is **$0.01005**, covering one start and one attempted page.

### Privacy

The Actor processes user-supplied URLs, public page text, DNS and HTTP metadata, redirects, short evidence snippets, hashes, run settings, and generated change records. Apify stores run inputs, datasets, logs, and optional named-state records according to the user's plan and retention settings. The operator does not sell submitted data, add unrelated analytics, or use page contents for model training.

Do not submit authentication tokens, private dashboards, intranet addresses, personal inboxes, or URLs containing secrets. Users are responsible for having a lawful basis to monitor supplied pages and for complying with applicable website, copyright, database, privacy, and affiliate-program rules.

Disable `useStoredState` to avoid persistent snapshots, or delete the relevant run, dataset, and named key-value record in Apify Console.

### Support

For product help, privacy requests, or responsible security reports, email **info@kayorama.nl** and include the Actor name and relevant run ID. Do not send credentials or sensitive page content. Support covers reproducible Actor defects and documented input/output behavior; it does not include legal advice, guaranteed extraction from blocked or dynamic pages, or affiliate-program acceptance and payout disputes.

# Actor input Schema

## `programUrls` (type: `array`):

Public HTTP(S) affiliate, partner, referral, or program-terms pages to inspect.

## `previousSnapshots` (type: `array`):

Optional snapshot records from a previous run. Matching is by normalized requested URL.

## `useStoredState` (type: `boolean`):

On Apify, compare with and replace prior snapshots in a named key-value store after a fully successful run.

## `stateStoreName` (type: `string`):

Named Apify key-value store used across runs. Use a different name for independent monitoring sets.

## `stateRecordKey` (type: `string`):

Optional record key inside the named state store. When omitted, a stable key is derived from the normalized URL set so independent monitors do not overwrite each other.

## `maxPrograms` (type: `integer`):

Maximum number of program URLs processed in this run.

## `concurrency` (type: `integer`):

Maximum public pages fetched at the same time.

## `timeoutSecs` (type: `integer`):

Timeout in seconds for each HTTP request hop.

## `maxRedirects` (type: `integer`):

Maximum number of redirects followed for one program page.

## `includeEvidence` (type: `boolean`):

Include short source-text snippets for extracted fields. Snippets may contain public page text.

## Actor input object example

```json
{
  "programUrls": [
    {
      "url": "https://elevenlabs.io/affiliates"
    }
  ],
  "previousSnapshots": [],
  "useStoredState": true,
  "stateStoreName": "affiliate-program-terms-monitor-state",
  "maxPrograms": 20,
  "concurrency": 4,
  "timeoutSecs": 20,
  "maxRedirects": 5,
  "includeEvidence": true
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("kayorama/affiliate-program-terms-monitor").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("kayorama/affiliate-program-terms-monitor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call kayorama/affiliate-program-terms-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=kayorama/affiliate-program-terms-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Affiliate Program Terms & Commission Monitor",
        "description": "Extract evidence-backed affiliate commission, cookie, payout, network, and application terms from public program pages and detect structured changes.",
        "version": "0.1",
        "x-build-id": "rgOS12ZLEddBZMdWL"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/kayorama~affiliate-program-terms-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-kayorama-affiliate-program-terms-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/kayorama~affiliate-program-terms-monitor/runs": {
            "post": {
                "operationId": "runs-sync-kayorama-affiliate-program-terms-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/kayorama~affiliate-program-terms-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-kayorama-affiliate-program-terms-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "programUrls"
                ],
                "properties": {
                    "programUrls": {
                        "title": "Affiliate program pages",
                        "minItems": 1,
                        "maxItems": 50,
                        "type": "array",
                        "description": "Public HTTP(S) affiliate, partner, referral, or program-terms pages to inspect.",
                        "items": {
                            "type": "object",
                            "properties": {
                                "url": {
                                    "title": "URL",
                                    "type": "string",
                                    "description": "Public program page URL. Runtime checks enforce HTTP(S) and public-network destinations."
                                }
                            },
                            "required": [
                                "url"
                            ],
                            "additionalProperties": true
                        },
                        "default": [
                            {
                                "url": "https://elevenlabs.io/affiliates"
                            }
                        ]
                    },
                    "previousSnapshots": {
                        "title": "Previous snapshots",
                        "type": "array",
                        "description": "Optional snapshot records from a previous run. Matching is by normalized requested URL.",
                        "default": []
                    },
                    "useStoredState": {
                        "title": "Compare with stored state",
                        "type": "boolean",
                        "description": "On Apify, compare with and replace prior snapshots in a named key-value store after a fully successful run.",
                        "default": true
                    },
                    "stateStoreName": {
                        "title": "State store name",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$",
                        "minLength": 1,
                        "maxLength": 63,
                        "type": "string",
                        "description": "Named Apify key-value store used across runs. Use a different name for independent monitoring sets.",
                        "default": "affiliate-program-terms-monitor-state"
                    },
                    "stateRecordKey": {
                        "title": "State record key",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$",
                        "minLength": 1,
                        "maxLength": 64,
                        "type": "string",
                        "description": "Optional record key inside the named state store. When omitted, a stable key is derived from the normalized URL set so independent monitors do not overwrite each other."
                    },
                    "maxPrograms": {
                        "title": "Maximum programs",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Maximum number of program URLs processed in this run.",
                        "default": 20
                    },
                    "concurrency": {
                        "title": "Concurrency",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Maximum public pages fetched at the same time.",
                        "default": 4
                    },
                    "timeoutSecs": {
                        "title": "Request timeout",
                        "minimum": 5,
                        "maximum": 60,
                        "type": "integer",
                        "description": "Timeout in seconds for each HTTP request hop.",
                        "default": 20
                    },
                    "maxRedirects": {
                        "title": "Maximum redirects",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Maximum number of redirects followed for one program page.",
                        "default": 5
                    },
                    "includeEvidence": {
                        "title": "Include evidence snippets",
                        "type": "boolean",
                        "description": "Include short source-text snippets for extracted fields. Snippets may contain public page text.",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
