Skip to main content

Social graph export: followers, following and mutuals in three calls

· 3 min read
Product documentation and integration guides

Individual connection lists are snapshots; a social graph export — followers plus following on both sides of a relationship — is the dataset that answers real questions. This tutorial builds one for a cross-network workflow: an Instagram account and the Facebook page of the same brand.

What we export​

EndpointNetworkEdges
FollowersInstagramaudience → account
FollowingInstagramaccount → follows
Facebook followersFacebookaudience → page
Facebook followingsFacebookpage → follows

Four paginated walks, one shared helper — every list is cursor-based, so the pattern is identical (see the followers export guide for the loop; Facebook uses after instead of max_id).

from getsocialapi import Client
from getsocialapi_facebook import FacebookAPI, Transport

ig = Client(api_key="gsa_live_...").instagram
fb = FacebookAPI(Transport(
base_url="https://api.getsocialapi.com/fb",
api_key="gsa_live_..."))

def ig_export(fn, uid):
rows, cursor = [], None
while True:
page = fn(uid, count=50, max_id=cursor)
rows += page["users"]
cursor = page.get("next_max_id")
if not cursor:
return rows

ig_followers = ig_export(ig.followers, ig_uid)
ig_following = ig_export(ig.following, ig_uid)

Mutuals: the community core​

f_ids = {u["pk"] for u in ig_followers}
g_ids = {u["pk"] for u in ig_following}
mutuals = f_ids & g_ids
print(f"followers={len(f_ids)}, following={len(g_ids)}, mutual={len(mutuals)}")

Mutuals are the strongest relationship signal both networks expose: each side opted into the other. Growth teams treat mutual-count trajectory as a leading engagement indicator — it moves before follower count does.

Ratio and asymmetry​

ratio = len(f_ids) / max(len(g_ids), 1)
one_way = g_ids - f_ids # follows them, they don't follow back
  • ratio >> 1 — broadcast account (media, brand).
  • ratio ≈ 1 with high mutuals — personal/community account.
  • one_way dominated by spam-pattern profiles — audience quality debt.

Cross-network identity hints​

Facebook pages and Instagram accounts of the same brand rarely share ids — but they share people. Sample usernames/normalized names from both follower lists and intersect: the overlap coefficient between the two audiences measures how separable the communities really are (marketing teams use it to decide whether to run one strategy or two).

Storage shape​

One table beats clever schemas at collection time:

edges(source, target, network, edge_type, first_seen, last_seen)

Re-running the export updates last_seen; edges that disappear move to an archive table. Churn (edges with stale last_seen) is itself a dataset — audience decay per account.

Budget math​

A brand with 50k Instagram followers + 3k following and a Facebook page with 20k followers is ~1 500 + 60 + ~1 300 + ~200 requests — about 3 100 calls, an hour of polite pacing, resumable via cursors at any point. The rate limits guide covers the retry loop.

Four walks, one table, every graph question — getsocialapi.com, first 100 calls free.

Build with GetSocialAPI​

Explore Instagram API and Facebook API for capabilities, pricing and integration examples. Create an account to start with 100 free calls, or follow the quickstart.