{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Diff & Change Detector (Added / Removed / Modified)",
    "description": "Compare Apify Datasets, CSV/JSON/XLSX snapshots, or automatic stateful baselines to detect added, removed, and field-level modified rows with numeric % deltas, plain-English summaries, and Standby MCP.",
    "version": "1.0",
    "x-build-id": "bL3dZ7aA5Y2FUNa90"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forgekit~dataset-diff-change-detector/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forgekit-dataset-diff-change-detector",
        "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/forgekit~dataset-diff-change-detector/runs": {
      "post": {
        "operationId": "runs-sync-forgekit-dataset-diff-change-detector",
        "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/forgekit~dataset-diff-change-detector/run-sync": {
      "post": {
        "operationId": "run-sync-forgekit-dataset-diff-change-detector",
        "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",
        "properties": {
          "mode": {
            "title": "Comparison Mode",
            "enum": [
              "two-source",
              "stateful-snapshot"
            ],
            "type": "string",
            "description": "Compare two explicit sources (two-source) or compare current data against a persisted KV baseline snapshot (stateful-snapshot).",
            "default": "two-source"
          },
          "baselineDatasetId": {
            "title": "Baseline Apify Dataset ID",
            "maxLength": 128,
            "type": "string",
            "description": "Apify Dataset ID containing baseline (previous) records.",
            "default": ""
          },
          "currentDatasetId": {
            "title": "Current Apify Dataset ID",
            "maxLength": 128,
            "type": "string",
            "description": "Apify Dataset ID containing current (latest) records.",
            "default": ""
          },
          "baselineFileUrl": {
            "title": "Baseline File URL",
            "maxLength": 2048,
            "type": "string",
            "description": "Public CSV, JSON, NDJSON, or XLSX URL for the baseline snapshot (SSRF-protected).",
            "default": ""
          },
          "currentFileUrl": {
            "title": "Current File URL",
            "maxLength": 2048,
            "type": "string",
            "description": "Public CSV, JSON, NDJSON, or XLSX URL for the current snapshot (SSRF-protected).",
            "default": ""
          },
          "baselineRows": {
            "title": "Baseline Inline Rows",
            "maxItems": 50000,
            "type": "array",
            "description": "Inline JSON array of baseline records.",
            "default": []
          },
          "currentRows": {
            "title": "Current Inline Rows",
            "maxItems": 50000,
            "type": "array",
            "description": "Inline JSON array of current records.",
            "default": []
          },
          "snapshotStoreName": {
            "title": "Stateful Snapshot KV Store Name",
            "maxLength": 63,
            "type": "string",
            "description": "Named Apify Key-Value Store holding persistent baselines in stateful-snapshot mode.",
            "default": "dataset-diff-snapshots"
          },
          "snapshotName": {
            "title": "Snapshot Name",
            "maxLength": 128,
            "type": "string",
            "description": "Identifier for this monitored dataset inside snapshotStoreName.",
            "default": "default-baseline"
          },
          "updateSnapshot": {
            "title": "Update Saved Snapshot After Diff",
            "type": "boolean",
            "description": "Persist current rows as the new baseline upon completion (set false for dry-run).",
            "default": true
          },
          "emitInitialBaselineAsAdded": {
            "title": "Emit First Baseline Rows as Added",
            "type": "boolean",
            "description": "When false (default), the very first stateful baseline run records the snapshot quietly without flooding alerts.",
            "default": false
          },
          "keyFields": {
            "title": "Primary Key Fields",
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "description": "One or more dot-notation field names uniquely identifying each record across snapshots.",
            "default": [
              "id"
            ],
            "items": {
              "type": "string"
            }
          },
          "trackFields": {
            "title": "Tracked Fields Allowlist",
            "maxItems": 100,
            "type": "array",
            "description": "If non-empty, only diff these specific fields (empty diffs all fields except ignoreFields).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "ignoreFields": {
            "title": "Ignored Volatile Fields",
            "maxItems": 100,
            "type": "array",
            "description": "Volatile metadata columns excluded from diff comparison to eliminate false-positive noise.",
            "default": [
              "scrapedAt",
              "timestamp",
              "crawledAt",
              "runId"
            ],
            "items": {
              "type": "string"
            }
          },
          "includeStatuses": {
            "title": "Change Statuses to Emit",
            "maxItems": 4,
            "type": "array",
            "description": "Record categories to push to the output dataset (added, removed, modified, unchanged).",
            "items": {
              "type": "string"
            },
            "default": [
              "added",
              "removed",
              "modified"
            ]
          },
          "numericTolerance": {
            "title": "Numeric Noise Tolerance",
            "minimum": 0,
            "maximum": 1000000,
            "type": "number",
            "description": "Ignore numeric differences where abs(after - before) <= numericTolerance.",
            "default": 0
          },
          "minPercentChange": {
            "title": "Minimum Percent Change Threshold",
            "minimum": 0,
            "maximum": 10000,
            "type": "number",
            "description": "Only treat numeric field moves whose absolute percentage change is >= minPercentChange as modified.",
            "default": 0
          },
          "ignoreCaseAndWhitespace": {
            "title": "Ignore Case & Whitespace",
            "type": "boolean",
            "description": "Normalize string casing and collapse surrounding/inner whitespace before equality checks.",
            "default": false
          },
          "ignoreArrayOrder": {
            "title": "Ignore Array Order",
            "type": "boolean",
            "description": "Compare arrays as unordered multisets so reordered tags or categories do not trigger false diffs.",
            "default": false
          },
          "webhookUrl": {
            "title": "Change Alert Webhook URL",
            "type": "string",
            "description": "Optional HTTP/HTTPS webhook endpoint notified with diff summary + top changes (SSRF-protected, stored encrypted as secret)."
          },
          "webhookSkipIfNoChanges": {
            "title": "Skip Webhook When No Changes",
            "type": "boolean",
            "description": "Suppress webhook delivery when totalChanges === 0 to prevent quiet-run alert fatigue.",
            "default": true
          },
          "allowEmptyBaselineOverwrite": {
            "title": "Allow Empty Current Data to Overwrite Baseline",
            "type": "boolean",
            "description": "Safety guard: when false (default), an empty current snapshot will never wipe an existing baseline or falsely mark every record as removed.",
            "default": false
          },
          "maxRows": {
            "title": "Max Rows Compared Per Side",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Hard safety cap on records compared per snapshot and emitted to the dataset.",
            "default": 100000
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}