{
  "openapi": "3.0.1",
  "info": {
    "title": "📸 Instagram B2B Email Scraper",
    "description": "📧 Extract verified B2B business emails from Instagram posts, reels & profiles via Google Search. 🔍 Keyword-driven lead generation with smart proxy support.",
    "version": "1.0",
    "x-build-id": "6qhBloFfpEb7TqdkL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scraper-engine~instagram-b2b-emails-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scraper-engine-instagram-b2b-emails-scraper",
        "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/scraper-engine~instagram-b2b-emails-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scraper-engine-instagram-b2b-emails-scraper",
        "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/scraper-engine~instagram-b2b-emails-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scraper-engine-instagram-b2b-emails-scraper",
        "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",
        "required": [
          "keywords"
        ],
        "properties": {
          "keywords": {
            "title": "🔍 Search Keywords",
            "type": "array",
            "description": "🔎 Industries, niches or topics to search for on Instagram via Google (e.g. marketing, fitness, real estate). ✨ Add one or many keywords — every keyword is run against every selected pattern.",
            "items": {
              "type": "string"
            }
          },
          "mode": {
            "title": "🎯 Extraction Mode",
            "enum": [
              "b2b",
              "personal"
            ],
            "type": "string",
            "description": "🏢 b2b = corporate email patterns (contact@, info@, bookings, careers…), filters out Gmail/Yahoo/Outlook. 👤 personal = broader discovery, optionally filtered to the domains you list in 📬 Custom Email Domains.",
            "default": "b2b"
          },
          "customDomains": {
            "title": "📬 Custom Email Domains",
            "type": "array",
            "description": "👤 Personal mode only: keep only emails ending in one of these domains (e.g. @gmail.com, @outlook.com). Leave empty to keep every personal-mode email found. ⏭️ Ignored in B2B mode.",
            "items": {
              "type": "string"
            }
          },
          "patterns": {
            "title": "🧩 B2B Search Patterns",
            "type": "array",
            "description": "🏢 B2B mode only: choose which of the 29 corporate-email search patterns to run (keys from b2b_patterns.py, e.g. email_for_bookings, bio_email_basic, contact_at_domain). 📂 Leave empty to run ALL 29 patterns.",
            "items": {
              "type": "string"
            }
          },
          "platform": {
            "title": "🌐 Platform",
            "enum": [
              "Instagram.com"
            ],
            "type": "string",
            "description": "📱 Target social platform for email discovery.",
            "default": "Instagram.com"
          },
          "location": {
            "title": "📍 Location",
            "type": "string",
            "description": "🗺️ Geographic filter added to every search query (e.g. London, New York) for hyper-local prospecting. 🌍 Leave empty for global results.",
            "default": ""
          },
          "maxEmails": {
            "title": "📊 Maximum Total Emails",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "🎯 Hard cap on the total number of leads to collect across every keyword and pattern combined. The run stops as soon as this is reached.",
            "default": 10
          },
          "maxEmailsPerPattern": {
            "title": "🧩 Max Emails Per B2B Pattern",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "📈 Cap on how many leads a single B2B search pattern can contribute per keyword (🏢 B2B mode only) — keeps results diverse across patterns instead of one pattern eating the whole budget.",
            "default": 15
          },
          "enrichProfile": {
            "title": "🧬 Enrich With Real Profile Data",
            "type": "boolean",
            "description": "✅ NEW — fetch each discovered lead's live Instagram profile (followers count, business account flag, business category, verified status, bio, external URL) via the public web_profile_info endpoint, plus a list of related/lookalike profiles. Off by default (adds one extra request per lead).",
            "default": false
          },
          "maxRelatedProfiles": {
            "title": "🔗 Max Related Profiles Per Lead",
            "minimum": 0,
            "maximum": 50,
            "type": "integer",
            "description": "🕸️ Maximum number of lookalike/related profiles to capture per enriched lead. Only applies when 🧬 Enrich With Real Profile Data is ON.",
            "default": 5
          },
          "extractPhone": {
            "title": "📱 Extract Phone Numbers",
            "type": "boolean",
            "description": "✅ NEW — also scan each Google result snippet for a phone number (bios, contact sections, WhatsApp mentions) and normalize it with a country dial code. Off by default — leaves phoneNumber/dialCode/country as null so you know the field wasn't attempted.",
            "default": false
          },
          "country": {
            "title": "🌎 Target Country / Dial Code",
            "type": "string",
            "description": "🌍 Country name and/or dial code to target phone numbers by (e.g. 'United Kingdom (+44)', 'United States', or just '+91'). 🎯 When a dial code resolves, phone matches are normalized to it AND filtered to only that dial code. Only used when 📱 Extract Phone Numbers is ON.",
            "default": ""
          },
          "useProxy": {
            "title": "🛡️ Use Apify Proxy",
            "type": "boolean",
            "description": "✅ Enable smart 3-tier proxy escalation (direct → GOOGLE_SERP datacenter → residential) for Google Search + profile-enrichment requests. ❌ Unchecked forcibly disables ALL proxy tiers — the run stays on a direct connection only, even if blocked. ⭐ Recommended: on for best results.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "⚙️ Advanced Proxy Settings",
            "type": "object",
            "description": "🔧 Optional proxy override when 🛡️ Use Apify Proxy is enabled. 🎯 Leave as default for best performance.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "GOOGLE_SERP"
              ]
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}