Facebook API
13 endpoints for Pages, posts and Marketplace.
Every Facebook endpoint, by group. Each is a GET under /v1/facebook.
Quick Reference
| Property | Value |
|---|---|
| Base path | /v1/facebook |
| Endpoints | 13 |
| Credits | See Below |
| Guide |
Accounts
GETProfile
/v1/facebook/profileA Page or a public person, with its follower count.1 creditGETProfile Photos/v1/facebook/profile/photosA Page's or person's photos, 8 a page.1 creditGETProfile Posts/v1/facebook/profile/postsA Page's or person's posts, newest first, 3 a page.1 creditGETProfile Videos/v1/facebook/profile/videosA Page's videos with their plays, about 6 a page.1 creditPosts
GETPost
/v1/facebook/postOne post, reel or video with its counts and media.1 creditGETPost Comments/v1/facebook/post/commentsA post's comments, most relevant first, 10 a page.1 creditGETPost Comment Replies/v1/facebook/post/comment/repliesThe replies to one comment, about 10 a page.1 creditGETPost Transcript/v1/facebook/post/transcriptA video's captions as text with their times.10 creditsMarketplace
GETMarketplace Item
/v1/facebook/marketplace/itemOne Marketplace listing.1 creditGETMarketplace Search/v1/facebook/marketplace/searchMarketplace listings for a query near a point.1 creditEvents
GETEvent
/v1/facebook/eventOne event, with its time, place and host.1 creditGETEvents/v1/facebook/eventsA city's upcoming events, 12 a page.1 creditGETEvents Search/v1/facebook/events/searchEvents matching a query.1 creditExample Request
Every Facebook endpoint is called this way: its path, and what to read as query parameters.
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
}
]
}
}
}Errors
A call that fails costs nothing. See Errors for every code.