Facebook Posts Search API - Real-Time Keyword Search
Pricing
from $2.40 / 1,000 post scrapeds
Facebook Posts Search API - Real-Time Keyword Search
Search public Facebook posts by keyword in one HTTP request and get the posts back in the response: text, author, date, reactions, comments, shares, views, media, group and place. Top or recent, date and location filters, cursor paging. Works from code, n8n, Make and AI agents (MCP).
Pricing
from $2.40 / 1,000 post scrapeds
Rating
0.0
(0)
Developer
Top Api
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
4 days ago
Last modified
Categories
Features
Share
🔎 Facebook Posts Search API - Real-Time Keyword Search
Facebook Posts Search API searches public Facebook posts by keyword in one HTTP request and returns the posts in the response: no run to start, no dataset to fetch. It is an Apify Server Actor, so it also works as a tool for AI agents (MCP) and as one HTTP Request step in n8n, Make or Zapier.
Each post carries its text, author Page or profile, date, reactions by type, comments, shares, video views, photos, video and link attachments, group and place. Search in Facebook's own relevance order or newest first, inside a date window, near a place, and keep only the post types you want. You pay per post returned; a search that returns no post costs nothing.
✨ What you get
- 📝 Post text, hashtags and mentions
- 👤 Author: name, id, profile or Page URL, type (user, Page, business Page)
- 📅 Date: Unix timestamp and ISO
published_at - ❤️ Engagement: reactions total and by type (like, love, care, haha, wow, sad, angry), comments, shares, video views
- 🖼️ Media: photos and albums, video URL / id / thumbnail / duration, link previews, shared posts
- 👥 Group and place when the post is in a group or tagged at a place
- 💬 Top public comments and video files with
includePostDetails - 🧭 Filters: top or recent, date window, place, post type, source (groups / Pages), minimum reactions, keywords
- 📄 Paging:
meta.nextCursorreads the next posts of the same search - 🔑 No Facebook account, no cookies, no API key of yours (only your Apify token)
🚀 How to call it
Every request needs your Apify API token in the Authorization header.
GET
curl "https://topapi--facebook-posts-search-api.apify.actor/search?query=coffee&maxPosts=10" \-H "Authorization: Bearer <YOUR_APIFY_TOKEN>"
POST
curl -X POST "https://topapi--facebook-posts-search-api.apify.actor/search" \-H "Authorization: Bearer <YOUR_APIFY_TOKEN>" -H "Content-Type: application/json" \-d '{"query": "solar panels", "sortBy": "recent", "startDate": "7 days", "maxPosts": 20}'
Python
import requestsURL = "https://topapi--facebook-posts-search-api.apify.actor/search"HEADERS = {"Authorization": "Bearer <YOUR_APIFY_TOKEN>"}params = {"query": "electric cars", "maxPosts": 20, "sortBy": "recent"}posts = []for _ in range(3): # three pages of resultsr = requests.get(URL, params=params, headers=HEADERS, timeout=180)data = r.json()if r.status_code != 200:print(r.status_code, data["error"]["type"]); breakposts += data["items"]if not data["meta"]["nextCursor"]:breakparams["cursor"] = data["meta"]["nextCursor"]print(len(posts), "posts")
JavaScript
const res = await fetch('https://topapi--facebook-posts-search-api.apify.actor/search?query=coffee&maxPosts=10',{ headers: { Authorization: `Bearer ${process.env.APIFY_TOKEN}` } },);const { items, meta } = await res.json();console.log(items.length, meta.nextCursor);
n8n, Make, Zapier
One HTTP Request step: method GET, URL https://topapi--facebook-posts-search-api.apify.actor/search, query
parameters query and maxPosts, header Authorization = Bearer <YOUR_APIFY_TOKEN>. The posts are items.
AI agents (MCP)
MCP server URL: https://topapi--facebook-posts-search-api.apify.actor/mcp (Streamable HTTP, header
Authorization: Bearer <YOUR_APIFY_TOKEN>). Tool: search_posts, same parameters as the HTTP endpoint. Use
compact: true to give the model only the core fields.
⚙️ Parameters
| Parameter | Type | Default | What it does |
|---|---|---|---|
query | string | required | What to search for, as typed into Facebook's search box, or a facebook.com/search/...?q= or /hashtag/... URL. Also accepted as q, keyword, searchQuery, term. |
maxPosts | integer | 10 | Posts to return, 1-50. Facebook serves 5-6 posts a page. |
sortBy | top | recent | top | Facebook's relevance order, or newest first. |
startDate | string | Only posts on or after this day: 2026-09-01, 7 days, 2 months, or a day count. | |
endDate | string | Only posts on or before this day (the whole day counts). | |
locationUid | string | A numeric Facebook place id. | |
mustContainQuery | boolean | false | Only posts whose text contains the query (Facebook's search is fuzzy). |
keywordFilter | string | Comma-separated words: keep posts whose text, author, link, group or place mention any of them. | |
postType | all | photo | video | link | text | all | Only one kind of post. |
postSource | all | groups | pages_and_profiles | business_pages | all | Only group posts, Page/profile posts, or business Page posts. |
minReactions | integer | 0 | Only posts with at least this many reactions. |
includePostDetails | boolean | false | Add the top public comments, video file URLs and view count. |
compact | boolean | false | Core fields only, for AI agents. |
cursor | string | The previous response's meta.nextCursor, with the same query and filters, to read further. |
GET / lists the endpoints; the Server tab in Console shows the OpenAPI description.
📦 Response
A real post from a coffee search (2026-11-18), trimmed:
{"ok": true,"count": 10,"items": [{"post_id": "1158323430087039","type": "photo","url": "https://www.facebook.com/permalink.php?story_fbid=pfbid02MHX4msx...&id=100077281797833","message": "Have a nice day 🤎☕","published_at": "2026-11-17T04:00:03.000Z","author": { "id": "100077281797833", "name": "Coffee.", "url": "https://www.facebook.com/people/Coffee/100077281797833/", "type": "user" },"reactions_count": 583,"comments_count": 13,"reshare_count": 69,"reactions": { "like": 514, "love": 63, "care": 5, "wow": 1, "haha": 0, "sad": 0, "angry": 0 }}],"meta": { "query": "coffee", "sort": "top", "pages": 2, "read": 12, "filtered": {}, "stopReason": "max_posts", "nextCursor": "{\"page...", "charged": { "post-scraped": 10 }, "ms": 5272 }}
| Field | Filled (46 posts from 11 search pages, 2026-11-18) |
|---|---|
post_id, type, url, timestamp, published_at, author.name, author.id, author.url | 100% |
message, reactions_count, comments_count, reshare_count | 100% |
image, reactions (by type) | 93% |
hashtags | 30% (posts that use them) |
group | 22% (group posts) |
external_url, video, location, video_view_count | 2-4% (link, video and place posts in this sample) |
top_comments, video_files | with includePostDetails (2 of 2 in the test, 6-10 comments each) |
🧾 Status codes (and what is charged)
| HTTP | error.type | Meaning | Charged |
|---|---|---|---|
200 | Posts returned | post-scraped per post, post-details per post with details | |
400 | invalid-input | Bad parameter or date | No |
404 | no-posts | No public post for the query, or none passed your filters. error.meta shows what was read and filtered | No |
410 | cursor-expired | Facebook no longer accepts that cursor: search again without it | No |
429 | too-many-requests | More than 4 of your requests in flight at once | No |
503 | blocked, timeout | Facebook refused or did not answer; retry | No |
💰 Pricing
| Event | Price |
|---|---|
Post returned (post-scraped) | $0.0024 ($2.40 per 1,000) |
Post details add-on (post-details) | $0.001 per post that receives details |
No start fee. Nothing is charged for 4xx or 503 answers.
🗃️ Batch runs (input interface)
You can also start the actor as a normal run with a list of searches: monitor mode, long date-range backfills with resume, and one dataset row per post, exactly like a batch scraper. Use the HTTP endpoint for one search at a time.
⏱️ Speed (measured on Apify, 2026-11-18)
- 3 posts: 4-5 s; 10 posts: 5-8 s; 50 posts: 45-75 s (Facebook serves 5-6 posts a page)
- First request after a quiet spell: add 5-10 s while the server starts and opens a Facebook session
- 4 searches in parallel: all answered, 5.6-7.5 s each
⚠️ Limits
- Facebook's search is fuzzy: it can return posts that do not contain your words. Use
mustContainQueryorkeywordFilterto keep only exact matches. - Signed-out search only sees public posts, in the order Facebook serves them; it is not every post ever made.
- A request reads at most 3 pages more than the posts it returns, so very narrow filters can end with fewer posts than
maxPosts(or a404); continue withmeta.nextCursor. - 50 posts per request; page further with the cursor.
❓ FAQ
Do I need a Facebook account or cookies?
No. The actor uses Facebook's public search the way a signed-out visitor does. You only need your Apify token.
What does a search cost?
$0.0024 per post returned, so a 10-post search is $0.024. A search that returns nothing is free.
How do I get more than 50 posts?
Repeat the request with cursor set to the previous response's meta.nextCursor.
Can I search a hashtag?
Yes: query=#vegan, or paste the facebook.com/hashtag/vegan URL.
Can I get only recent posts?
sortBy=recent for newest first, and startDate=7 days (or a date) to bound the window.
Why do some posts not contain my keyword?
Facebook's own search matches loosely. mustContainQuery=true keeps only posts whose text contains the query.
Does it return comments?
The top public comments, with includePostDetails=true (charged $0.001 per post that gets them).
How do I use it from an AI agent?
Point an MCP client at https://topapi--facebook-posts-search-api.apify.actor/mcp with your Apify token, or add it
through mcp.apify.com. The tool is search_posts; compact: true keeps answers short.
How do I use it in n8n or Make?
One HTTP Request step with query and your token in the Authorization header.
What if Facebook refuses a request?
You get a 503 and pay nothing. The actor already retries on fresh exits, so a retry a moment later usually works.
Your feedback
Open an issue on the actor page with the request you sent and the response you got.