{
  "openapi": "3.0.1",
  "info": {
    "title": "Meta Ads Advertiser Leak Audit & Email Enricher",
    "description": "Turn Meta Ad Library datasets, Run IDs, Sheets/CSV, or landing URLs into audited DTC agency leads: 110+ tech stack, 404/OOS/DMARC leaks, verified emails & pitches ($4.50/1K; $0 skip).",
    "version": "0.1",
    "x-build-id": "dNbNsG3RlE5VUwANz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/maitreya_buddha~meta-ads-advertiser-leak-audit-email-enricher/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-maitreya_buddha-meta-ads-advertiser-leak-audit-email-enricher",
        "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/maitreya_buddha~meta-ads-advertiser-leak-audit-email-enricher/runs": {
      "post": {
        "operationId": "runs-sync-maitreya_buddha-meta-ads-advertiser-leak-audit-email-enricher",
        "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/maitreya_buddha~meta-ads-advertiser-leak-audit-email-enricher/run-sync": {
      "post": {
        "operationId": "run-sync-maitreya_buddha-meta-ads-advertiser-leak-audit-email-enricher",
        "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": {
          "sourceDatasetId": {
            "title": "Meta Ads Dataset ID or URL (2-Stage Chaining)",
            "type": "string",
            "description": "Paste a raw Apify Dataset ID, Apify Console Dataset URL, or Apify API Dataset URL from any Meta/Social Ad Library scraper. Automatically unwraps l.facebook.com redirects and aggregates active ad counts, runtime days, EU reach (when present), and creative mix."
          },
          "sourceRunId": {
            "title": "Upstream Apify Run ID or Run URL (Optional)",
            "type": "string",
            "description": "Paste an upstream Meta Ad Library scraper Run ID or Console Run URL. Automatically resolves its defaultDatasetId and streams records."
          },
          "landingPageUrls": {
            "title": "Direct Landing Page or Brand URLs",
            "type": "array",
            "description": "Paste up to 2,000 ad landing page URLs, bare brand domains, l.facebook.com tracking URLs, or shorteners/bio links (bit.ly, linktr.ee). Prefilled with 5 live DTC demos showcasing founder extraction, Tier-2 growth expansion, DMARC leak, Dual-Track 404 recovery, headless CSP handling, and CS inbox-risk warnings. Unrecoverable non-brand platforms (amazon.com, wa.me, instagram.com, apps.apple.com) are isolated at $0.",
            "items": {
              "type": "string"
            }
          },
          "rawCsvOrUrls": {
            "title": "Pasted CSV / TSV / Google Sheets / Multiline URLs (Optional)",
            "type": "string",
            "description": "Paste raw CSV, tab-separated Google Sheets/Excel rows (auto-detects url/domain/website/advertiser/brand/active_ads headers), or plain newline-separated URLs/domains."
          },
          "rawAdRecords": {
            "title": "Raw Meta Ad Library JSON Records (Optional API / n8n Mode)",
            "type": "array",
            "description": "Optional direct array of raw Meta/Social Ad Library JSON items for single-call API, MCP, or n8n workflows."
          },
          "agencyPreset": {
            "title": "Agency Pitch Preset",
            "enum": [
              "auto_best_fit",
              "tiktok_google_ads",
              "tiktok_ads_agency",
              "google_ads_agency",
              "email_sms_retention",
              "cro_landing_page",
              "ugc_creative",
              "deliverability_agency"
            ],
            "type": "string",
            "description": "Tailors leakScore (0-100), recommendedAgencyAngle, coldEmailSubject, coldEmailOpener, coldEmailBody, and linkedInDm to what your agency sells.",
            "default": "auto_best_fit"
          },
          "customAgencyOffer": {
            "title": "Custom 1-Line Agency Offer (Optional, $0 AI)",
            "type": "string",
            "description": "Optional 1-line value proposition deterministically woven into outreach copy without LLM fees or hallucinations."
          },
          "crmExportPreset": {
            "title": "CRM Export Column Preset",
            "enum": [
              "default",
              "instantly",
              "smartlead",
              "hubspot",
              "lemlist"
            ],
            "type": "string",
            "description": "Auto-maps flat columns for direct CSV import into Instantly, Smartlead, HubSpot, or Lemlist (uses verified First/Last Name ONLY — empty string when unknown, never fabricated).",
            "default": "default"
          },
          "dedupStoreName": {
            "title": "Named Watch / Weekly Delta KV Store Name (Optional)",
            "type": "string",
            "description": "Optional Apify Named Key-Value Store (e.g. \"meta-ads-watch-store\"). Stores compact 16-shard brand snapshots (~55 bytes/brand, up to 48,000 brands at <4 MB RAM)."
          },
          "dedupMode": {
            "title": "Dedup / Watch-Diff Mode",
            "enum": [
              "skip_seen",
              "watch_diff"
            ],
            "type": "string",
            "description": "When dedupStoreName is set: skip_seen skips previously audited brands at $0; watch_diff re-audits tracked brands and emits changeTriggers (ad_volume_surge, esp_churned, pixel_added, new_404_leak, new_oos_leak, dmarc_unfixed, sku_count_change).",
            "default": "skip_seen"
          },
          "enableContactPageFollow": {
            "title": "Track 2 Contact / About / Press / Policy Recovery",
            "type": "boolean",
            "description": "Follow up to 4 bounded internal pages (/contact, /about, /press, /wholesale, /partnerships, Shopify /policies/*) to recover B2B emails, founders/CEOs, and legal entities (never mutates Track 1 status).",
            "default": true
          },
          "enableShortenerUnwrap": {
            "title": "1-Hop Shortener & Bio-Link Unwrapping",
            "type": "boolean",
            "description": "Unwrap ad URLs using shorteners (bit.ly, tinyurl.com, t.co, rebrand.ly) or bio-link hubs (linktr.ee, beacons.ai, stan.store) to recover the real brand domain before isolating non-brand platforms at $0.",
            "default": true
          },
          "enableDnsEmailCheck": {
            "title": "11-Query DNS X-Ray & Deliverability Grade (A-F, $0)",
            "type": "boolean",
            "description": "Run out-of-band DNS MX, SPF (+ flattening detection), DMARC, BIMI, domain verification TXT, and DKIM CNAME X-Ray ($0 cost, 3.5s timeout).",
            "default": true
          },
          "enableStorefrontCatalogAudit": {
            "title": "Zero-Cost Storefront Catalog Audit (Shopify /meta.json & Woo Store API)",
            "type": "boolean",
            "description": "Extract published SKU count, currency, location (Shopify /meta.json) or median price & storewide OOS rate (WooCommerce Store API) at $0 cost.",
            "default": true
          },
          "enablePublicEntityLookup": {
            "title": "Batched Wikidata Public Entity & Founder Lookup ($0, Fail-Open)",
            "type": "boolean",
            "description": "Run 1 batched Wikidata organization query per 12 domains (with 1 fast retry) to enrich public legal names, CEO/founders, HQ location, and employee counts ($0 cost, fail-open).",
            "default": true
          },
          "enableDomainAgeRdap": {
            "title": "Optional RDAP Domain Registration Age Lookup (Default OFF)",
            "type": "boolean",
            "description": "Query public RDAP for domainCreatedAt, domainAgeYears, and registrar. Default OFF to keep run speed fast.",
            "default": false
          },
          "dnsFallbackOnBlocked": {
            "title": "Opt-In DNS-Only Audit on WAF-Blocked / Akamai-Reset Brands (Default OFF = $0 Skip)",
            "type": "boolean",
            "description": "Default OFF skips WAF-blocked (403/429) and unreachable brands at $0. Turn ON to emit an auditDepth='dns_only' record with full 11-query DNS X-Ray, 403 header/CSP hints, /robots.txt, and Wikidata data on live blocked domains.",
            "default": false
          },
          "onlyWithEmail": {
            "title": "Only Bill Advertisers With Recovered Email ($0 Otherwise)",
            "type": "boolean",
            "description": "Optional $0 filter: save and bill ONLY advertisers with at least 1 recovered brand email. Leave OFF (default) to keep all audited advertisers.",
            "default": false
          },
          "onlyWithActiveLeaks": {
            "title": "Only Bill Advertisers With >=1 Relevant Leak ($0 Otherwise)",
            "type": "boolean",
            "description": "Optional $0 filter: skip leak-free advertisers at $0 cost.",
            "default": false
          },
          "minLeakScore": {
            "title": "Minimum Leak Score (0-100, $0 Below)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Optional $0 filter: skip advertisers whose leakScore falls below this threshold (default 0 saves all advertisers).",
            "default": 0
          },
          "maxBrands": {
            "title": "Max Unique Brand Domains to Audit & Save",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Maximum unique deduplicated brand domains to audit per run (1-2,000).",
            "default": 100
          },
          "maxConcurrency": {
            "title": "Max Concurrency (Auto-capped <=2 on 128MB, <=3 on 256MB)",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Concurrent brand audits (1-10; automatically capped on lean containers to prevent OOM).",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration (Optional — Default OFF / $0)",
            "type": "object",
            "description": "Leave OFF (default) for $0 direct HTTP auditing. Enable only if you want to route requests through Apify Proxy or custom proxy URLs.",
            "default": {
              "useApifyProxy": false
            }
          },
          "enableByokEnrichment": {
            "title": "Enable Opt-In BYOK Executive Waterfall (Default OFF)",
            "type": "boolean",
            "description": "Master switch for Bring-Your-Own-Key executive contact enrichment (Apollo -> Hunter -> ZeroBounce). Runs ONLY on matching byokTriggerTiers up to byokMaxLookups. API keys are secret and NEVER logged or saved.",
            "default": false
          },
          "apolloApiKey": {
            "title": "Apollo API Key (Optional Secret)",
            "type": "string",
            "description": "Optional Apollo API key for decision-maker lookup (Founder/CEO/CMO/VP Marketing) on qualifying leads."
          },
          "hunterApiKey": {
            "title": "Hunter API Key (Optional Secret)",
            "type": "string",
            "description": "Optional Hunter API key fallback for executive email discovery when still missing a personal email."
          },
          "zeroBounceApiKey": {
            "title": "ZeroBounce API Key (Optional Secret)",
            "type": "string",
            "description": "Optional ZeroBounce API key for real-time email validation on qualifying leads."
          },
          "byokTriggerTiers": {
            "title": "BYOK Trigger Priority Tiers",
            "type": "array",
            "description": "Only invoke BYOK APIs on leads matching these leadPriority tiers (defaults to [\"VIP_HOT\"] to protect your API credits).",
            "default": [
              "VIP_HOT"
            ],
            "items": {
              "type": "string"
            }
          },
          "byokMaxLookups": {
            "title": "Max BYOK Lookups Per Run (Credit Safety Cap)",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Hard ceiling on how many leads can consume BYOK API calls in a single run (default 25).",
            "default": 25
          },
          "webhookUrl": {
            "title": "Webhook Delivery URL (Optional, SSRF-Protected)",
            "type": "string",
            "description": "Optional HTTPS/HTTP webhook URL to receive audited leads JSON at run completion. Blocks private, loopback, link-local, and cloud metadata IPs."
          },
          "webhookHeaders": {
            "title": "Webhook Custom Headers (Optional Secret JSON)",
            "type": "object",
            "description": "Optional JSON object of custom headers (e.g. Authorization or X-Webhook-Secret). Never logged."
          },
          "webhookOnlyTiers": {
            "title": "Webhook Priority Tier Filter (Optional)",
            "type": "array",
            "description": "Optional list of leadPriority tiers (e.g. [\"VIP_HOT\", \"WARM\"]) to send to webhookUrl. Leave empty to send all saved leads.",
            "default": [],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}