{
  "openapi": "3.0.1",
  "info": {
    "title": "All-in-One Facebook Scraper",
    "description": "Facebook scraper — 12 modes: pages, posts, events, groups, search, reviews, comments, marketplace, reels & ads. HTTP-only, 256MB, fast. Premium residential proxy (~95% success rate). Up to 50% cheaper than alternatives. MCP-ready for AI agents.",
    "version": "0.1",
    "x-build-id": "73v2cmfThgnqM5nAe"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/get-leads~all-in-one-facebook-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-get-leads-all-in-one-facebook-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/get-leads~all-in-one-facebook-scraper/runs": {
      "post": {
        "operationId": "runs-sync-get-leads-all-in-one-facebook-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/get-leads~all-in-one-facebook-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-get-leads-all-in-one-facebook-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": [
          "scrapeMode"
        ],
        "properties": {
          "scrapeMode": {
            "title": "Scrape Mode",
            "enum": [
              "facebook-scraper",
              "facebook-pages-scraper",
              "facebook-posts-scraper",
              "facebook-events-scraper",
              "facebook-groups-scraper",
              "facebook-search-scraper",
              "facebook-reviews-scraper",
              "facebook-comments-scraper",
              "facebook-marketplace-scraper",
              "facebook-reels-scraper",
              "facebook-ads-scraper",
              "facebook-data-extractor",
              "facebook-monitor"
            ],
            "type": "string",
            "description": "Choose what to scrape from Facebook.",
            "default": "facebook-pages-scraper"
          },
          "pages": {
            "title": "Facebook Pages",
            "type": "array",
            "description": "Facebook page names or URLs to scrape. Used by pages, posts, and events modes. Example: NASA, https://facebook.com/cern",
            "items": {
              "type": "string"
            }
          },
          "eventSearchQueries": {
            "title": "Event Search Queries",
            "type": "array",
            "description": "Search terms for finding Facebook events. Used by events mode. Example: music festival, tech conference",
            "items": {
              "type": "string"
            }
          },
          "groupUrls": {
            "title": "Facebook Group URLs",
            "type": "array",
            "description": "Facebook group URLs or names. Requires loginCookies. Example: https://facebook.com/groups/selftaughtprogrammers. Only PUBLIC/open groups return data — closed/members-only groups require the authenticated account to be a member, otherwise the scraper returns 0 posts (expected behavior, not a bug).",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search Queries",
            "type": "array",
            "description": "Keywords to search Facebook pages. Requires loginCookies. Example: coffee shop new york, web design agency london",
            "items": {
              "type": "string"
            }
          },
          "marketplaceQueries": {
            "title": "Marketplace Search Queries",
            "type": "array",
            "description": "Search terms for Facebook Marketplace listings. Example: guitar, laptop, apartment. Requires loginCookies — Facebook redirects unauthenticated Marketplace requests to the login page.",
            "items": {
              "type": "string"
            }
          },
          "marketplaceLocation": {
            "title": "Marketplace Location",
            "type": "string",
            "description": "Location for marketplace search. Example: sanfrancisco, newyork, london"
          },
          "adsQuery": {
            "title": "Ads Search Query",
            "type": "string",
            "description": "Search term for Meta Ad Library. Example: nike, coffee, web design. Searches across all ad creatives and page names."
          },
          "adsPageId": {
            "title": "Ads Page ID",
            "type": "string",
            "description": "Facebook Page ID to scrape ads from a specific page. Find it in the page's About section or URL. Example: 14226545351 (Red Bull)"
          },
          "adsCountry": {
            "title": "Ads Country",
            "type": "string",
            "description": "Country code for Ad Library search. Use 'ALL' for all countries. Example: US, GB, DE, FR",
            "default": "ALL"
          },
          "adsActiveStatus": {
            "title": "Ads Active Status",
            "enum": [
              "active",
              "inactive",
              "all"
            ],
            "type": "string",
            "description": "Filter ads by status.",
            "default": "active"
          },
          "onlyPostsNewerThan": {
            "title": "Only Posts Newer Than",
            "type": "string",
            "description": "Filter results by date. Supports ISO dates (2026-01-01), relative values (7 days, 2 months, 1 year), or Unix timestamps. Works with Posts mode (login cookies), Groups mode (publishTime), and Comments mode (createdTime)."
          },
          "onlyPostsOlderThan": {
            "title": "Only Posts Older Than",
            "type": "string",
            "description": "Filter results by date. Same format as onlyPostsNewerThan. Works with Posts, Groups, and Comments modes."
          },
          "resultsPerPage": {
            "title": "Max Results Per Input",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Maximum number of results to extract per page, group, or search query.",
            "default": 50
          },
          "loginCookies": {
            "title": "Login Cookies (required for authenticated modes)",
            "type": "string",
            "description": "Facebook login cookies. One set per line: c_user=XXX; xs=XXX. Multiple cookie sets rotate automatically on session blocks. REQUIRED for groups, search, reviews, comments, reels, ads, and full posts. NOT used for pages mode (Facebook serves a stripped authenticated-feed view with no public counts when cookies are present). How to get: open facebook.com in Chrome while logged in → F12 → Application → Cookies → https://www.facebook.com → copy the `c_user` and `xs` values. If FB rejects the cookies mid-run with \"session expired (error 1357001)\", repaste fresh values — the `xs` token rotates every few hours of active use."
          },
          "requestDelay": {
            "title": "Request Delay (ms)",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Delay between requests in milliseconds. Use 0 for fastest scraping, 1000-3000 for stealth mode. Default: 0.",
            "default": 0
          },
          "proxyTier": {
            "title": "Proxy Tier",
            "enum": [
              "none",
              "residential",
              "custom"
            ],
            "type": "string",
            "description": "Choose your proxy setup. 'Residential (built-in)' is the default — routes all modes through an included residential proxy (Evomi) and unlocks high-traffic brand pages (Apple, Google, SpaceX, Amazon, Microsoft) that block datacenter IPs. Adds ~$0.003/result. 'None' skips proxy entirely (works for most public pages but may hit CAPTCHAs on brand pages). 'Bring your own' uses a proxy URL you paste into proxyConfiguration below. Apify Residential Proxy is NOT a valid option — this actor ignores the Apify Proxy toggle.",
            "default": "residential"
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration (bring your own)",
            "type": "object",
            "description": "Supply your own residential proxy. Use ONLY the \"Custom proxy URLs\" section (Apify Residential Proxy is NOT supported by this actor — the \"Use Apify Proxy\" toggle is silently ignored with a warning). Recommended providers: DataImpulse (https://dataimpulse.com, ~$1/GB) or Evomi (https://evomi.com, ~$0.49/GB). URL format: http://user:pass@host:port. For brand pages, also set forceProxy=true. Applied per mode: Pages/Posts/Events/Ads use NO proxy by default; Groups/Search always use proxy."
          },
          "forceProxy": {
            "title": "Force Proxy on All Modes",
            "type": "boolean",
            "description": "Apply the configured proxy (from Proxy Configuration above) to ALL modes including public ones (pages, posts, events). Required when using a custom residential proxy for brand pages. Not needed when proxyTier=residential — that already forces proxy on all modes.",
            "default": false
          },
          "facebookAppToken": {
            "title": "Facebook App Access Token (Ads API)",
            "type": "string",
            "description": "Optional Facebook App access token for the Ad Library Graph API. Enables Ads mode without login cookies. Format: {app_id}|{app_secret} or a User Access Token. Get one at developers.facebook.com/tools/explorer/ — select your app and generate a token with ads_read permission. When provided, takes priority over loginCookies for ads scraping and returns richer structured data (impressions range, spend range, targeting info)."
          },
          "alertEmail": {
            "title": "Alert email (monitor mode)",
            "type": "string",
            "description": "Email to send health-check alerts to. Used by facebook-monitor mode.",
            "default": "Jasperbongers1974@gmail.com"
          },
          "apifyToken": {
            "title": "Apify API token (monitor mode)",
            "type": "string",
            "description": "Personal API token for monitor mode (needed to read run history + send emails)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}