Platforms
Read Facebook Pages and public people, their posts, videos and photos, comments and replies, transcripts, Marketplace and events.
Read Pages and public people with their posts, photos and videos, posts with their comments and captions, and Marketplace listings and events.
Quick Reference
| Property | Value |
|---|---|
| Endpoints | 13 |
| Accounts by | handle or url |
| Posts by | url |
| Posts a page | 3 |
| Comments a page | 10, with replies |
| Transcripts | 10 credits |
| Counts | Rounded, such as "28M" |
Pages and People
| Endpoint | Returns | Credits |
|---|---|---|
profile | A Page or a public person, with its follower count. | 1 |
profile/photos | A Page's or person's photos, 8 a page. | 1 |
profile/posts | A Page's or person's posts, newest first, 3 a page. | 1 |
profile/videos | A Page's videos with their plays, about 6 a page. | 1 |
Read a Profile
import { SocialAPI } from "@socialapihq/sdk";
const client = new SocialAPI({ apiKey: process.env.SOCIALAPI_API_KEY });
const { data } = await client.facebook.profile({ handle: "NASA" });{
"data": {
"id": "100044561550831",
"username": "NASA",
"displayName": "NASA - National Aeronautics and Space Administration",
"bio": null,
"avatarUrl": "https://scontent-ham3-1.xx.fbcdn.net/v/t39.30808-1/243095782_416661036495945_3843362260429099279_n.png?stp=dst-png&cstp=mx800x800&ctp=s200x200&_nc_cat=1&ccb=1-7&_nc_sid=2d3e12&_nc_ohc=9L3SyA6O4hMQ7kNvwFFAvxF&_nc_oc=AdpybpYhMw8jWVtu_JxDWUdMtLI5Czq9TSbYuo76Tt_Ox7pjEOtGt-zaWMbXtwrefdE&_nc_zt=24&_nc_ht=scontent-ham3-1.xx&_nc_gid=T5i9pWIous68P_Bvr73CIQ&_nc_ss=79389&oh=00_AQSM-2Yh4eXf9cZZwPB8BzXgNMEWSvNW3yHgzBkVrWdheQ&oe=6B0CCF95",
"url": "https://www.facebook.com/NASA",
"verified": true,
"private": false,
"followers": 28000000,
"following": 53,
"likes": null,
"posts": null,
"externalUrl": "https://www.nasa.gov/nasa-app/",
"createdAt": null,
"ext": {
"pageId": "54971236771",
"category": "Government organization",
"followersLabel": "28M followers",
"followingLabel": "53 following",
"coverUrl": "https://scontent-ham3-1.xx.fbcdn.net/v/t39.99422-6/809146614_4484013928506139_3181913787670602881_n.png?stp=dst-jpg_tt6&cstp=mx2047x1487&ctp=s960x960&_nc_cat=110&_nc_map=urlgen_bucketless&ccb=1-7&_nc_sid=cc71e4&_nc_ohc=GVR710ihTyEQ7kNvwHoC3xD&_nc_oc=AdrCE6VeeQD4Y3D241kJ12-Iay1yW4-xHohgIU2E_l-MxAObvtEm-CmlFH7rAhOwXXU&_nc_zt=14&_nc_ht=scontent-ham3-1.xx&_nc_gid=T5i9pWIous68P_Bvr73CIQ&_nc_ss=79389&oh=00_AQR060AGMvQOt9YGGAfnInfe0lHPcITapSQoOhUfSrNIYA&oe=6B0CD367",
"intro": [
{
"kind": "category",
"text": "Page · Government organization",
"url": null
},
{
"kind": "confirmed_owner_label",
"text": "NATIONAL AERONAUTICS AND SPACE ADMINISTRATION is responsible for this Page",
"url": null
},
{
"kind": "email",
"text": "public-inquiries@hq.nasa.gov",
"url": null
}
]
}
}
}- A handle is the vanity name, or the numeric id, which is followed to the name.
- A profile's
exthas itspageId,category,coverUrland the intro's lines.
Rounded Counts
Facebook rounds its counts for a visitor, so "28M" comes as 28000000. Its ext.followersLabel keeps the text.
Lists
- Posts come 3 a page, as Facebook pages them.
- Photos come 8 a page, and videos about 6 with their plays as
views. - Only a Page has a videos tab.
Posts
| Endpoint | Returns | Credits |
|---|---|---|
post | One post, reel or video with its counts and media. | 1 |
post/comments | A post's comments, most relevant first, 10 a page. | 1 |
post/comment/replies | The replies to one comment, about 10 a page. | 1 |
post/transcript | A video's captions as text with their times. | 10 |
Post Links
A /posts/pfbid… link is read at once. Any other link is opened once to find its post, then cached for a day.
Reactions
Likes in stats.likes are every reaction together. Their kinds are in ext.reactions.
Comments and Replies
- Comments come 10 a page, most relevant first.
- A comment with replies has
ext.repliesToken. Pass it astokento read them.
Transcripts
- Transcripts read Facebook's own caption track.
- Where the video's language has none, they are a translation, with
translated: true. - A post lists its tracks in
ext.captions.
Marketplace and Events
| Endpoint | Returns | Credits |
|---|---|---|
marketplace/item | One Marketplace listing. | 1 |
marketplace/search | Marketplace listings for a query near a point. | 1 |
| Endpoint | Returns | Credits |
|---|---|---|
event | One event, with its time, place and host. | 1 |
events | A city's upcoming events, 12 a page. | 1 |
events/search | Events matching a query. | 1 |
- Marketplace search takes a
query, alatitudeandlongitude, andradiusKm(40 by default). - It gives the first page, about 14 listings.
- A city's events are read by its events page's
urlorcityId, 12 a page. - Event search gives two short pages.
Share Links
Short links such as fb.watch/… and facebook.com/share/… return 400 INVALID_REQUEST. Open the link and send the full link it leads to.