{
  "openapi": "3.0.1",
  "info": {
    "title": "Facebook Search Posts Scraper - Keyword, Date & Location",
    "description": "Search public Facebook posts by keyword and get one row per post: text, author Page or profile, date, reactions by type, comments, shares, video views, photos, video and link attachments, group and place. Recent-first, date and location filters, monitor mode. No login or cookies.",
    "version": "0.1",
    "x-build-id": "keClLHPekdOwdg5i8"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/topapi~facebook-search-posts-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-topapi-facebook-search-posts-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/topapi~facebook-search-posts-scraper/runs": {
      "post": {
        "operationId": "runs-sync-topapi-facebook-search-posts-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/topapi~facebook-search-posts-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-topapi-facebook-search-posts-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",
        "properties": {
          "searchQueries": {
            "title": "🔎 Search queries",
            "type": "array",
            "description": "Keywords, phrases or hashtags, one per line, e.g. \"coffee\", \"#blackfriday\", \"iPhone 17 battery\". A Facebook search URL such as https://www.facebook.com/search/posts/?q=coffee also works. Facebook's search is fuzzy: it ranks related posts, so turn on 'Only posts that contain the query' for strict results.",
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "🔀 Sort by",
            "enum": [
              "top",
              "recent"
            ],
            "type": "string",
            "description": "\"Top\" is Facebook's default ranking (popular posts, any age). \"Most recent first\" returns the newest public posts and pairs with monitor mode for a feed of new mentions.",
            "default": "top"
          },
          "startDate": {
            "title": "📅 Posted after",
            "type": "string",
            "description": "Absolute date (2026-09-01) or relative to now (7 days, 3 weeks, 2 months, 1 year) or a day count (1 = today, 2 = yesterday and today). Sent to Facebook as its date filter and re-checked on every post. Leave empty for no lower bound."
          },
          "endDate": {
            "title": "📅 Posted before",
            "type": "string",
            "description": "Absolute date or relative (e.g. 30 days). Combine with 'Posted after' for a window such as startDate 2026-01-01 + endDate 2026-06-30."
          },
          "locationUid": {
            "title": "📍 Location (Facebook place id)",
            "type": "string",
            "description": "Facebook's numeric id of a city or region to restrict the search to posts tagged there, e.g. 108424279189115 (New York, NY). Find it on facebook.com: search, open the city filter and copy the number at the end of the location page URL. Leave empty for a global search."
          },
          "mustContainQuery": {
            "title": "🎯 Only posts that contain the query",
            "type": "boolean",
            "description": "Keep only posts whose text contains the search query (case-insensitive). Facebook's search also returns related posts without the exact words; this makes the result strict. Measured on 307 posts: single words matched 94% (coffee, pizza), multi-word phrases far less (\"hiring now apply\" 0%, \"zillow listing\" 40%).",
            "default": false
          },
          "keywordFilter": {
            "title": "🔤 Keyword filter",
            "type": "string",
            "description": "Keep only posts whose text, author name or link title contain this word or phrase, case-insensitive, e.g. \"recipe\" or \"discount, sale, promo\" (comma = any of them). Leave empty for no filter.",
            "default": ""
          },
          "postType": {
            "title": "🎞️ Post type",
            "enum": [
              "all",
              "photo",
              "video",
              "link",
              "text"
            ],
            "type": "string",
            "description": "Keep only one kind of post. Marketplace listings and event posts count as 'photo' when they carry an image.",
            "default": "all"
          },
          "postSource": {
            "title": "👥 Posted in",
            "enum": [
              "all",
              "groups",
              "pages_and_profiles",
              "business_pages"
            ],
            "type": "string",
            "description": "Where the post was published. Measured on 307 search results: 25% were public-group posts, 4% came from business Pages, the rest from profiles and creator pages.",
            "default": "all"
          },
          "minReactions": {
            "title": "👍 Minimum reactions",
            "minimum": 0,
            "maximum": 100000000,
            "type": "integer",
            "description": "Keep only posts with at least this many reactions, e.g. 100 to keep popular posts only. 0 = no minimum.",
            "default": 0
          },
          "includePostDetails": {
            "title": "💬 Include post details (top comments, video files)",
            "type": "boolean",
            "description": "Opens each post's public page and adds the top comments Facebook shows signed-out (up to about 10: text, author, date, reactions), the video SD/HD file URLs and the video view count. Charged as the post-details event only for posts that received details. About one extra request (0.8 MB) per post.",
            "default": false
          },
          "monitorMode": {
            "title": "🔁 Only new posts since the last run",
            "type": "boolean",
            "description": "Remembers, per search query, which posts were already delivered (in the named key-value store below) and returns only new ones. Works best with 'Most recent first': the run stops as soon as a whole page was already delivered, so a scheduled check costs one or two pages. A run that finds nothing new delivers nothing.",
            "default": false
          },
          "monitorStoreName": {
            "title": "🗄️ Monitor memory name",
            "pattern": "^[a-zA-Z0-9-]{1,63}$",
            "type": "string",
            "description": "Name of the key-value store that keeps the per-query memory for monitor mode. Give each separate feed (a brand, a client, a Slack channel) its own name so they do not hide posts from each other. Letters, digits and hyphens.",
            "default": "facebook-search-posts-monitor"
          },
          "maxPostsPerQuery": {
            "title": "💯 Max posts per query",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Cap per search query after filters (your main cost control; you pay per delivered post). Facebook serves 11-12 posts per page; deep pagination measured to 8+ pages. 0 = as many as Facebook serves, up to 1,000 per query.",
            "default": 50
          },
          "maxItems": {
            "title": "🔢 Max posts in total",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap for the whole run across all queries. 0 = no total cap (each query is still capped above).",
            "default": 0
          },
          "compact": {
            "title": "🤖 Compact output",
            "type": "boolean",
            "description": "Core fields only (post_id, type, url, message, published_at, author name/url/type, reactions, comments, shares, views, image, video, external_url, group, location, hashtags, search_query): about a fifth of the bytes, sized for AI agents and MCP clients.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "🌍 Proxy",
            "type": "object",
            "description": "Apify datacenter proxies serve every request this actor makes (measured on search pages and post pages). The actor rotates to a fresh proxy session when Facebook rate-limits one, and keeps one session per batch of requests.",
            "default": {
              "useApifyProxy": true
            }
          },
          "maxConcurrency": {
            "title": "⚡ Parallel requests",
            "minimum": 1,
            "maximum": 6,
            "type": "integer",
            "description": "How many search queries (and post-detail pages) are fetched at once. 2 is a safe default; raise to 4 for long query lists.",
            "default": 2
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}