{
  "openapi": "3.0.1",
  "info": {
    "title": "CSV Cleaner: trim, fix case, drop empty rows, deduplicate",
    "description": "Cleans CSV and JSON data: trims whitespace, changes case on the columns you pick, removes empty rows and duplicates by all or chosen columns, and reports how many rows each step removed.",
    "version": "0.1",
    "x-build-id": "bYK4CaXHDNxhpUjAb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/examsens.ai~csv-cleaner/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-examsens.ai-csv-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/examsens.ai~csv-cleaner/runs": {
      "post": {
        "operationId": "runs-sync-examsens.ai-csv-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/examsens.ai~csv-cleaner/run-sync": {
      "post": {
        "operationId": "run-sync-examsens.ai-csv-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": {
          "fileUrls": {
            "title": "File URLs",
            "type": "array",
            "description": "Links to CSV, TSV, JSON or JSON Lines files. A Google Sheets link works when the sheet is shared with anyone who has the link. Rows from every source are merged into one table before cleaning.",
            "items": {
              "type": "string"
            }
          },
          "fileStore": {
            "title": "Files in a key-value store",
            "type": "string",
            "description": "To use files from your computer, upload them to a key-value store under Storage in Apify Console, then pick that store here. Every record whose name ends in .csv, .tsv, .txt, .json, .jsonl or .ndjson is read, unless you list record keys below."
          },
          "fileStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Read only these records from the picked key-value store.",
            "items": {
              "type": "string"
            }
          },
          "sourceDataset": {
            "title": "Apify dataset",
            "type": "string",
            "description": "Clean the items of a dataset, such as the output of another actor run."
          },
          "data": {
            "title": "Inline data",
            "type": "array",
            "description": "A JSON array of objects to clean, for small lists or calls from the API."
          },
          "inputFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "json"
            ],
            "type": "string",
            "description": "Auto reads a file as JSON when it starts with [ or {, and as CSV otherwise.",
            "default": "auto"
          },
          "csvDelimiter": {
            "title": "CSV delimiter",
            "type": "string",
            "description": "Leave empty to detect comma, semicolon, tab or pipe. Type tab for tab separated files."
          },
          "trimWhitespace": {
            "title": "Trim whitespace",
            "type": "boolean",
            "description": "Remove spaces, tabs and line breaks at the start and end of every text value.",
            "default": true
          },
          "collapseSpaces": {
            "title": "Collapse inner spaces",
            "type": "boolean",
            "description": "Replace runs of spaces, tabs and line breaks inside a value with one space.",
            "default": false
          },
          "emptyToNull": {
            "title": "Empty text to empty cell",
            "type": "boolean",
            "description": "Output an empty text value as null in the dataset.",
            "default": true
          },
          "caseColumns": {
            "title": "Columns to change case",
            "type": "array",
            "description": "Column names whose text values get the case below, such as email.",
            "items": {
              "type": "string"
            }
          },
          "caseAllColumns": {
            "title": "Change case in every column",
            "type": "boolean",
            "description": "Apply the case below to every text column.",
            "default": false
          },
          "caseMode": {
            "title": "Case",
            "enum": [
              "lower",
              "upper",
              "title",
              "sentence"
            ],
            "type": "string",
            "description": "Lower: jane@example.com. Upper: NEW YORK. Title: New York. Sentence: New york.",
            "default": "lower"
          },
          "removeEmptyRows": {
            "title": "Remove empty rows",
            "type": "boolean",
            "description": "Drop rows where every column is empty after trimming.",
            "default": true
          },
          "dedupe": {
            "title": "Remove duplicates",
            "type": "boolean",
            "description": "Keep one row for each set of matching rows.",
            "default": true
          },
          "dedupeColumns": {
            "title": "Match on columns",
            "type": "array",
            "description": "Rows count as duplicates when these columns match, such as email. Leave empty to compare every column.",
            "items": {
              "type": "string"
            }
          },
          "dedupeMatch": {
            "title": "Matching",
            "enum": [
              "exact",
              "loose"
            ],
            "type": "string",
            "description": "Exact: values must be identical after cleaning. Ignore case and spaces: Jane@Example.com and jane@example.com match.",
            "default": "exact"
          },
          "keep": {
            "title": "Row to keep",
            "enum": [
              "first",
              "last"
            ],
            "type": "string",
            "description": "Which row of a duplicate set stays.",
            "default": "first"
          },
          "keepRowsWithBlankKey": {
            "title": "Keep rows with blank match columns",
            "type": "boolean",
            "description": "When matching on chosen columns, keep every row where all of them are empty, so rows with no email are not merged into one.",
            "default": true
          },
          "saveRemovedRows": {
            "title": "Save removed duplicates",
            "type": "boolean",
            "description": "Also save the removed duplicate rows as a second CSV file in the key-value store.",
            "default": false
          },
          "columnsToKeep": {
            "title": "Columns to keep",
            "type": "array",
            "description": "Output only these columns, in this order. Leave empty to keep all.",
            "items": {
              "type": "string"
            }
          },
          "columnsToRemove": {
            "title": "Columns to remove",
            "type": "array",
            "description": "Leave these columns out of the output.",
            "items": {
              "type": "string"
            }
          },
          "renameColumns": {
            "title": "Rename columns",
            "type": "array",
            "description": "One per line as old:new, such as E-mail Address:email.",
            "items": {
              "type": "string"
            }
          },
          "flattenJson": {
            "title": "Flatten nested JSON",
            "type": "boolean",
            "description": "Turn nested objects into columns such as address.city. Lists become JSON text in one cell.",
            "default": true
          },
          "outputFileName": {
            "title": "CSV file name",
            "type": "string",
            "description": "Name of the cleaned CSV record in the key-value store, without .csv.",
            "default": "cleaned"
          },
          "outputDelimiter": {
            "title": "CSV output delimiter",
            "enum": [
              "comma",
              "semicolon",
              "tab"
            ],
            "type": "string",
            "description": "Delimiter of the cleaned CSV file.",
            "default": "comma"
          },
          "excelBom": {
            "title": "Add byte order mark for Excel",
            "type": "boolean",
            "description": "Start the CSV file with a UTF-8 byte order mark.",
            "default": false
          },
          "maxRows": {
            "title": "Maximum rows read",
            "minimum": 1,
            "maximum": 5000000,
            "type": "integer",
            "description": "Stop reading sources after this many rows in total. Each cleaned row output is one billable event.",
            "default": 1000000
          },
          "maxFileSizeMb": {
            "title": "Maximum file size (MB)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Larger files are reported as an error and not read.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}