Skip to main content

SDKs

Official open-source clients for Python, JavaScript/TypeScript, Go and PHP. All four cover every endpoint and support cursor pagination.

Python​

pip install socialapis-sdk
from socialapis import Facebook, Instagram

fb = Facebook(api_token="YOUR_API_KEY")
page = fb.get_page_info("nike")
print(page.title, page.followers_count)

ig = Instagram(api_token="YOUR_API_KEY")
profile = ig.get_profile_details("nike")
print(profile.username, profile.followers_count)

Async clients (AsyncFacebook, AsyncInstagram) are included. The package is socialapis-sdk on PyPI; the import name is socialapis.

PyPI · GitHub

JavaScript / TypeScript​

npm install socialapis-sdk
import { Facebook, Instagram } from "socialapis-sdk";

const fb = new Facebook({ apiToken: "YOUR_API_KEY" });
const page = await fb.getPageInfo("nike");
console.log(page.title, page.followers_count);

const ig = new Instagram({ apiToken: "YOUR_API_KEY" });
const profile = await ig.getProfileDetails("nike");
console.log(profile.username, profile.followers_count);

Runs on Node.js 18+, Bun, Deno and browsers. Ships ESM and CommonJS builds.

npm · GitHub

Go​

go get github.com/SocialAPIsHub/socialapis-go
package main

import (
"context"
"fmt"
"log"

socialapis "github.com/SocialAPIsHub/socialapis-go"
)

func main() {
fb, err := socialapis.NewFacebook("YOUR_API_KEY")
if err != nil {
log.Fatal(err)
}
page, err := fb.GetPageInfo(context.Background(), "nike", nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(page.Title, page.FollowersCount)
}

No external dependencies. Errors are typed, so you can check them with errors.As.

pkg.go.dev · GitHub

PHP​

composer require socialapishub/socialapis
use SocialAPIs\Facebook;
use SocialAPIs\Instagram;

$fb = new Facebook('YOUR_API_KEY');
$page = $fb->getPageInfo('nike');
echo $page['title'], ' ', $page['followers_count'];

$ig = new Instagram('YOUR_API_KEY');
$profile = $ig->getProfileDetails('nike');
echo $profile['username'], ' ', $profile['followers_count'];

PHP 8.1+, only the curl extension. Answers are arrays; SocialAPIs\Paginator follows end_cursor for you, and errors are typed exceptions (out of credits, rate limit, bad request…).

Packagist · GitHub

Focused packages​

Smaller packages for one job, built on the SDKs, each with a command-line tool:

PackageWhat it doesInstall
facebook-scraper-apiPage details, Page and group posts, reels, comments and search, with facebook-scraper style functions (get_posts("nasa", pages=2))pip install facebook-scraper-api · npm install facebook-scraper-api
facebook-ads-library-apiMeta Ads Library search by keyword or advertiser, page by page, with CSV exportpip install facebook-ads-library-api · npm install facebook-ads-library-api

Every package we publish is listed on socialapis.io/integrations.

Pagination​

List endpoints return an end_cursor. Pass it back to get the next page. See each SDK's README for the exact method signature.

Migrating from an abandoned scraper?​

The Python SDK includes FacebookScraper and InstagramScraper aliases for code written against kevinzg/facebook-scraper and arc298/instagram-scraper. See the Python SDK README.