{
  "openapi": "3.0.1",
  "info": {
    "title": "CSV & Excel Data Quality Cleaner",
    "description": "Clean CSV and Excel files under explicit rules, normalize columns and values, flag or remove duplicates, and export cleaned rows plus a structured validation report.",
    "version": "0.1",
    "x-build-id": "fQ01DnRvsFdTAOcnd"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/automation-lab~csv-excel-data-quality-cleaner/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-automation-lab-csv-excel-data-quality-cleaner",
        "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/automation-lab~csv-excel-data-quality-cleaner/runs": {
      "post": {
        "operationId": "runs-sync-automation-lab-csv-excel-data-quality-cleaner",
        "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/automation-lab~csv-excel-data-quality-cleaner/run-sync": {
      "post": {
        "operationId": "run-sync-automation-lab-csv-excel-data-quality-cleaner",
        "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": {
          "csvText": {
            "title": "Inline CSV",
            "type": "string",
            "description": "CSV text including a header row. Provide this or File URL, but not both."
          },
          "fileUrl": {
            "title": "CSV or XLSX file URL",
            "pattern": "^https?://",
            "type": "string",
            "description": "Public HTTP(S) URL of one CSV or Excel .xlsx file (maximum 25 MB). Provide this or Inline CSV, but not both."
          },
          "format": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "xlsx"
            ],
            "type": "string",
            "description": "Detect the format automatically or force CSV/XLSX parsing.",
            "default": "auto"
          },
          "sheetName": {
            "title": "Excel sheet name",
            "type": "string",
            "description": "Optional worksheet name. The first sheet is used when omitted."
          },
          "normalizeColumnNames": {
            "title": "Normalize column names",
            "type": "boolean",
            "description": "Convert headers to lowercase snake_case and make duplicate headers unique.",
            "default": true
          },
          "trimWhitespace": {
            "title": "Trim text whitespace",
            "type": "boolean",
            "description": "Remove leading and trailing whitespace from text values.",
            "default": true
          },
          "emptyAsNull": {
            "title": "Convert empty values to null",
            "type": "boolean",
            "description": "Represent empty cells consistently as null.",
            "default": true
          },
          "columnRules": {
            "title": "Column conversion and validation rules",
            "type": "array",
            "description": "Rules are matched after header normalization. Configure output names, types, required values, numeric ranges, patterns, or allowed values.",
            "items": {
              "type": "object",
              "required": [
                "column"
              ],
              "properties": {
                "column": {
                  "type": "string",
                  "title": "Input column",
                  "description": "Source column name after optional header normalization."
                },
                "outputName": {
                  "type": "string",
                  "title": "Output column",
                  "description": "Optional replacement name for this output column."
                },
                "type": {
                  "type": "string",
                  "title": "Data type",
                  "description": "Target value type.",
                  "enum": [
                    "string",
                    "number",
                    "integer",
                    "boolean",
                    "date"
                  ]
                },
                "required": {
                  "type": "boolean",
                  "title": "Required",
                  "description": "Whether an empty value creates a validation finding."
                },
                "min": {
                  "type": "number",
                  "title": "Minimum",
                  "description": "Optional minimum for numeric values."
                },
                "max": {
                  "type": "number",
                  "title": "Maximum",
                  "description": "Optional maximum for numeric values."
                },
                "pattern": {
                  "type": "string",
                  "title": "Regular expression",
                  "description": "Optional JavaScript regular expression for string validation."
                }
              }
            },
            "default": []
          },
          "deduplicateBy": {
            "title": "Duplicate key columns",
            "type": "array",
            "description": "Columns whose combined values identify duplicate rows. Leave empty to disable duplicate detection.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "duplicateAction": {
            "title": "Duplicate action",
            "enum": [
              "flag",
              "remove",
              "keep"
            ],
            "type": "string",
            "description": "Flag duplicates in output, remove later duplicates, or keep them without removal (duplicate metadata is still included).",
            "default": "flag"
          },
          "caseInsensitiveDuplicates": {
            "title": "Case-insensitive duplicate matching",
            "type": "boolean",
            "description": "Treat text values that differ only by letter case as the same duplicate key.",
            "default": true
          },
          "maxRows": {
            "title": "Maximum rows",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of data rows to read after the header.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}