{
  "openapi": "3.0.1",
  "info": {
    "title": "Dataset Diff: Compare Datasets, Get New & Changed Rows",
    "description": "Compare two Apify datasets or CSV, JSON or Excel files, or each run of a scraper with its last run: get only the new, changed and removed rows, with which fields changed and their old values. Chain it after any actor to monitor prices, stock, listings or jobs. Pay per change.",
    "version": "0.1",
    "x-build-id": "axfqv2vbBSIe5j00r"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/humble-echidna~dataset-diff/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-humble-echidna-dataset-diff",
        "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/humble-echidna~dataset-diff/runs": {
      "post": {
        "operationId": "runs-sync-humble-echidna-dataset-diff",
        "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/humble-echidna~dataset-diff/run-sync": {
      "post": {
        "operationId": "run-sync-humble-echidna-dataset-diff",
        "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": {
          "datasetId": {
            "title": "New data: Apify dataset",
            "type": "string",
            "description": "The latest data: the id or name of one of your own Apify datasets, e.g. the defaultDatasetId of a scraper's latest run (or pick one in the form). To run this actor after every run of a scraper in an integration, `{{resource.defaultDatasetId}}`. Read-only, with your own account's access. When it's set, fileUrl is ignored."
          },
          "fileUrl": {
            "title": "Or: new data file URL (CSV, JSON, JSONL or Excel)",
            "type": "string",
            "description": "Used only when datasetId is empty: a direct link to a CSV/TSV, JSON (a list of objects), JSON Lines or Excel (.xlsx, first sheet) file on a public web address (http/https, ports 80 and 443), up to 200 MB. The default is the US Treasury's official exchange rates for 2025-12-31 (174 currencies), the example's new data.",
            "default": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/od/rates_of_exchange?format=csv&filter=record_date:eq:2025-12-31&page[size]=300"
          },
          "previousDatasetId": {
            "title": "Compare with: Apify dataset",
            "type": "string",
            "description": "The older data to compare with, e.g. an earlier run's dataset. Leave this and previousFileUrl empty to compare with what this comparison saw on its last run (the usual set-up for a schedule: each run reports what's new since the one before). When it's set, previousFileUrl is ignored."
          },
          "previousFileUrl": {
            "title": "Or: compare with file URL",
            "type": "string",
            "description": "Used only when previousDatasetId is empty: a direct link to the older CSV, JSON, JSONL or Excel file. Leave empty (and previousDatasetId too) to compare with the last run. The default is the same Treasury table for 2025-09-30, the example's older data; it's only used together with the example's new data, never with your own.",
            "default": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service/v1/accounting/od/rates_of_exchange?format=csv&filter=record_date:eq:2025-09-30&page[size]=300"
          },
          "keyFields": {
            "title": "Key fields (what identifies a row)",
            "type": "array",
            "description": "The field or fields that identify the same row in both, one per line or comma-separated: e.g. `url`, `id`, or `name, city`; dots reach nested fields (`product.sku`). Two rows with the same key are compared field by field (changed or unchanged); a key only in the new data is new, only in the older data removed. Leave empty to compare whole rows: then any difference reads as one removed and one new row.",
            "items": {
              "type": "string"
            }
          },
          "compareFields": {
            "title": "Fields to compare",
            "type": "array",
            "description": "Only differences in these fields make a row changed, one per line (e.g. `price`, `stock`). Leave empty (the default) to compare every top-level field except the ignored ones. Values compare as they read: 12 and \"12\" are equal, and so are null, an empty text and a missing field.",
            "items": {
              "type": "string"
            }
          },
          "ignoreFields": {
            "title": "Fields to ignore",
            "type": "array",
            "description": "Fields that never make a row changed, one per line: typically what a scraper stamps on every run, like `scrapedAt`, `crawledAt` or a position in the results. Default: none.",
            "items": {
              "type": "string"
            }
          },
          "includeNew": {
            "title": "Report new rows",
            "type": "boolean",
            "description": "Default true: write a row for each key that wasn't in the older data (changeType `new`).",
            "default": true
          },
          "includeChanged": {
            "title": "Report changed rows",
            "type": "boolean",
            "description": "Default true: write the new version of each row whose compared fields differ (changeType `changed`), with changedFields and the old values in previousValues.",
            "default": true
          },
          "includeRemoved": {
            "title": "Report removed rows",
            "type": "boolean",
            "description": "Default true: write the old version of each key that is gone from the new data (changeType `removed`).",
            "default": true
          },
          "includeUnchanged": {
            "title": "Report unchanged rows",
            "type": "boolean",
            "description": "Default false. When true, also write rows that didn't change (changeType `unchanged`), e.g. to get the full current data with a change label on every row. Each is a charged row.",
            "default": false
          },
          "firstRun": {
            "title": "First run with no earlier data",
            "enum": [
              "all",
              "baseline"
            ],
            "type": "string",
            "description": "Only when comparing with the last run, on the very first run (nothing remembered yet). `all` (the default): every row is reported as new. `baseline`: the rows are remembered and nothing is reported, so a schedule only reports what's new from its second run on.",
            "default": "all"
          },
          "monitorName": {
            "title": "Comparison name",
            "type": "string",
            "description": "Only when comparing with the last run: a name that keeps this comparison's memory apart from others, e.g. `shop-a-prices`. Leave empty (the default) to name it after the saved task running it, or else the actor that wrote the dataset, or else the file URL. Set it when one scraper feeds two separate comparisons, or to start afresh (a new name has no memory)."
          },
          "maxResults": {
            "title": "Max rows per run",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after writing this many rows, e.g. 100. Minimum 1; leave empty (the default) for no limit. The run also stops cleanly at the maximum cost per run you set in the run options. Changes not written because of either limit aren't forgotten: the next run reports them."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}