# Facebook Search Posts Scraper — Keywords & Dates (`data-wan/facebook-search-posts`) Actor

Search public Facebook posts by keyword from the country you choose: Facebook's results depend on it. No account needed. Strict date window, recent posts first, many queries per run with per-query limits and an outcome report for each query.

- **URL**: https://apify.com/data-wan/facebook-search-posts.md
- **Developed by:** [Data Wan](https://apify.com/data-wan) (community)
- **Categories:** Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 2 monthly users, 96.9% runs succeeded, 2 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.49 / 1,000 saved 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 Search Posts Scraper

Search public Facebook posts by keyword, from the country you choose. Run many queries in
one run, each with its own post limit, and keep only posts published in a chosen period.
Get text, publication dates, authors, engagement counts and available media references in
one dataset. No Facebook account or cookies are required.

**$2.90 per 1,000 saved posts on Free / Starter, $1.90 on Scale and $1.49 on Business.**
Platform usage is included: no separate compute, proxy, Actor start or date-filter fee.
Twenty saved posts cost **$0.058** at the Free / Starter rate. Check the Pricing tab for
the active rate before starting; Free is the account plan, not a free trial.

Use this Actor for brand and topic mentions, campaign tracking and content research.
Each row records the query that found it and its position in that query's results.

### Why this Actor

**Choose the country Facebook searches from.** Facebook shows different search results
to visitors in different countries. `proxyCountry` runs your search through a residential
proxy in the country you pick, so you see what that country's visitors see. In our test
on the same five Latvian-language keywords, period and moment, a Latvian proxy saved
**114 posts and a US proxy 61**. The Latvian results matched a search made from a Latvian
home connection (119 posts); the US results shared only part of them: for one keyword,
**63 posts from Latvia against 14 from the US, with only 4 of the 14 among the local
results**. Among the Facebook search Actors we reviewed in the Apify Store in November
2026, no other one offered a country choice.

**More posts inside your period, none outside it.** In our side-by-side test against
another Facebook search Actor on the same 11 keywords, period and moment (20 posts
requested per keyword):

| Measured in our test | This Actor | Other Actor |
|---|---:|---:|
| Posts inside the requested period | **130** | 21 |
| Rows outside the requested period | **0** | 24 |
| Posts containing every query word | **11** | 2 |

One test on one set of keywords is not a guarantee for yours, but it is what we measured.

Also included:

- **Strict date window.** With `since`/`until`, posts outside the period, or without a
  visible date, are dropped before saving and never billed.
- **Recent posts first.** The search asks Facebook for recent posts, so newer posts tend
  to come first (roughly, not in strict date order).
- **A report for every query.** The run summary states each query's saved posts and
  outcome (finished, limit reached, window passed, blocked and so on).
- **Anonymous.** No Facebook account, login or cookies: you never risk an account.
- **Many queries per run** with a strict post limit for each, billed only for saved posts.

### What a search result is

Facebook's search returns what its ranking shows to a visitor without an account, not
every post that contains your words. Keep these limits in mind:

- **Matching is per word, not per phrase.** A multi-word query, such as a person's full
  name, mostly returns posts that mention only one of its words, often about something
  else. Filter rows on `text` yourself when you need posts about one exact thing.
- **Results are not in date order.** Newer and older posts are mixed on every page.
- **A finished query never means every match was found.** `complete` means Facebook
  showed its last result page; it is not a count of all matching posts.
- **The proxy country changes the results.** Facebook ranks results for the visitor's
  country. Pick the country of the audience you study (see `proxyCountry`).

### First run: one query, up to 20 posts

1. Open the Input form and type a keyword or phrase into **Search queries**.
   The prefilled query is a starting example.
2. Leave **Maximum posts per query** at **20** and **Proxy country** at **US**, then
   click **Start**.
3. When the run finishes, open **Output** to inspect the posts and download results.
   Also check the run summary for each query's outcome.

The equivalent JSON input is:

```json
{
  "queries": ["renewable energy storage"],
  "maxPostsPerQuery": 20
}
```

The default table shows the query, the post's rank, the first observed author and the
first media preview when available. **Full details** keeps all observed authors, media,
reactions, shared-original context and field issues. A missing preview does not mean the
post has no media.

#### What results look like

This is a **synthetic illustration**, not a Facebook capture or an Apify Console screenshot.
Each row is one post found by one query.

| Query | Rank | Post | Published (UTC) | First author | Reactions | Comments |
|---|---:|---|---|---|---:|---:|
| renewable energy storage | 1 | An example post about home battery storage. | 2026-11-09 08:30 | Example Page | 42 | 6 |

Selected fields from the same synthetic row:

```json
{
  "postId": "9000000000000103",
  "createdAt": "2026-11-09T08:30:00Z",
  "text": "An example post about home battery storage.",
  "authors": [
    {"id": "9000000000000101", "name": "Example Page", "url": "https://www.facebook.com/example/", "avatarUrl": null}
  ],
  "reactionsCount": 42,
  "commentsCount": 6,
  "sharesCount": 2,
  "attachments": [],
  "issues": [],
  "query": "renewable energy storage",
  "inputIndex": 0,
  "rank": 1
}
```

`query` is the query as run (trimmed and Unicode-normalized). `inputIndex` is its
zero-based position in your list. `rank` is the post's position among that query's saved
posts, starting at 1; it is not a relevance score. There is no source field: `authors`
names the observed author.

### Several queries in one run

Queries run one after another in one run. This example saves at most 200 rows, costing at
most **$0.58** at the $2.90-per-1,000 rate if all 200 are saved.

```json
{
  "queries": ["solar panels", "heat pump"],
  "maxPostsPerQuery": 100
}
```

Each query is processed independently. A post found by two queries is saved and billed
once for each query; a fresh run can save the same posts again.

### Search a publication period in another country

```json
{
  "queries": ["elektroauto"],
  "maxPostsPerQuery": 200,
  "since": "2026-11-01",
  "until": "2026-11-07",
  "proxyCountry": "DE"
}
```

Calendar dates include the whole UTC day. Exact boundaries accept timezone-aware,
whole-second timestamps such as `2026-11-01T12:00:00Z` or `2026-11-01T15:00:00+02:00`.
Both bounds are inclusive. With a window set, posts outside it and posts whose date
Facebook does not show are dropped and never billed.

`proxyCountry` takes a two-letter country code (ISO 3166-1 alpha-2, uppercase, such as `US`,
`GB`, `DE` or `LV`). The run goes through an Apify residential proxy in that country.
Pick the country of the audience you study: in our test on Latvian-language queries, a
Latvian proxy saved 114 posts and a US proxy 61 for the same queries and period, and many
of the posts differed (see [Why this Actor](#why-this-actor)). A country the proxy service
cannot serve fails the run before any search, with nothing billed.

#### Monitor new mentions

For each run, set `since` to your last completed cutoff and leave `until` empty (or set it
to the end of the new window). Overlap the windows slightly and deduplicate saved rows by
`postId`; inclusive bounds can return a boundary post again. Because results are not in
date order, a query stops reading only after two result pages in a row show no post in the
window and an older one (`incomplete` / `window_passed`). That usually means the new posts
were read, not that every one was. Searching a period far in the past reads more pages:
the newest posts come first, so raise `maxPostsPerQuery` or narrow the window.

The Actor keeps no monitoring state between runs. A normal
[Apify schedule](https://docs.apify.com/actors/running/schedules) reruns the input you
supplied: fixed `since`/`until` dates do not advance automatically.

### Search one city

Set `searchCountry` to a supported uppercase country key. With no `searchCity`, or a
null, empty or whitespace-only city, the run selects that country's configured capital.
For example, `{"queries":["coffee"],"searchCountry":"LV","maxPostsPerQuery":50}`
collects up to 50 posts in Riga. Add `"searchCity":"liepaja"` to select only Liepāja,
with the same full cap. City keys are trimmed and lowercased; unknown explicit cities or
unsupported countries fail without fallback. City without country also fails.
Both fields omitted (or null country and blank city) keep unfiltered search.

The same city applies to every query in the run. The source city filter is approximate;
it does not prove that every returned post is physically inside city boundaries.
`searchCountry` selects result geography; `proxyCountry` independently controls the
residential proxy and keeps its existing default. No city names are appended to queries.
Supported country/city keys are listed in [Supported search locations](#supported-search-locations)
below. Use one listed country key and optionally one of its city keys.

Run summary `OUTPUT` and every query item contain `searchCountry`, `searchCity`, `cityId`
and `selectionMode` (`capital_default` or `explicit`). They echo the effective selection
even for empty or skipped queries; unfiltered fields are null. Dataset rows contain
`cityId`, also null for unfiltered search. These are operation provenance, not observed
post location. A known invalid GEO input produces `status:failed`, `items:[]`, zero saved
and charged rows, and `inputError:{field:searchCountry|searchCity,reason:required|invalid_key|unsupported}`
before the dataset writer, proxy or source starts. Normal runs have `inputError:null`.
Technical/configuration failures do not receive this marker. No query or row is charged
for early invalid GEO input; platform startup cost may already exist.

### Input reference

| Option | Meaning |
|---|---|
| `queries` | 1–100 keyword queries, run in order. Each is trimmed and must then hold 1–200 characters without control characters; an invalid query is reported in the summary and not run. |
| `maxPostsPerQuery` | Strict saved-post limit for each query: default 50, allowed 1–1,000; the form starts at 20. Posts beyond it are never saved or billed. |
| `since`, `until` | Optional inclusive publication bounds, as UTC days or timezone-aware timestamps at whole seconds. |
| `proxyCountry` | Two uppercase letters, default `US`: the country of the residential proxy. |
| `searchCountry` | Optional supported country key; selects its capital when city is blank. |
| `searchCity` | Optional one supported city key; requires `searchCountry`. |

There is no continuation input: each run starts every query from Facebook's first result
page. A query reads at most 200 result pages (about 1,000 posts). A permitted limit does not
guarantee the run can finish within its timeout or budget.

### Output fields

| Fields | Contents |
|---|---|
| `query`, `inputIndex`, `rank` | The query that found the post, its position in your list and the post's position in the query's results. |
| `postId`, `url` | Post identity and observed permalink. |
| `text`, `textLinks` | Available text and observed message links. |
| `createdTime`, `createdAt` | Publication time as Unix seconds and a UTC timestamp. |
| `authors` | All observed authors with available IDs, names, profile and avatar URLs. |
| `reactionsCount`, `commentsCount`, `sharesCount`, `videoViewCount` | Available engagement counts; unknown values stay null. |
| `reactions` | Observed reaction types and counts, which may be a subset. |
| `attachments`, `sharedPost` | Visible media/link references and separate shared-original context. |
| `feedbackId`, `issues` | Observed feedback identity and field-level uncertainty. |

Media references are not downloaded files; URLs may expire. Unknown data stays null with
issues where applicable; observed zero and empty lists remain distinct.

### Exports and API

Apify provides [dataset downloads](https://docs.apify.com/storage/dataset) for formats
such as JSON, CSV and Excel, and [API access](https://docs.apify.com/api/v2/actors-runs-post)
to start runs from another application. These are Apify platform features.

### Run outcomes and common questions

**Where do I check completeness?** Read the unbilled run summary (`OUTPUT` in the run's
key-value store). It has the run status and one item per query with its saved posts and
outcome:

| Outcome / reason | Meaning |
|---|---|
| `complete` | Facebook showed its last result page; never a claim that every match was found. |
| `limit_reached` | `maxPostsPerQuery` posts were saved. |
| `incomplete` / `window_passed` | With `since`: two pages in a row had no post in the window and an older one; later pages were not read. |
| `incomplete` / `page_budget` | The query's 200-page limit was reached. |
| `incomplete` / `time_budget` | The run's timeout was close; collection stopped and later queries were skipped. |
| `failed` or `incomplete` / `blocked` | Facebook refused anonymous access; the run stops and later queries are `skipped`. Only Facebook's temporary rate-limit refusal (error 1675004) of a query's first results page, before any result, is retried, after a wait and once more through a new proxy session, at most once per run. Any other refusal (for example a block page) stops the run. |
| `invalid_source` | The query text was invalid and not run. |
| `failed` / other reason | The query failed before any result page; the next query still runs. |

A successful platform run can contain unsuccessful queries. Saved posts of other queries
remain available.

**What survives an interrupted run?** Saved rows remain in the dataset. Some queries may
be unfinished. A new run starts over and may save and bill the same posts again.

**Are empty queries or the summary charged?** No. Billing counts saved post rows only,
including the same post saved for several queries or in repeated runs. There is no
separate Actor start, date-filter, compute or proxy fee.

**Is the query text logged?** No. The run log shows counts and outcomes per query, never
the query text. The summary repeats each query as run (trimmed and normalized).

**Need posts from known Pages instead?** Use the separate
[DataWan Facebook Posts Scraper](https://apify.com/data-wan/facebook-posts) for a Page's or
profile's own feed, and the [DataWan Facebook Comments Scraper](https://apify.com/data-wan/facebook-comments)
for comment text. Their runs and charges are separate.

**Need help?** Open an [issue on this Actor](https://apify.com/data-wan/facebook-search-posts/issues)
with the run link, intended input and expected outcome. Do not include account credentials.

### Supported search locations

Choose a `searchCountry` key from this reference. Leave `searchCity` blank for the listed
default, or enter that default key or one additional city key from the same row. Other
keys fail validation; country-only selects one city, not national coverage. This is the
selection vocabulary shipped with this Actor, not proof of exact geographic boundaries
or complete results in every listed context.

| Country/territory key | Default city key | Display | Additional city keys |
|---|---|---|---|
| AD | andorra-la-vella | Andorra la Vella | — |
| AE | abu-dhabi | Abu Dhabi | — |
| AF | kabul | Kabul | — |
| AG | saint-johns | Saint John's | — |
| AI | the-valley | The Valley | — |
| AL | tirana | Tirana | — |
| AM | yerevan | Yerevan | — |
| AO | luanda | Luanda | — |
| AR | buenos-aires | Buenos Aires | — |
| AS | pago-pago | Pago Pago | — |
| AT | vienna | Vienna | — |
| AU | canberra | Canberra | — |
| AW | oranjestad | Oranjestad | — |
| AX | mariehamn | Mariehamn | — |
| AZ | baku | Baku | — |
| BA | sarajevo | Sarajevo | — |
| BB | bridgetown | Bridgetown | — |
| BD | dhaka | Dhaka | — |
| BE | brussels | Brussels | — |
| BF | ouagadougou | Ouagadougou | — |
| BG | sofia | Sofia | — |
| BH | manama | Manama | — |
| BI | gitega | Gitega | — |
| BJ | porto-novo | Porto-Novo | — |
| BL | gustavia | Gustavia | — |
| BM | hamilton | Hamilton | — |
| BN | bandar-seri-begawan | Bandar Seri Begawan | — |
| BO | sucre | Sucre | — |
| BR | brasilia | Brasília | — |
| BS | nassau | Nassau | — |
| BT | thimphu | Thimphu | — |
| BW | gaborone | Gaborone | — |
| BY | minsk | Minsk | — |
| BZ | belmopan | Belmopan | — |
| CA | ottawa | Ottawa | — |
| CD | kinshasa | Kinshasa | — |
| CF | bangui | Bangui | — |
| CG | brazzaville | Brazzaville | — |
| CH | bern | Bern | — |
| CI | yamoussoukro | Yamoussoukro | — |
| CK | avarua | Avarua | — |
| CL | santiago | Santiago | — |
| CM | yaounde | Yaoundé | — |
| CN | beijing | Beijing | — |
| CO | bogota | Bogotá | — |
| CR | san-jose | San Jose | — |
| CU | havana | Havana | — |
| CV | praia | Praia | — |
| CW | willemstad | Willemstad | — |
| CY | nicosia | Nicosia | — |
| CZ | prague | Prague | — |
| DE | berlin | Berlin | — |
| DJ | djibouti | Djibouti | — |
| DK | copenhagen | Copenhagen | — |
| DM | roseau | Roseau | — |
| DO | santo-domingo | Santo Domingo | — |
| DZ | algiers | Algiers | — |
| EC | quito | Quito | — |
| EE | tallinn | Tallinn | — |
| EG | cairo | Cairo | — |
| EH | el-aaiun | El-Aaiun | — |
| ER | asmara | Asmara | — |
| ES | madrid | Madrid | — |
| ET | addis-ababa | Addis Ababa | — |
| FI | helsinki | Helsinki | — |
| FJ | suva | Suva | — |
| FM | palikir | Palikir | — |
| FO | torshavn | Tórshavn | — |
| FR | paris | Paris | — |
| GA | libreville | Libreville | — |
| GB | london | London | — |
| GD | saint-georges | Saint George's | — |
| GE | tbilisi | Tbilisi | — |
| GF | cayenne | Cayenne | — |
| GG | saint-peter-port | Saint Peter Port | — |
| GH | accra | Accra | — |
| GI | gibraltar | Gibraltar | — |
| GL | nuuk | Nuuk | — |
| GM | banjul | Banjul | — |
| GN | conakry | Conakry | — |
| GP | basse-terre | Basse-Terre | — |
| GQ | ciudad-de-la-paz | Ciudad de la Paz | — |
| GR | athens | Athens | — |
| GS | grytviken | Grytviken | — |
| GT | guatemala-city | Guatemala City | — |
| GU | hagatna | Hagatna | — |
| GW | bissau | Bissau | — |
| GY | georgetown | Georgetown | — |
| HK | hong-kong | Hong Kong | — |
| HN | tegucigalpa | Tegucigalpa | — |
| HR | zagreb | Zagreb | — |
| HT | port-au-prince | Port-au-Prince | — |
| HU | budapest | Budapest | — |
| IE | dublin | Dublin | — |
| IL | jerusalem | Jerusalem | — |
| IM | douglas | Douglas | — |
| IQ | baghdad | Baghdad | — |
| IR | tehran | Tehran | — |
| IS | reykjavik | Reykjavík | — |
| IT | rome | Rome | — |
| JE | saint-helier | Saint Helier | — |
| JM | kingston | Kingston | — |
| JO | amman | Amman | — |
| KE | nairobi | Nairobi | — |
| KG | bishkek | Bishkek | — |
| KH | phnom-penh | Phnom Penh | — |
| KM | moroni | Moroni | — |
| KN | basseterre | Basseterre | — |
| KP | pyongyang | Pyongyang | — |
| KR | seoul | Seoul | — |
| KW | kuwait-city | Kuwait City | — |
| KY | george-town | George Town | — |
| KZ | astana | Astana | — |
| LA | vientiane | Vientiane | — |
| LB | beirut | Beirut | — |
| LC | castries | Castries | — |
| LI | vaduz | Vaduz | — |
| LK | kotte | Sri Jayewardenepura Kotte | colombo |
| LR | monrovia | Monrovia | — |
| LS | maseru | Maseru | — |
| LT | vilnius | Vilnius | — |
| LU | luxembourg | Luxembourg | — |
| LV | riga | Riga | liepaja |
| LY | tripoli | Tripoli | — |
| MA | rabat | Rabat | — |
| MC | monaco | Monaco | — |
| MD | chisinau | Chișinău | — |
| ME | podgorica | Podgorica | — |
| MF | marigot | Marigot | — |
| MG | antananarivo | Antananarivo | — |
| MH | majuro | Majuro | — |
| MK | skopje | Skopje | — |
| ML | bamako | Bamako | — |
| MM | nay-pyi-taw | Nay Pyi Taw | — |
| MN | ulaanbaatar | Ulaanbaatar | — |
| MO | macao | Macao | — |
| MP | saipan | Saipan | — |
| MQ | fort-de-france | Fort-de-France | — |
| MR | nouakchott | Nouakchott | — |
| MS | plymouth | Plymouth | — |
| MT | valletta | Valletta | — |
| MU | port-louis | Port Louis | — |
| MV | male | Malé | — |
| MW | lilongwe | Lilongwe | — |
| MX | mexico-city | Mexico City | — |
| MY | kuala-lumpur | Kuala Lumpur | — |
| MZ | maputo | Maputo | — |
| NA | windhoek | Windhoek | — |
| NC | noumea | Nouméa | — |
| NE | niamey | Niamey | — |
| NF | kingston | Kingston | — |
| NG | abuja | Abuja | — |
| NI | managua | Managua | — |
| NL | amsterdam | Amsterdam | — |
| NO | oslo | Oslo | — |
| NP | kathmandu | Kathmandu | — |
| NU | alofi | Alofi | — |
| NZ | wellington | Wellington | — |
| OM | muscat | Muscat | — |
| PA | panama-city | Panama City | — |
| PE | lima | Lima | — |
| PF | papeete | Papeete | — |
| PG | port-moresby | Port Moresby | — |
| PH | manila | Manila | — |
| PK | islamabad | Islamabad | — |
| PL | warsaw | Warsaw | — |
| PM | saint-pierre | Saint-Pierre | — |
| PN | adamstown | Adamstown | — |
| PR | san-juan | San Juan | — |
| PS | east-jerusalem | East Jerusalem | — |
| PT | lisbon | Lisbon | — |
| PY | asuncion | Asunción | — |
| QA | doha | Doha | — |
| RE | saint-denis | Saint-Denis | — |
| RO | bucharest | Bucharest | — |
| RS | belgrade | Belgrade | — |
| RU | moscow | Moscow | — |
| RW | kigali | Kigali | — |
| SA | riyadh | Riyadh | — |
| SB | honiara | Honiara | — |
| SC | victoria | Victoria | — |
| SD | khartoum | Khartoum | — |
| SE | stockholm | Stockholm | — |
| SG | singapore | Singapore | — |
| SH | jamestown | Jamestown | — |
| SI | ljubljana | Ljubljana | — |
| SJ | longyearbyen | Longyearbyen | — |
| SK | bratislava | Bratislava | — |
| SL | freetown | Freetown | — |
| SM | san-marino | San Marino | — |
| SN | dakar | Dakar | — |
| SO | mogadishu | Mogadishu | — |
| SR | paramaribo | Paramaribo | — |
| SS | juba | Juba | — |
| ST | sao-tome | São Tomé | — |
| SV | san-salvador | San Salvador | — |
| SX | philipsburg | Philipsburg | — |
| SY | damascus | Damascus | — |
| SZ | mbabane | Mbabane | — |
| TC | cockburn-town | Cockburn Town | — |
| TD | ndjamena | N'Djamena | — |
| TF | port-aux-francais | Port-aux-Français | — |
| TG | lome | Lomé | — |
| TH | bangkok | Bangkok | — |
| TJ | dushanbe | Dushanbe | — |
| TL | dili | Dili | — |
| TM | ashgabat | Ashgabat | — |
| TN | tunis | Tunis | — |
| TO | nuku-alofa | Nuku'alofa | — |
| TR | ankara | Ankara | — |
| TT | port-of-spain | Port of Spain | — |
| TV | funafuti | Funafuti | — |
| TW | taipei | Taipei | — |
| TZ | dodoma | Dodoma | — |
| UA | kyiv | Kyiv | — |
| UG | kampala | Kampala | — |
| US | washington-dc | Washington D.C. | — |
| UY | montevideo | Montevideo | — |
| UZ | tashkent | Tashkent | — |
| VA | vatican-city | Vatican City | — |
| VC | kingstown | Kingstown | — |
| VE | caracas | Caracas | — |
| VG | road-town | Road Town | — |
| VI | charlotte-amalie | Charlotte Amalie | — |
| VN | hanoi | Hanoi | — |
| VU | port-vila | Port Vila | — |
| WF | mata-utu | Mata Utu | — |
| WS | apia | Apia | — |
| YE | sanaa | Sanaa | — |
| YT | mamoudzou | Mamoudzou | — |
| ZA | pretoria | Pretoria | — |
| ZM | lusaka | Lusaka | — |
| ZW | harare | Harare | — |

Location names/context associations derive from [GeoNames](https://www.geonames.org/),
adapted under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The producer
selects default associations and city keys; GeoNames does not endorse the configuration.

# Actor input Schema

## `queries` (type: `array`):

1–100 keyword queries, run one after another. Each is trimmed and must then hold 1–200 characters without control characters; an invalid query is reported in OUTPUT and not run.

## `maxPostsPerQuery` (type: `integer`):

Strict cap applied independently to each query, including repeated queries. Rows beyond it are discarded, never saved or charged.

## `since` (type: `string`):

Optional UTC calendar day (2026-10-01) or timezone-aware timestamp at whole seconds (2026-10-01T12:00:00Z), inclusive. Posts of unknown date are dropped when a window is set.

## `until` (type: `string`):

Optional UTC calendar day (2026-10-07 includes that entire day) or timezone-aware timestamp at whole seconds, inclusive. Omit or use null for no upper bound.

## `proxyCountry` (type: `string`):

Two uppercase letters (ISO 3166-1 alpha-2 country code, such as US or LV). Facebook search results depend on the egress country; the run uses residential Apify Proxy in this country. A country Apify Proxy cannot serve fails the run before any search.

## `searchCountry` (type: `string`):

Optional supported uppercase country key, such as LV or GB. Blank search city selects its configured capital, not national coverage. Independent of proxyCountry. See Supported search locations in this Actor README.

## `searchCity` (type: `string`):

Optional one city key from Supported search locations in this Actor README; requires searchCountry. Omitted, null or blank selects the configured capital. Unknown explicit cities fail without fallback.

## Actor input object example

```json
{
  "queries": [
    "renewable energy storage"
  ],
  "maxPostsPerQuery": 20,
  "proxyCountry": "US"
}
```

# Actor output Schema

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

No description

## `posts` (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 = {
    "queries": [
        "renewable energy storage"
    ],
    "maxPostsPerQuery": 20,
    "proxyCountry": "US"
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-wan/facebook-search-posts").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 = {
    "queries": ["renewable energy storage"],
    "maxPostsPerQuery": 20,
    "proxyCountry": "US",
}

# Run the Actor and wait for it to finish
run = client.actor("data-wan/facebook-search-posts").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 '{
  "queries": [
    "renewable energy storage"
  ],
  "maxPostsPerQuery": 20,
  "proxyCountry": "US"
}' |
apify call data-wan/facebook-search-posts --silent --output-dataset

```

## MCP server setup

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

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/UavSDvbzv2Ls7GcsZ/builds/wnUyDwU7pHL1v06wW/openapi.json
