Search public Facebook posts by keyword
Find public Facebook posts that match a keyword, with text, permalink, author, publish time, likes, comments and reactions. 10 to 50 credits per page.
To search public Facebook posts by keyword, call GET /v1/facebook/search/posts with a query. Each result carries the post's text, permalink, publish time, author, like and comment counts, and a breakdown of reactions by type. It is metered at 10 to 50 credits per page; the sample page below returned 5 posts and cost 10. Meta's public Graph API has no keyword search over public posts, and Meta Content Library, which has one, is limited to approved researchers.
Cost
10 credits per page. A plain call reads one page and costs 10 credits (the sample page held 5 posts). max_pages (1 to 5) walks up to five pages in one call: the call holds 10 credits per page when it starts, up to 50 at max_pages=5, and you're charged for the pages it actually read. Send dry_run=1 for a free quote. Asking for the same page again within 1 hour is answered from the shared cache for 2 credits. Failed calls and empty results are free.
How do I narrow the search?
query is the only required input: a keyword or phrase, such as NASA. These optional parameters narrow it:
| Parameter | What it does |
|---|---|
recent_posts=true | Ranks by recency instead of relevance. |
start_date, end_date | Only posts on or after / on or before a date, as YYYY-MM-DD. |
max_age_days | Keeps only posts published in the last N days, 1 to 3650. Posts with no date are dropped. |
location_uid | A Facebook location ID, to scope the search to a place. |
max_pages | Walks 1 to 5 pages in one call and returns the rows from all of them. |
Make the request
curl "https://api.insightsocial.app/v1/facebook/search/posts?query=NASA" \
-H "x-api-key: $INSIGHTSOCIAL_API_KEY"What comes back
A real response from 2026-10-14 for NASA, shortened: one post instead of 5, long URLs cut, and the reaction list cut to the top two.
{
"success": true,
"endpoint": "/v1/facebook/search/posts",
"schema_version": "2",
"data": {
"items": [
{
"post": {
"id": "1652244896270880",
"url": "https://www.facebook.com/NASA/posts/pfbid0dX7KLT7wBEzj8kzTo2NQBYp…",
"kind": null,
"content": {
"text": "Brewing up baby stars ⭐\n\nNASA's James Webb Space Telescope's unique view reveals many previously hidden stars in this nebula…",
"media_urls": ["https://scontent.fada6-1.fna.fbcdn.net/…"],
"thumbnail_url": null,
"duration_seconds": null
},
"author": {
"id": "100044561550831",
"username": "NASA",
"display_name": "NASA - National Aeronautics and Space Administration",
"avatar_url": null,
"verified": null
},
"engagement": { "views": null, "likes": 8319, "comments": 177, "shares": null, "saves": null },
"published_at": "2026-10-09T20:54:33.000Z",
"ext": {
"author_url": "https://www.facebook.com/NASA",
"reaction_counts": [
{ "type": "like", "count": 5012 },
{ "type": "love", "count": 2985 }
]
}
}
}
],
"total": null,
"truncated": null
},
"pagination": { "next_cursor": "v2c.s.rRxQehfH6OjOtFbCKikKJw", "has_more": true, "page_size": 5 },
"unavailable": [
"items[].post.author.avatar_url",
"items[].post.engagement.views",
"items[].post.engagement.shares"
],
"credits_used": 10
}| Field | What it holds |
|---|---|
data.items[].post | One post in the shared post shape: text, permalink, media URLs, publish time. |
data.items[].post.author | The page or profile that posted it: ID, username, display name. ext.author_url links to it. |
data.items[].post.engagement.likes | All reactions added up, not only Like. 8,319 here. |
data.items[].post.ext.reaction_counts | The same total split by type: like, love, care, wow, haha, sad, anger. |
data.items[].post.engagement.comments | The comment count. |
unavailable | Fields this endpoint cannot fill: views, shares and the author's avatar. Their null means unknown, not zero. |
How do I get more results?
Send pagination.next_cursor back as cursor, with the same query and filters, and stop when pagination.has_more is false. Each page is 10 to 50 credits. To fetch up to 5 pages in one request, pass max_pages instead.
import os
import requests
BASE = "https://api.insightsocial.app/v1"
HEADERS = {"x-api-key": os.environ["INSIGHTSOCIAL_API_KEY"]}
params = {"query": "NASA", "recent_posts": "true"}
posts = []
for _ in range(5):
body = requests.get(f"{BASE}/facebook/search/posts", params=params, headers=HEADERS, timeout=120).json()
posts += body["data"]["items"]
if not body["pagination"]["has_more"]:
break
params["cursor"] = body["pagination"]["next_cursor"]See Pagination for the full rules.
What are the limits?
- Small pages. The sample page held 5 posts. Plan on many pages for a broad keyword.
- Relevance order by default. The sample page mixed posts from October 9 and October 14. Pass
recent_posts=truefor recency, or a date window. - No views or shares.
engagement.viewsandengagement.sharesare listed inunavailable.author.avatar_urlandauthor.verifiedcame backnulltoo. - Public posts only. The search covers public Facebook posts.
Can I search Facebook for other things?
Yes. Four sibling endpoints take a keyword too:
GET /v1/facebook/search/pages(10 credits): pages by name, with page ID, display name, permalink, avatar and verified flag. Follower counts are not on this card.GET /v1/facebook/search/people(10 credits): people by name. The ID is often apfbidtoken, not a numeric user ID.GET /v1/facebook/search/groups(10 to 110 credits): public groups, in the shape the group endpoints take. Addinclude=detailsfor member counts, descriptions and privacy.GET /v1/facebook/search/videos(10 credits): public videos by phrase. View counts there are a display string, not a number.
What can I build with it?
- Brand and topic monitoring. Run your brand name daily with
recent_posts=trueand store new posts with their reaction counts. The brand mention monitoring recipe shows the daily dedupe-and-alert loop; add this endpoint as one more source. - News and event tracking. Bound a keyword with
start_dateandend_dateto see who posted about an event and how much reaction each post drew. - Finding pages to follow. The authors of the top results are the pages already posting about a topic.
Related
GET /v1/facebook/search/postsreference: every parameter and field.GET /v1/facebook/search/pagesandGET /v1/facebook/search/groups: find pages and groups by keyword.- Facebook endpoints: everything the API covers on Facebook.
Get the posts in a LinkedIn group
Read a LinkedIn group's discussion feed: post text, author, headline, likes, comments, shares and publish time, by group ID. 50 credits per page.
Get a YouTube channel's business email
Read the address behind a YouTube channel's "View email address" button, plus its country and profile, by handle. 250 credits per channel.