{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Diff & Alert Monitor",
    "description": "Run any Actor or read any dataset, diff it against the last run by key, and push added / changed / removed rows to a webhook, Telegram, Discord or Slack. Pay per row compared and per notification.",
    "version": "1.0",
    "x-build-id": "1rHkrCbToLEjVRds9"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/mdcurt~dataset-diff-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-mdcurt-dataset-diff-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/mdcurt~dataset-diff-monitor/runs": {
      "post": {
        "operationId": "runs-sync-mdcurt-dataset-diff-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/mdcurt~dataset-diff-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-mdcurt-dataset-diff-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": [
          "keyFields"
        ],
        "properties": {
          "sourceActorId": {
            "title": "Source Actor",
            "type": "string",
            "description": "Actor to run before diffing, as `username/actor-name` or an Actor ID. Its run is charged to your account at that Actor's own price. Leave empty to diff an existing dataset instead."
          },
          "sourceInput": {
            "title": "Source Actor input",
            "type": "object",
            "description": "Input JSON passed to the source Actor."
          },
          "sourceTaskId": {
            "title": "Source Task",
            "type": "string",
            "description": "Alternative to Source Actor: a saved Task (`username/task-name` or ID) to run. Its stored input is used unless Source Actor input is also set."
          },
          "sourceTimeoutSecs": {
            "title": "Source run timeout (seconds)",
            "minimum": 60,
            "maximum": 86400,
            "type": "integer",
            "description": "How long to wait for the source Actor or Task before giving up.",
            "default": 3600
          },
          "datasetId": {
            "title": "Dataset to diff",
            "type": "string",
            "description": "Dataset ID or name to diff when no source Actor or Task is set. Also used as the override when you want to diff a specific run's dataset."
          },
          "previousDatasetId": {
            "title": "Compare against this dataset (one-off)",
            "type": "string",
            "description": "Optional. Diff `Dataset to diff` against this dataset instead of the stored snapshot. The stored snapshot is still updated afterwards."
          },
          "keyFields": {
            "title": "Key fields",
            "type": "array",
            "description": "Field(s) that identify an item across runs, e.g. `url`, or `id`, or `title` + `company`. Nested paths like `product.sku` work. Items missing every key field are skipped and counted in the summary.",
            "items": {
              "type": "string"
            }
          },
          "watchFields": {
            "title": "Watch only these fields",
            "type": "array",
            "description": "Optional. Only a change in one of these fields counts as `changed`. Empty means every field except the ignored ones.",
            "items": {
              "type": "string"
            }
          },
          "ignoreFields": {
            "title": "Ignore these fields",
            "type": "array",
            "description": "Fields that change every run but do not matter, e.g. `scrapedAt`, `position`, `rank`.",
            "items": {
              "type": "string"
            }
          },
          "notifyOn": {
            "title": "Notify on",
            "type": "array",
            "description": "Which change types trigger a notification and are written to the output dataset.",
            "items": {
              "type": "string",
              "enum": [
                "added",
                "changed",
                "removed"
              ],
              "enumTitles": [
                "Added items",
                "Changed items",
                "Removed items"
              ]
            },
            "default": [
              "added",
              "changed",
              "removed"
            ]
          },
          "firstRunBehavior": {
            "title": "On the first run",
            "enum": [
              "snapshot",
              "notify"
            ],
            "type": "string",
            "description": "There is no snapshot on the first run. `snapshot` stores the baseline silently; `notify` treats every item as added.",
            "default": "snapshot"
          },
          "snapshotStoreName": {
            "title": "Snapshot store",
            "type": "string",
            "description": "Named key-value store that keeps the last snapshot. One store can hold snapshots for many monitors.",
            "default": "dataset-diff-monitor"
          },
          "snapshotKey": {
            "title": "Snapshot key",
            "type": "string",
            "description": "Key for this monitor's snapshot inside the store. Leave empty to derive one from the source Actor/Task/dataset and the source input, so each distinct monitor gets its own key automatically."
          },
          "title": {
            "title": "Monitor title",
            "type": "string",
            "description": "Name shown at the top of every message, e.g. `Chicago data-engineer jobs`. Defaults to the source name."
          },
          "labelField": {
            "title": "Label field",
            "type": "string",
            "description": "Field shown as the item's name in messages, e.g. `title` or `name`. Falls back to the key.",
            "default": "title"
          },
          "urlField": {
            "title": "URL field",
            "type": "string",
            "description": "Field holding a link to the item, included in messages when present.",
            "default": "url"
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "Any HTTPS endpoint (n8n, Make, Zapier, your API). Receives one JSON POST with the summary and the changed rows."
          },
          "slackWebhookUrl": {
            "title": "Slack incoming webhook URL",
            "type": "string",
            "description": "Posts a text digest to a Slack channel."
          },
          "discordWebhookUrl": {
            "title": "Discord webhook URL",
            "type": "string",
            "description": "Posts a text digest to a Discord channel. Long digests are split into 2,000-character messages."
          },
          "telegramBotToken": {
            "title": "Telegram bot token",
            "type": "string",
            "description": "Token from @BotFather. Requires Telegram chat ID too."
          },
          "telegramChatId": {
            "title": "Telegram chat ID",
            "type": "string",
            "description": "Chat, group or channel ID the bot posts to."
          },
          "maxItemsPerMessage": {
            "title": "Max items per message",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "How many items to list per change type in chat digests and the webhook body. The output dataset always holds every change.",
            "default": 20
          },
          "notifyWhenNoChanges": {
            "title": "Notify when nothing changed",
            "type": "boolean",
            "description": "Send a short 'no changes' message so you know the monitor ran.",
            "default": false
          },
          "dryRun": {
            "title": "Dry run",
            "type": "boolean",
            "description": "Compute and write the diff but send no notifications and do not update the snapshot.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}