{
  "openapi": "3.0.1",
  "info": {
    "title": "Spreadsheet Doctor: Clean, Dedupe, Join & Reconcile CSV/Excel",
    "description": "Clean messy CSV/XLSX files (emails, E.164 phones, ISO dates, numbers, ZIPs), remove duplicates, join several files on a key, and reconcile two files cell by cell. Strict JSON schemas, fail-loud error codes, built for AI agents.",
    "version": "0.1",
    "x-build-id": "om6lO3V9k3rDH0svP"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/errandkit~spreadsheet-doctor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-errandkit-spreadsheet-doctor",
        "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/errandkit~spreadsheet-doctor/runs": {
      "post": {
        "operationId": "runs-sync-errandkit-spreadsheet-doctor",
        "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/errandkit~spreadsheet-doctor/run-sync": {
      "post": {
        "operationId": "run-sync-errandkit-spreadsheet-doctor",
        "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": [
          "operation"
        ],
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "profile",
              "clean",
              "dedupe",
              "join",
              "reconcile"
            ],
            "type": "string",
            "description": "profile = inspect only; clean = fix formats; dedupe = remove duplicates; join = merge 2-10 files on a key; reconcile = compare exactly 2 files cell by cell."
          },
          "fileUrls": {
            "title": "Files (upload or URLs)",
            "maxItems": 10,
            "type": "array",
            "description": "Upload CSV/TSV/XLSX files or paste public http(s) URLs. Order matters for join (left to right) and reconcile (left, right). Max 10 files, 10 MB each."
          },
          "inlineFiles": {
            "title": "Inline files (for API / AI agents)",
            "maxItems": 10,
            "type": "array",
            "description": "Alternative to uploads: [{\"name\": \"a.csv\", \"text\": \"email,name\\nx@y.com,X\"}] or {\"name\": \"b.xlsx\", \"content_base64\": \"...\"}. Inline files come after uploaded files."
          },
          "keys": {
            "title": "Key columns",
            "maxItems": 10,
            "type": "array",
            "description": "Columns that identify a record. dedupe: duplicate keys (empty = whole row). join: 'on' columns present in every file. reconcile: key columns of the left file. Original or snake_case names both work.",
            "items": {
              "type": "string"
            }
          },
          "keysPerFile": {
            "title": "Key columns per file (join/reconcile)",
            "type": "object",
            "description": "Only when key names differ between files, e.g. {\"billing.xlsx\": [\"Customer Email\"]}. For reconcile, the entry for the second file is used as its keys."
          },
          "how": {
            "title": "Join type",
            "enum": [
              "inner",
              "left",
              "outer"
            ],
            "type": "string",
            "description": "inner = only matches; left = all rows of the first file; outer = all rows of all files.",
            "default": "left"
          },
          "match": {
            "title": "Key matching",
            "enum": [
              "normalized",
              "exact"
            ],
            "type": "string",
            "description": "normalized ignores case, spaces and punctuation in keys; exact compares as-is.",
            "default": "normalized"
          },
          "keep": {
            "title": "Which duplicate to keep (dedupe)",
            "enum": [
              "merge",
              "first",
              "last"
            ],
            "type": "string",
            "description": "merge = keep the first row and fill its empty cells from later duplicates.",
            "default": "merge"
          },
          "compareColumns": {
            "title": "Columns to compare (reconcile)",
            "type": "array",
            "description": "Default: every non-key column present in both files.",
            "items": {
              "type": "string"
            }
          },
          "numericTolerance": {
            "title": "Numeric tolerance (reconcile)",
            "minimum": 0,
            "type": "number",
            "description": "Treat numbers within this absolute difference as equal.",
            "default": 0
          },
          "cleanOptions": {
            "title": "Cleaning options",
            "type": "object",
            "description": "Optional overrides, e.g. {\"date_order\": \"DMY\", \"default_phone_region\": \"GB\", \"column_types\": {\"Mobile\": \"phone\"}}. See README for all fields."
          },
          "outputFormat": {
            "title": "Output file format",
            "enum": [
              "csv",
              "xlsx",
              "both"
            ],
            "type": "string",
            "description": "Files saved to the key-value store for each output table.",
            "default": "csv"
          },
          "maxDatasetRows": {
            "title": "Max rows pushed to the dataset",
            "minimum": 0,
            "maximum": 200000,
            "type": "integer",
            "description": "Output rows are also pushed to the dataset (handy for agents). Full tables are always in the key-value store.",
            "default": 10000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}