{
  "openapi": "3.0.1",
  "info": {
    "title": "Knowledge Delta | RAG Knowledge Base Change Detection",
    "description": "Compare crawler exports and saved snapshots. Generate stable chunk upserts, metadata updates and guarded deletes for RAG pipelines. Process up to 1,000 documents per plan; no model API required.",
    "version": "1.0",
    "x-build-id": "E7p9SrVNpKxNoDZWN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/futurefortune~knowledge-delta/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-futurefortune-knowledge-delta",
        "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/futurefortune~knowledge-delta/runs": {
      "post": {
        "operationId": "runs-sync-futurefortune-knowledge-delta",
        "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/futurefortune~knowledge-delta/run-sync": {
      "post": {
        "operationId": "run-sync-futurefortune-knowledge-delta",
        "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": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Source mode",
            "enum": [
              "demo",
              "documents",
              "dataset"
            ],
            "type": "string",
            "description": "Demo is a free synthetic comparison. Documents accepts pasted exports; Dataset reads an existing finished crawler dataset in your account.",
            "default": "demo"
          },
          "documents": {
            "title": "Content documents",
            "type": "array",
            "description": "JSON rows with id or url and markdown or text. Optional title. Maximum 1,000 documents and 2 million total text characters. Used in Documents mode.",
            "items": {
              "type": "object"
            }
          },
          "sourceDatasetId": {
            "title": "Source dataset ID",
            "type": "string",
            "description": "17-character ID of an immutable dataset from a finished crawl. Used only in Dataset mode."
          },
          "namespace": {
            "title": "Knowledge base namespace",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}$",
            "type": "string",
            "description": "Stable name identifying one destination knowledge base. Keep unchanged on repeat runs; isolate different sources.",
            "default": "my-knowledge-base"
          },
          "previousSnapshot": {
            "title": "Previous committed snapshot",
            "type": "object",
            "description": "Paste a SNAPSHOT produced by this Actor only after its actions were successfully applied. Omit for a first import. Use either this field or a snapshot store ID."
          },
          "previousSnapshotStoreId": {
            "title": "Previous committed snapshot store ID",
            "type": "string",
            "description": "17-character key-value store ID from the last fully applied plan; reads its SNAPSHOT record. Do not use the latest run unless the destination applied it."
          },
          "chunkSize": {
            "title": "Maximum chunk characters",
            "minimum": 200,
            "maximum": 8000,
            "type": "integer",
            "description": "Paragraph-based chunk limit, in characters rather than tokens. Keep unchanged when reusing a snapshot.",
            "default": 1600
          },
          "completeSource": {
            "title": "Source is complete",
            "type": "boolean",
            "description": "Assert only when the export contains every document in this namespace. Never assert for limited, failed or partial crawls.",
            "default": false
          },
          "removeMissing": {
            "title": "Remove missing documents",
            "type": "boolean",
            "description": "Emit delete instructions for absent documents only with a complete source. Default keeps missing documents. Replaced chunks inside present documents are always removed.",
            "default": false
          },
          "maxDeletionRatio": {
            "title": "Maximum document deletion fraction",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Block the entire plan if missing-document deletions exceed this fraction of the prior document count. 0.2 means 20%. Raise only after verifying completeness.",
            "default": 0.2
          },
          "allowEmptySource": {
            "title": "Allow intentional empty source",
            "type": "boolean",
            "description": "Permit an empty documents array. Removing the whole knowledge base also requires complete source, remove missing and a deletion fraction of 1.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}