Facebook Scraper API
Extract entry point for the platform as structured JSON from public Facebook targets. Queue a request, then retrieve the result with its responseId.
Decide before you build
- Endpoint
- POST /scrape/data-scraper
- Scrapers
- facebookProfile facebookPost
- Cost
- 30 credits / call
- Free plan
- 1,000 credits / month
- Call pattern
- async, POST then GET
- On failure
- credits refunded
- Response format
- JSON
- Concurrency
- by plan tier
Launching a Social Media scrape costs 30 credits. Retrieving a pending result costs nothing; failed scrapes are refunded.
Try the Facebook scraper on your own targetRun a request against a public target and inspect the JSON before you integrate.
Open the live testWhat you get back
facebookProfileProfile
Use facebookProfile to retrieve profile data from a public Facebook target.
- Required input: url
- Optional input: load_more_items_count
- Structured JSON once the result is ready
- Public data only; no account login is used
facebookPostSingle post
Use facebookPost to retrieve single post data from a public Facebook target.
- Required input: url
- No optional input parameters
- Structured JSON once the result is ready
- Public data only; no account login is used
Call the Facebook scraper
Send the scraper name with the input required by that scraper. The POST returns a responseId to poll for the final JSON.
# POST - queue a public social media scrape
curl -X POST "https://api.scraping-bot.io/scrape/data-scraper" \
-u "yourUsername:yourApiKey" \
-H "Content-Type: application/json" \
-d '{
"scraper": "facebookProfile",
"url": "https://example.com/public-page",
"load_more_items_count": 10
}'# GET - retrieve the result after the POST returns a responseId
curl -G "https://api.scraping-bot.io/scrape/data-scraper-response" \
-u "yourUsername:yourApiKey" \
--data-urlencode "responseId=RESPONSE_ID" \
--data-urlencode "scraper=facebookProfile"Code example
Authenticate with your ScrapingBot username and API key, then poll until the queued result is ready.
const auth = "Basic " + Buffer.from(
"yourUsername:yourApiKey",
).toString("base64");
const queued = await fetch("https://api.scraping-bot.io/scrape/data-scraper", {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: auth },
body: JSON.stringify({
"scraper": "facebookProfile",
"url": "https://example.com/public-page",
"load_more_items_count": 10
}),
});
const { responseId } = await queued.json();
let result;
do {
await new Promise((resolve) => setTimeout(resolve, 5000));
result = await fetch(
"https://api.scraping-bot.io/scrape/data-scraper-response?" +
new URLSearchParams({ responseId, scraper: "facebookProfile" }),
{ headers: { Authorization: auth } },
).then((response) => response.json());
} while (result.status === "pending");Run this call in two minutesCreate an account, copy your API key, then use the example above.
Get your API keyRequest parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
scraper | string | — | One of the scraper names supported by this endpoint. |
url | string | — | Public page URL, including https://. |
load_more_items_count | int | 10 | Optional for this scraper. |
Response example
Example returned by the legacy Facebook scraper documentation.
[
{
"owner_url": "https://www.facebook.com/ESAThomasPesquet",
"url": "https://www.facebook.com/ESAThomasPesquet/posts/469151251249512",
"name": "Thomas Pesquet",
"is_sponsored": false,
"date": "2021-12-15T19:52:17.000Z",
"post_text": "Une pose longue de 45 secondes pour prendre cette photo. La Lune qui brille à travers les panneaux solaires et le style presque victorien du module russe MLM ajoutent à l'ambiance de science-fiction. A long exposure night shot, up to a minute shutter speed using a remote cable shutter. The Moon shining through the solar panels and the MLM module adds to the sci-fi feeling. #MissionAlpha https://flic.kr/p/2mQWpv6",
"media_url": "https://scontent-man2-1.xx.fbcdn.net/v/t39.30808-6/266419899_469150804582890_4756844017217203100_n.jpg?_nc_cat=102&ccb=1-7&_nc_sid=36a2c1&_nc_ohc=7KM92e2ofy4AX_CKaGV&_nc_ht=scontent-man2-1.xx&oh=00_AfCHLsHJ0-pWKseREe6fL28bOqg7c51z5daGjhadpcSMxw&oe=644B4AEC",
"likes": 9900,
"shares": 0,
"num_comments": 357,
"scrape_time": "2023-04-24T07:10:18.591Z",
"comments": [
{
"author_name": "Marie France Journeaux",
"author_handle": "mariefrance.journeaux.3",
"text": "Elle est surréaliste cette photo ‼️🤩",
"created": "2021-12-15T22:00:13.000Z"
},
{
"author_name": "Jocelyne L'Hermitte Casiez",
"text": "Merci encore pour tous vos partages ... c est super génial de pouvoir voir tt ça ! On ne s en lasse pas . Merci Merci..😍🥰 un vrai bonheur de nous faire rêver ds cette période si stressante sur terre . !",
"created": "2021-12-15T21:18:04.000Z"
},
{
"author_name": "Monique Monard",
"text": "Merci Thomas de continuer à nous envoyer ces magnifiques vues. Bon courage pour vos réunions et tests divers .",
"created": "2021-12-15T20:35:12.000Z"
},
{
"author_name": "Chez Claude Benet Augustin",
"author_handle": "claude.augustin.14",
"text": "Serait ce une manière détournée de nous chuchoter à l’oreille ta prochaine sélection pour ton séjour sur la Lune 🙄🤔😉 on croise les doigts pour que ton rêve se réalise 🌜🌝🌛",
"created": "2021-12-15T21:50:07.000Z"
}
],
"video_views": ""
}
]Credits, failures and limits
| Case | Credits | Notes |
|---|---|---|
| Launch a scrape | 30 credits | Consumed when a result is ready. |
| Result not ready | Not consumed | The API returns a pending status; retry after a few seconds. |
| Failed, blocked or timed-out scrape | Refunded | Credits are returned for an unsuccessful request. |
Facebook API or Raw HTML scraper?
| Facebook API | Raw HTML scraper | |
|---|---|---|
| Endpoint | /scrape/data-scraper | /scrape/raw-html |
| Returns | Entry point for the platform JSON | Rendered page HTML |
| Flow | Asynchronous: POST then GET | One synchronous request |
| Starting cost | 30 credits | 1 credit |
| Use it when | You need parsed Facebook data | You need your own extraction logic |
Questions about the Facebook API
- Which Facebook scraper names can I use?
- This page supports facebookProfile and facebookPost. Send the exact name in the scraper field.
- Why does the API return a responseId?
- Social Media requests are asynchronous. The responseId lets you retrieve the result without holding the initial request open.
- What if the result is still pending?
- Wait a few seconds and repeat the GET request. A pending response does not consume credits.
- Does this scraper access private account data?
- No. It is intended for public pages and does not sign in to a social media account to access private data.
Source: ScrapingBot API documentation.
Other social media scrapers
Browse the Social Media category for the complete list of guides, or visit the ScrapingBot blog for implementation guides.
Trusted by developers and social media teams.
Customer reviews apply to ScrapingBot's service overall, not specifically to this scraper.
Start scraping Facebook today
1,000 free credits every month. No card required, cancel anytime.
