# Facebook Keyword Post Search · Public Posts (`data-slayer/facebook-post-search`) Actor

Find public Facebook posts by keyword or phrase. Export deduplicated post text, URLs, authors, timestamps, engagement and available media as structured JSON, CSV or Excel.

- **URL**: https://apify.com/data-slayer/facebook-post-search.md
- **Developed by:** [Data Slayer](https://apify.com/data-slayer) (community)
- **Categories:** Social media, Marketing, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 unique public posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Facebook Keyword Post Search · Public Posts

Find public Facebook posts that match a keyword or phrase, then export clean post records for research, brand monitoring, content discovery, and market analysis.

### Watch the demo

YouTube video coming soon.

### What this Actor does

Enter a keyword or phrase and receive matching public post records with the post URL, text, author, publication time, engagement counts, and available media. Results are deduplicated by post identity and can be downloaded as JSON, CSV, or Excel.

This Actor searches across public Facebook post results. It is distinct from Page Posts, which starts from a known Page, and Group Posts, which starts from a known public Group.

### Input

| Field | Type | Required | Default | Limits | Purpose |
|---|---|---:|---:|---:|---|
| `query` | string | Yes | — | 1–200 characters | Keyword or phrase to search for. |
| `maxItems` | integer | No | `100` | 1–5,000 | Hard limit on unique post rows saved. |
| `maxPages` | integer | No | `20` | 1–100 | Safety limit on result pages requested. |

```json
{
  "query": "electric vehicles",
  "maxItems": 100,
  "maxPages": 20
}
```

Date, location, and sort controls are not offered until their behavior is verified for this product. A hashtag can be supplied as text, but hashtag-specific matching is not promised.

### Output

Each Dataset item is one unique public post:

- `postId`, `url`, `text`, `publishedAt`, and `type`
- `author`: public author ID, name, URL, and available profile picture URL
- `engagement`: available reaction, comment, share, and reaction-breakdown counts
- `taggedLocation`: available tagged-location ID and name
- `media`: available photo or video references and dimensions
- `externalUrl` and `retrievedAt`

Fields unavailable for a particular public post are returned as `null`, an empty object, or an empty array. Media URLs can expire and should not be treated as permanent storage.

### Empty, partial, and failed runs

An empty search writes no Dataset status row and records `status: empty` in the `OUTPUT` run summary. If a later result page becomes unavailable, already accepted rows remain in the Dataset and the summary records `status: partial`. Validation, access, rate-limit, timeout, and temporary-data failures use stable functional error codes without exposing internal routing details.

### Pricing

The proposed price is one small start charge plus one event for each unique public post saved. Duplicate rows, rejected rows, empty searches, and status summaries are not result events. Your run budget may stop collection early; already accepted rows remain available.

### Reliability and limits

- Public results only; private or restricted posts are not available.
- Search coverage and ordering can change as Facebook changes public search behavior.
- Pagination, retries, time, requests, and output rows are bounded.
- Duplicate post identities are skipped.
- The Actor follows redirects only when explicitly supported; unexpected redirects stop safely.
- You are responsible for using the data in accordance with applicable laws and platform terms.

### API use

Use the same three input fields through the Apify API. Read post rows from the default Dataset and the run outcome from the `OUTPUT` record in the default key-value store.

### FAQ

**How much does it cost to run this Actor?**
Pricing is listed in the Pricing section above, charged per row returned. You only pay for the rows
the Actor actually produces, so a small test run costs cents.

**Do I need cookies or a login?**
No. This Actor reads public data only - no cookies, no account, no browser automation.

**Can I schedule it?**
Yes. Run it from the Apify API, on a schedule, or via a webhook, and export results as JSON, CSV or Excel.

**What if I need a slightly different output?**
Open an issue on the Actor's Issues tab describing the shape you need.

### Related actors

More Facebook actors from the same portfolio. Apify only auto-recommends actors in the same category, so here are the rest of ours:

| Actor |
|---|
| [Facebook Ads Library Scraper](https://apify.com/data-slayer/facebook-ads-library-scraper) |
| [Facebook Comments & Replies Scraper](https://apify.com/data-slayer/facebook-comments-scraper) |
| [Facebook Events Scraper · No Cookies](https://apify.com/data-slayer/facebook-search-events) |
| [Facebook Group Posts Scraper · No Cookies](https://apify.com/data-slayer/facebook-group-posts) |
| [Facebook Marketplace Listing Scraper · No Cookies](https://apify.com/data-slayer/facebook-marketplace-details) |
| [Facebook Page Details Scraper · No Cookies](https://apify.com/data-slayer/facebook-page-details) |
| [Facebook Page Posts Scraper · No Cookies](https://apify.com/data-slayer/facebook-page-posts) |
| [Facebook Page Reviews Scraper · No Cookies](https://apify.com/data-slayer/facebook-page-reviews) |
| [Facebook Page Search Scraper · No Cookies](https://apify.com/data-slayer/facebook-search-pages) |
| [Facebook People Search Scraper · No Cookies](https://apify.com/data-slayer/facebook-search-people) |
| [Facebook Public Profile Scraper · People Lookup by URL or ID](https://apify.com/data-slayer/facebook-profile-scraper) |

# Actor input Schema

## `query` (type: `string`):

Keyword or phrase to find in public Facebook post search results.

## `maxItems` (type: `integer`):

Hard limit on unique post rows saved to the Dataset.

## `maxPages` (type: `integer`):

Safety limit on result pages requested. The run also stops when no next page is available.

## Actor input object example

```json
{
  "query": "electric vehicles",
  "maxItems": 100,
  "maxPages": 20
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "query": "electric vehicles"
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-slayer/facebook-post-search").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "query": "electric vehicles" }

# Run the Actor and wait for it to finish
run = client.actor("data-slayer/facebook-post-search").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "query": "electric vehicles"
}' |
apify call data-slayer/facebook-post-search --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-slayer/facebook-post-search"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/VxDwr3via5dXOa8Qj/builds/nFZW4t1anfRvK17Dn/openapi.json
