Facebook scraper API: posts, comments, pages, events and ads as JSON
Five endpoints for public Facebook data, hosted on Apify and called like any REST API: token, JSON in, JSON out, pagination, webhooks, schedules. They read what a signed-out visitor sees, need no Facebook account or app review, and return the field names of the official Apify scrapers. This page is the overview; each endpoint has its own reference.
What the Graph API gives you today
Meta's Graph API serves the assets you own. Reading other pages' posts, comments or contact details, searching events, or listing commercial ads needs features granted after app review (Page Public Content Access, Page Public Metadata Access, the Ad Library API's identity check) that most developers never obtain, and public event search was removed altogether. These endpoints exist for everything the Graph API will not give you.
The endpoint
One HTTP call. The synchronous form waits for the run and returns the records in the same response (fine for up to a few minutes of work); the asynchronous form returns a run id at once and you read the dataset when it has finished, with webhooks if you want a callback.
Synchronous
curl -X POST "https://api.apify.com/v2/acts/alfalfa~facebook-posts-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN&format=json" \
-H 'Content-Type: application/json' \
-d '{"startUrls": [{"url": "https://www.facebook.com/humansofnewyork"}], "resultsLimit": 20}'
Asynchronous
# start the run (returns immediately with the run id and dataset id)
curl -X POST "https://api.apify.com/v2/acts/alfalfa~facebook-posts-scraper/runs?token=$APIFY_TOKEN" \
-H 'Content-Type: application/json' -d '{"startUrls": [{"url": "https://www.facebook.com/humansofnewyork"}], "resultsLimit": 20}'
# read the results when the run has finished (JSON, CSV or XLSX; paginate with offset and limit)
curl "https://api.apify.com/v2/datasets/<defaultDatasetId>/items?token=$APIFY_TOKEN&format=json&offset=0&limit=1000"
Python
from apify_client import ApifyClient # pip install apify-client
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("alfalfa/facebook-posts-scraper").call(run_input={
"startUrls": [
{
"url": "https://www.facebook.com/humansofnewyork"
}
],
"resultsLimit": 20
})
items = list(client.dataset(run.default_dataset_id).iterate_items())
print(len(items), items[0])
JavaScript
import { ApifyClient } from 'apify-client'; // npm install apify-client
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('alfalfa/facebook-posts-scraper').call({"startUrls": [{"url": "https://www.facebook.com/humansofnewyork"}], "resultsLimit": 20});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length, items[0]);
Request fields
| Field | Type | Meaning |
|---|---|---|
startUrls / searchQueries / pageIds | array | What to read: URLs, keywords or page IDs, depending on the endpoint. |
resultsLimit / maxEvents / maxAds | integer | How many records per input. |
| filters | various | Date ranges, country, status, media type, comment mode, add-ons such as organizer email, About text, video transcript, ad details. |
proxyConfiguration | object | Residential proxies by default, included in the price; your own proxies optional. |
Response fields
One JSON object per record. Field names are the ones the official Apify Actor uses, so code written for it works unchanged.
| Field | Meaning |
|---|---|
| posts | postId, text, time, likes, comments, shares, media, reaction split |
| comments | commentId, text, date, profileName, likesCount, threadingDepth, parent links |
| pages | title, email, phone, website, address, likes, followers, rating, about_me |
| events | name, utcStartDate, location with coordinates, ticketsInfo, usersGoing, organizerEmail |
| ads | adArchiveID, pageName, isActive, dates, snapshot with creative, CTA and link, ad_details with EU reach |
The five endpoints
| Data | Actor | Returns | Per 1,000 |
|---|---|---|---|
| Posts | alfalfa/facebook-posts-scraper | posts of any public page or profile with reactions, comments, shares, media | $2 |
| Comments | alfalfa/facebook-comments-scraper | comments and reply threads of any public post | $0.50 |
| Pages | alfalfa/facebook-pages-scraper | page details with email, phone, website, address, followers, rating | $3.50 |
| Events | alfalfa/facebook-events-scraper | events by keyword, city, page or URL, with organizer email | $5 |
| Ad Library | alfalfa/facebook-ads-library-scraper | ads by keyword, advertiser page or URL, with creatives and EU reach | $0.50 |
Every endpoint takes the same shape of call: POST the input JSON to /v2/acts/alfalfa~<actor>/runs (or the run-sync-get-dataset-items variant), read the dataset. Field names match the official Apify Actors for each surface, so switching is a one-word change.
Limits, pagination, scheduling
- The synchronous endpoint cuts off after about five minutes; for large jobs use the asynchronous one and read the dataset in pages (
offsetandlimit, up to 1,000 per page, orformat=csvfor a file). - Runs can be scheduled on the platform (cron), triggered by webhook, and called from n8n, Make, Zapier or an AI agent through MCP.
- Set a maximum budget per run in the Actor settings; the run stops at the limit and never overshoots.
- Public data only: what a visitor without a Facebook account can see. Groups, Marketplace and private profiles are out of scope.
Pricing
From $0.50 per 1,000 records (comments, ads) to $5 per 1,000 (events), no start fees. Platform usage and residential proxies are included; you pay only for records written to the dataset. The Apify free plan includes $5 of usage a month, enough to try it properly.
Questions people ask
Is there an official Facebook scraper API?
No. Meta offers the Graph API for assets you own and the Ad Library API for political and EU ads. Everything else public is read from the pages themselves; these endpoints do that and expose it as an API.
Do I need a Facebook account or app review?
No. An Apify account and its API token. The endpoints read only what a visitor without a Facebook account can see.
Can I call it from n8n, Make, Zapier or an AI agent?
Yes. The Apify node in n8n, Make and Zapier runs any of the five Actors, and the Apify MCP server exposes them as tools for AI agents.
Is the output compatible with the official Apify scrapers?
Yes. Each endpoint returns the field names of its official counterpart, so existing code, sheets and workflows keep working after the Actor name changes.