Skip to Content

Platforms

Facebook

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

PropertyValue
Endpoints13
Accounts byhandle or url
Posts byurl
Posts a page3
Comments a page10, with replies
Transcripts10 credits
CountsRounded, such as "28M"

Pages and People

EndpointReturnsCredits
profileA Page or a public person, with its follower count.1
profile/photosA Page's or person's photos, 8 a page.1
profile/postsA Page's or person's posts, newest first, 3 a page.1
profile/videosA 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" });
Response
{
  "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 ext has its pageId, category, coverUrl and 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

EndpointReturnsCredits
postOne post, reel or video with its counts and media.1
post/commentsA post's comments, most relevant first, 10 a page.1
post/comment/repliesThe replies to one comment, about 10 a page.1
post/transcriptA 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 as token to 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

EndpointReturnsCredits
marketplace/itemOne Marketplace listing.1
marketplace/searchMarketplace listings for a query near a point.1
EndpointReturnsCredits
eventOne event, with its time, place and host.1
eventsA city's upcoming events, 12 a page.1
events/searchEvents matching a query.1
  • Marketplace search takes a query, a latitude and longitude, and radiusKm (40 by default).
  • It gives the first page, about 14 listings.
  • A city's events are read by its events page's url or cityId, 12 a page.
  • Event search gives two short pages.

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.