{
  "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": "FW7Mia7TLEPQWd88O"
  },
  "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"
            ],
            "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",
            "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 (Optional)",
            "type": "string",
            "description": "Facebook login cookies for authenticated scraping. One set per line: c_user=XXX; xs=XXX. Multiple cookie sets will be rotated for higher volume. Recommended for pages and posts (some pages redirect without cookies). Required for groups, search, reviews, comments, reels, and ads. How to get: Facebook > F12 > Application > Cookies > copy c_user and xs values."
          },
          "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. 'None' works for most pages. 'Residential (built-in)' unlocks high-traffic brand pages (Apple, Google, SpaceX, Amazon, Microsoft) that block datacenter IPs — applies to all modes automatically, adds ~$0.003/result to cover proxy bandwidth. 'Bring your own' lets you supply your own residential proxy URL in proxyConfiguration below (DataImpulse ~$1/GB, Evomi ~$0.49/GB).",
            "default": "none"
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration (Option A — bring your own)",
            "type": "object",
            "description": "Supply your own proxy. Used when proxyTier is 'Bring your own' or when you want to override proxy settings. Recommended providers for residential: DataImpulse (https://dataimpulse.com, ~$1/GB) or Evomi (https://evomi.com, ~$0.49/GB). 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)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}