{
  "openapi": "3.0.1",
  "info": {
    "title": "Lead List Cleaner, Schema Validator & Normalizer (B2B CRM Prep)",
    "description": "Clean, normalize & validate B2B lead lists locally: 80+ global legal suffixes, smart human name parsing, E.164 phones, ISO-2 countries, currencies, ISO dates, schema quarantine, CRM column preservation, and Standby MCP.",
    "version": "1.0",
    "x-build-id": "Z2jMEt43mgBDaJT1c"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/forgekit~lead-cleaner-schema-normalizer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-forgekit-lead-cleaner-schema-normalizer",
        "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/forgekit~lead-cleaner-schema-normalizer/runs": {
      "post": {
        "operationId": "runs-sync-forgekit-lead-cleaner-schema-normalizer",
        "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/forgekit~lead-cleaner-schema-normalizer/run-sync": {
      "post": {
        "operationId": "run-sync-forgekit-lead-cleaner-schema-normalizer",
        "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": {
          "datasetId": {
            "title": "Apify Dataset ID",
            "maxLength": 128,
            "type": "string",
            "description": "Apify Dataset ID containing raw lead records.",
            "default": ""
          },
          "fileUrl": {
            "title": "Public CSV/JSON/XLSX File URL",
            "maxLength": 2048,
            "type": "string",
            "description": "Public URL to a CSV, TSV, JSON, NDJSON, or XLSX lead list (SSRF-protected).",
            "default": ""
          },
          "rows": {
            "title": "Inline Lead Rows",
            "maxItems": 100000,
            "type": "array",
            "description": "Inline JSON array of B2B lead records for direct API or MCP runs.",
            "default": []
          },
          "fieldMapping": {
            "title": "Explicit Column Field Mapping",
            "type": "object",
            "description": "Optional explicit map { company, fullName, firstName, lastName, email, phone, website, country, date, revenue }. Auto-detected from CRM header aliases if omitted.",
            "default": {}
          },
          "normalizeCompanyNames": {
            "title": "Normalize Company Names & Strip Legal Suffixes",
            "type": "boolean",
            "description": "Strip 80+ global legal entity suffixes (Ltd, LLC, Inc, GmbH & Co. KG, SAS, B.V., Pty Ltd, etc.) into companyClean + legalSuffix.",
            "default": true
          },
          "splitFullNames": {
            "title": "Split & Normalize Full Names",
            "type": "boolean",
            "description": "Parse fullName into salutation, firstName, middleName, lastName, and nameSuffix with proper casing.",
            "default": true
          },
          "normalizePhones": {
            "title": "Normalize Phones to E.164",
            "type": "boolean",
            "description": "Format phone numbers into international E.164 format via libphonenumber-js.",
            "default": true
          },
          "defaultCountry": {
            "title": "Default ISO-2 Country Code",
            "minLength": 2,
            "maxLength": 2,
            "type": "string",
            "description": "ISO 3166-1 alpha-2 fallback country for local phone formats and ambiguous slash dates (e.g. US vs GB).",
            "default": "US"
          },
          "normalizeUrlsAndDomains": {
            "title": "Normalize Websites & Backfill Corporate Domains",
            "type": "boolean",
            "description": "Canonicalize website URLs, extract rootDomain, and backfill domain from non-free work emails.",
            "default": true
          },
          "normalizeDates": {
            "title": "Normalize Dates to ISO-8601",
            "type": "boolean",
            "description": "Parse US/EU dates, named dates, and Unix timestamps to YYYY-MM-DD.",
            "default": true
          },
          "normalizeCurrencies": {
            "title": "Normalize Currencies & Shorthand Amounts",
            "type": "boolean",
            "description": "Parse formatted/shorthand money values ($2.5M, €12.5k, £1,250.50) into numeric currencyAmount + ISO currencyCode.",
            "default": true
          },
          "normalizeCountries": {
            "title": "Normalize Country Names to ISO-2",
            "type": "boolean",
            "description": "Map country names and aliases (United Kingdom, U.K., Deutschland) to ISO 3166-1 alpha-2 codes.",
            "default": true
          },
          "validationRules": {
            "title": "Declarative Schema Validation Rules",
            "maxItems": 50,
            "type": "array",
            "description": "Per-field validation rules [{ field, required?, type?: string|number|email|url|date|boolean, min?, max?, enum?, pattern? }].",
            "default": []
          },
          "invalidRowAction": {
            "title": "Invalid Row Handling",
            "enum": [
              "tag",
              "quarantine",
              "drop"
            ],
            "type": "string",
            "description": "Tag invalid rows inline, isolate them in KV QUARANTINE_ROWS, or drop them.",
            "default": "tag"
          },
          "dedupeByEmailOrDomain": {
            "title": "Deduplicate After Normalization",
            "type": "boolean",
            "description": "Remove duplicate leads sharing the same normalized email (or rootDomain when email is absent).",
            "default": false
          },
          "preserveOriginalColumns": {
            "title": "Preserve Original CRM Columns",
            "type": "boolean",
            "description": "Retain all original HubSpot/Salesforce/Clay custom columns alongside cleaned normalized columns for 1-click re-import.",
            "default": true
          },
          "maxRows": {
            "title": "Max Leads Processed",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Hard upper cap on non-blank lead rows processed.",
            "default": 100000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}