{
  "openapi": "3.0.1",
  "info": {
    "title": "Lead Enrichment Pipeline — 5-47x Cheaper Than Clay",
    "description": "All-in-one lead enrichment: email discovery, phone finding, verification, company research, and lead scoring in one run. CSV or JSON in, scored leads out. $0.12/lead — 5-47x cheaper than Clay.",
    "version": "1.0",
    "x-build-id": "5Guk2VWpVyCj2Rbte"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ryanclinton~lead-enrichment-pipeline/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ryanclinton-lead-enrichment-pipeline",
        "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/ryanclinton~lead-enrichment-pipeline/runs": {
      "post": {
        "operationId": "runs-sync-ryanclinton-lead-enrichment-pipeline",
        "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/ryanclinton~lead-enrichment-pipeline/run-sync": {
      "post": {
        "operationId": "run-sync-ryanclinton-lead-enrichment-pipeline",
        "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": {
          "leads": {
            "title": "Leads (JSON array)",
            "minItems": 1,
            "maxItems": 10000,
            "type": "array",
            "description": "Array of lead objects. Each can have any combination of: firstName, lastName, fullName, email, phone, companyName, domain, website, title, linkedinUrl. Minimum: at least name+company, name+domain, or email.",
            "default": [
              {
                "firstName": "Sarah",
                "lastName": "Chen",
                "companyName": "Acme Corp",
                "website": "acmecorp.com",
                "title": "CTO"
              },
              {
                "email": "james@betaindustries.com",
                "companyName": "Beta Industries"
              },
              {
                "fullName": "Maria Rodriguez",
                "domain": "pinnacle.io"
              }
            ]
          },
          "csvUrl": {
            "title": "CSV file URL (alternative to JSON)",
            "type": "string",
            "description": "Public URL to a CSV file with lead data. Headers auto-mapped to fields. Use this OR the leads JSON array, not both."
          },
          "template": {
            "title": "Template (one-click setup)",
            "enum": [
              "custom",
              "b2b-saas-prospecting",
              "enterprise-sales",
              "recruiting-tech",
              "recruiting-non-tech",
              "event-leads",
              "agency-outbound",
              "crm-cleanup"
            ],
            "type": "string",
            "description": "High-level preset that sets goal + ICP roles + tech-stack defaults + output filter for a common use case. Picks 'custom' (default) to control every field manually below. Templates win over individual settings only when those settings are unset.",
            "default": "custom"
          },
          "goal": {
            "title": "Goal preset",
            "enum": [
              "quick-outreach",
              "high-deliverability",
              "max-coverage",
              "custom"
            ],
            "type": "string",
            "description": "Pick an outcome and the pipeline tunes step toggles for you. Use 'custom' to set toggles manually below. Overridden when a template is set.",
            "default": "high-deliverability"
          },
          "enrichEmail": {
            "title": "Find missing emails (custom mode)",
            "type": "boolean",
            "description": "Run waterfall email discovery for leads without email addresses. Only used when goal=custom.",
            "default": true
          },
          "enrichPhone": {
            "title": "Find missing phone numbers (custom mode)",
            "type": "boolean",
            "description": "Run phone number discovery for leads without phone numbers. Only used when goal=custom.",
            "default": false
          },
          "verifyEmails": {
            "title": "Verify email deliverability (custom mode)",
            "type": "boolean",
            "description": "Run MX + SMTP verification on all discovered emails. Only used when goal=custom.",
            "default": true
          },
          "enrichCompany": {
            "title": "Enrich company data (custom mode)",
            "type": "boolean",
            "description": "Run deep company research for leads with a domain. Only used when goal=custom.",
            "default": false
          },
          "scoreLeads": {
            "title": "Score and grade leads (custom mode)",
            "type": "boolean",
            "description": "Run lead scoring engine on all leads with sufficient data. Only used when goal=custom.",
            "default": true
          },
          "ourTechStack": {
            "title": "Our tech stack (for matching)",
            "maxItems": 50,
            "type": "array",
            "description": "Optional list of technologies that describe your product (e.g. ['AWS', 'PostgreSQL', 'React']). When provided, each lead gets a techStackMatch score showing overlap with the company's detected tech stack. Requires enrichCompany=true.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "icpRoles": {
            "title": "Target ICP roles (legacy — use 'icp' instead)",
            "maxItems": 30,
            "type": "array",
            "description": "Deprecated alias of 'icp.roles'. Optional list of titles that match your buyer (e.g. ['VP Engineering', 'CTO', 'DevOps Lead']). Used as a soft signal alongside score. New code should use the structured 'icp' input below.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "icp": {
            "title": "ICP definition (structured)",
            "type": "object",
            "description": "Preferred over icpRoles. Structured ICP with roles, seniority bands, and industries. Each lead gets isIcpRoleMatch / isIcpSeniorityMatch / isIcpIndustryMatch + isFullIcpMatch + icpMatchScore (0-100). Example: { \"roles\": [\"CTO\", \"VP Engineering\"], \"seniority\": [\"c-level\", \"vp\"], \"industries\": [\"SaaS\", \"Cybersecurity\"] }.",
            "default": {}
          },
          "suppressionListUrl": {
            "title": "Suppression list URL",
            "type": "string",
            "description": "Optional public URL to a CSV with one email or domain per line. Leads matching the list are flagged isOnSuppression=true and forced to SKIP."
          },
          "outputFilter": {
            "title": "Output filter",
            "enum": [
              "none",
              "send-now-only",
              "verified-emails-only",
              "a-b-grade-only"
            ],
            "type": "string",
            "description": "Filter records BEFORE pushing to the dataset (and BEFORE PPE charging). Skipped leads aren't billed.",
            "default": "none"
          },
          "outputMode": {
            "title": "Output detail level",
            "enum": [
              "crm",
              "analytics",
              "debug"
            ],
            "type": "string",
            "description": "Controls how much detail each lead record carries. CRM mode keeps it minimal for direct CRM imports; Analytics adds decision-output fields and confidence breakdown; Debug adds per-step diagnostics for troubleshooting.",
            "default": "analytics"
          },
          "strictMode": {
            "title": "Strict mode (no risk-tolerant decisions)",
            "type": "boolean",
            "description": "Upgrade VERIFY_FIRST decisions to SKIP. Use when sender reputation matters more than coverage.",
            "default": false
          },
          "minEmailConfidence": {
            "title": "Minimum email confidence (0-100)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Drop emails below this confidence threshold before computing the send decision. Set to 0 to keep everything.",
            "default": 0
          },
          "dedupeWithinRun": {
            "title": "Dedupe identical leads within this run",
            "type": "boolean",
            "description": "Collapse duplicate input rows by (email | name+domain | name+company) before processing. Saves credits when CSVs have repeats. Each output lead carries `mergedFromCount` showing how many input rows produced it.",
            "default": true
          },
          "personaWeights": {
            "title": "Persona weights (advanced — re-weight scoring)",
            "type": "object",
            "description": "Optional weight pack { contact, company, identity, fit } that re-weights the confidence breakdown into a `customScore` per lead. Use when your buyer cares more about one axis than the others. The sub-actor's `score` field stays untouched. Example for outbound (deliverability matters most): { contact: 0.4, company: 0.2, identity: 0.2, fit: 0.2 }.",
            "default": {}
          },
          "monitorStateKey": {
            "title": "Monitor state key (for scheduled re-runs)",
            "type": "string",
            "description": "Optional named KV store key for cross-run change detection. When set, every lead carries a `changeSinceLastRun` block + stable `changeFlags[]` enum. Use a stable key like 'crm-weekly' so subsequent scheduled runs diff against the same baseline. Bounded at 50,000 lead snapshots (FIFO)."
          },
          "feedbackStateKey": {
            "title": "Feedback state key (closed-loop outcomes)",
            "type": "string",
            "description": "Optional named KV store key for outcome history. When set together with the `feedback` input, outcomes (replied / bounced / ignored / converted) are persisted across runs and surfaced as `historicalPerformance` on every future lead in the same cohort (same domain, or same industry + seniority). Bounded at 50,000 outcomes (FIFO)."
          },
          "feedback": {
            "title": "Feedback (outcomes from previous campaigns)",
            "type": "object",
            "description": "Optional outcome ingestion — ship outcomes from your CRM/email tool back into the actor. Format: { \"type\": \"outcome\", \"data\": [{ \"entityId\": \"lead_8f3a2c\", \"outcome\": \"replied\", \"domain\": \"acmecorp.com\" }, ...] }. Outcomes are persisted to feedbackStateKey and surface as historicalPerformance on similar future leads.",
            "default": {}
          },
          "crmPush": {
            "title": "Push to CRM",
            "enum": [
              "none",
              "hubspot",
              "salesforce"
            ],
            "type": "string",
            "description": "Optionally push enriched leads to a CRM after processing.",
            "default": "none"
          },
          "hubspotApiKey": {
            "title": "HubSpot API Key",
            "type": "string",
            "description": "Required if pushing to HubSpot. Your private app access token."
          },
          "salesforceCredentials": {
            "title": "Salesforce Credentials (JSON string)",
            "type": "string",
            "description": "Required if pushing to Salesforce. Paste a JSON string: {\"instanceUrl\":\"https://...\",\"accessToken\":\"...\"}. Stored encrypted."
          },
          "outputCsv": {
            "title": "Generate downloadable CSV",
            "type": "boolean",
            "description": "Write enriched leads as a CSV file to the Key-Value Store. Download link appears in the summary record.",
            "default": true
          },
          "maxLeads": {
            "title": "Max leads to process",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of leads to process. Set to 0 for unlimited.",
            "default": 0
          },
          "emitPreflight": {
            "title": "Emit pre-flight cost estimate",
            "type": "boolean",
            "description": "Push a 'preflight' record to the dataset at the start of the run with an upper-bound cost estimate. Useful for budget alerts and cost transparency.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}