{
  "openapi": "3.0.1",
  "info": {
    "title": "Apify Smart Dataset Comparator",
    "description": "Compare 2-10 Apify datasets to detect changes, new/removed records, and duplicates. Features field-level diffs, smart merging, schema validation, data cleaning, and anomaly detection. Perfect for price monitoring, lead deduplication, and data quality tracking.",
    "version": "1.0",
    "x-build-id": "oPFUJl3JyquCczUHX"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/agenscrape~apify-smart-dataset-comparator/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-agenscrape-apify-smart-dataset-comparator",
        "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/agenscrape~apify-smart-dataset-comparator/runs": {
      "post": {
        "operationId": "runs-sync-agenscrape-apify-smart-dataset-comparator",
        "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/agenscrape~apify-smart-dataset-comparator/run-sync": {
      "post": {
        "operationId": "run-sync-agenscrape-apify-smart-dataset-comparator",
        "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": {
          "datasetIds": {
            "title": "Dataset IDs",
            "type": "array",
            "description": "List of Apify Dataset IDs to compare (2-10 datasets). Order matters - first is baseline, subsequent are compared against it.",
            "items": {
              "type": "string"
            }
          },
          "datasetUrls": {
            "title": "Dataset URLs",
            "type": "array",
            "description": "URLs to JSON or CSV files (alternative to Dataset IDs)",
            "items": {
              "type": "string"
            }
          },
          "primaryKey": {
            "title": "Primary Key",
            "type": "string",
            "description": "Field(s) to uniquely identify records. Use dot notation for nested fields (e.g., 'product.id'). For composite keys, use comma-separated values: 'url,sku'",
            "default": "id"
          },
          "ignoreFields": {
            "title": "Ignore Fields",
            "type": "array",
            "description": "Fields to ignore when comparing records (e.g., timestamps, internal IDs)",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "preset": {
            "title": "Comparison Preset",
            "enum": [
              "none",
              "price_monitoring",
              "lead_lists",
              "seo",
              "real_estate"
            ],
            "type": "string",
            "description": "Pre-configured settings for common use cases",
            "default": "none"
          },
          "sensitivity": {
            "title": "Comparison Sensitivity",
            "enum": [
              "strict",
              "medium",
              "relaxed"
            ],
            "type": "string",
            "description": "How strict should the comparison be?",
            "default": "strict"
          },
          "numericTolerance": {
            "title": "Numeric Tolerance (%)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Ignore numeric changes smaller than this percentage (e.g., 1 = ignore changes <= 1%)",
            "default": 0
          },
          "caseSensitive": {
            "title": "Case Sensitive",
            "type": "boolean",
            "description": "Should string comparisons be case-sensitive?",
            "default": true
          },
          "cleaningRules": {
            "title": "Data Cleaning Rules",
            "type": "object",
            "description": "Rules to normalize data before comparison",
            "default": {}
          },
          "detectDuplicates": {
            "title": "Detect Duplicates",
            "type": "boolean",
            "description": "Find duplicate records within each dataset",
            "default": false
          },
          "fuzzyMatching": {
            "title": "Fuzzy Duplicate Matching",
            "type": "boolean",
            "description": "Use fuzzy matching to find near-duplicates (Levenshtein distance)",
            "default": false
          },
          "fuzzyThreshold": {
            "title": "Fuzzy Match Threshold",
            "minimum": 0.5,
            "maximum": 1,
            "type": "number",
            "description": "Similarity threshold for fuzzy matching (0-1, where 1 = exact match)",
            "default": 0.85
          },
          "duplicateFields": {
            "title": "Duplicate Detection Fields",
            "type": "array",
            "description": "Additional fields to check for near-match duplicates",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "mergeStrategy": {
            "title": "Merge Strategy",
            "enum": [
              "left_priority",
              "right_priority",
              "most_recent",
              "most_complete",
              "combine_arrays",
              "average_numbers"
            ],
            "type": "string",
            "description": "How to merge records when they exist in multiple datasets",
            "default": "left_priority"
          },
          "timestampField": {
            "title": "Timestamp Field",
            "type": "string",
            "description": "Field name containing record timestamp (for 'most_recent' merge strategy)",
            "default": "timestamp"
          },
          "fieldPriorities": {
            "title": "Field-Level Priorities",
            "type": "object",
            "description": "Custom merge priorities per field: left, right, max, min, average, longest, combine",
            "default": {}
          },
          "validateSchema": {
            "title": "Validate Schema",
            "type": "boolean",
            "description": "Compare schemas across datasets and detect inconsistencies",
            "default": false
          },
          "strictSchemaValidation": {
            "title": "Strict Schema Validation",
            "type": "boolean",
            "description": "Report all type mismatches and unexpected fields as errors",
            "default": false
          },
          "outputSeparateDatasets": {
            "title": "Output to Separate Datasets",
            "type": "boolean",
            "description": "Save results to named datasets (changes, new_records, removed_records, merged_final, duplicates, stats)",
            "default": true
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "URL to receive notification when comparison completes"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}