Analytics with the Python SDK
client.analytics has five methods. All return dict.
How do I get workspace analytics in Python?
stats = client.analytics.get(**{"from": "2026-11-01", "to": "2026-11-30"}, platform="instagram", granularity="weekly")
print(stats["summary"]["totalImpressions"])get(**query) forwards keyword arguments as query parameters: from, to, platform, granularity (daily, weekly, monthly). from is a Python keyword, so pass it through a dict as shown. The response has snapshots, summary and platformBreakdown.
How do I get analytics for one post?
post = client.analytics.get_post("6b1f0c2a9d3e4f5a6b7c8d9e")
for p in post["platforms"]:
print(p["platform"], p["status"], p["postUrl"], p["engagement"])get_post(upload_id) takes the content ID. Fields: uploadId, requestId, title, status, scheduledAt, createdAt, platforms[].
How do I track follower growth per account?
growth = client.analytics.followers(period="last_3months")
for a in growth["accounts"]:
print(a["slug"], a["followers"], a["change"], a["changePct"])
print(growth["totals"]) # {"followers": ..., "change": ...}How do I compare accounts side by side?
cmp_ = client.analytics.accounts(period="last_month", platform="instagram")
for row in cmp_["accounts"]:
print(row["slug"], row["followers"], row["engagement"], row["engagementRate"])followers and accounts take keyword-only arguments: period, from_date, to_date, connection (a slug), platform. period is one of last_day, last_week, last_month, last_3months, last_year and overrides the dates. The default window is the last 30 days. Follower counts are snapshotted once per UTC day, and isTracked is false for platforms that do not report an audience count.
How do I force a refresh?
client.analytics.sync() # {"success": True, "followers": {"captured": n, "failed": n}}What is missing compared with the TypeScript SDK?
getPlatformMetrics, and the whole engagement resource (backfill, resetInsights). See TypeScript analytics and engagement.