How to get an Instagram follower count in Python
Checked on 2026-11-19.
There are three practical ways to read an Instagram follower count from Python. Meta's official API returns it for your own account and for other business and creator accounts, never for a personal one. The Instaloader library and an HTTP API read the public profile instead, which works for any username.
1. Meta's official API: business and creator accounts
The official route is the Instagram Platform. Its overview says in the first sentence whom it serves: "Instagram professional accounts, including business and creator accounts". Two requests return a follower count. For your own account it is the followers_count field of the account. For somebody else's there is Business Discovery, which "Returns data about another Instagram Business or Creator IG User": you send the request to your own account's ID and name the other account inside it.
import os
import requests
ME = os.environ["IG_ACCOUNT_ID"] # the ID of your own professional account
res = requests.get(
f"https://graph.facebook.com/v27.0/{ME}",
params={
"fields": "business_discovery.username(bluebottle){followers_count,media_count}",
"access_token": os.environ["IG_ACCESS_TOKEN"],
},
timeout=30,
)
body = res.json()
if "error" in body:
print(body["error"]["message"])
else:
found = body["business_discovery"]
print(found["followers_count"], found["media_count"])bluebottle is the account Meta's own example reads. For your own count, ask for fields=followers_count without the business_discovery part.
Before the first call you need three things: an Instagram professional account of your own, a Meta app, and an access token for that account. The reference asks for the permissions instagram_basic, instagram_manage_insights and pages_read_engagement, in a setup where your account is linked to a Facebook Page. For new apps Meta now recommends a setup it calls Unified Login, which needs no Page but an app owned by a business portfolio, and the Business Discovery guide lists it as supported. While the app serves only your own account, "Standard Access is all your app needs". An app that other people sign in to needs Advanced Access, which "requires App Review and Business Verification".
Where it stops: at personal accounts. The overview says "your app users must have an Instagram professional account", and Meta's page for the Facebook Login setup says it "cannot access Instagram consumer accounts (i.e., non-Business or non-Creator Instagram accounts)". You cannot tell from a username which kind an account is. Business Discovery also returns nothing for age-gated accounts. And it is a lot of setup for one number: an app, your own professional account and a token to keep valid (the long-lived ones the overview describes last 60 days and can be refreshed).
2. Instaloader, a free library
Instaloader is an open-source Python tool that downloads posts and their metadata from Instagram. Its Profile class has a followers property, and a public profile is read without logging in. This is the call from its documentation:
# pip install instaloader
import instaloader
L = instaloader.Instaloader()
profile = instaloader.Profile.from_username(L.context, "nasa")
print(profile.followers, profile.followees, profile.is_verified)It costs nothing and needs no key, which makes it the first thing to try on your own computer.
Where it breaks: on servers, and whenever Instagram changes something. The project's troubleshooting page says that "cloud, VPN and public proxy services, might be subject to significantly stricter limits for anonymous access", and that restarting Instaloader often within a short time "is prone to cause a 429". Its issue tracker shows how that looks in practice: in a report from August 2026 that is still open, Profile.from_username() answered 429 Too Many Requests on the first request of a session. Version 4.16 of 26 October 2026 changed how profiles are loaded, so upgrade before you judge it. Without a login some values are missing as well: the documentation gives the post count as "None if unavailable (e.g. when not logged in)". Instaloader calls itself "an independent and unofficial project. Use at your own risk". When it fails, the guide to its 401, 429 and login errors explains each message.
3. An HTTP API, for any username
With Pipefetch the profile is one HTTPS request with one key. It reads the public profile, so it needs no Instagram account, no Meta app and no token, and it makes no difference whether the account is personal, business or creator.
import os
import requests
res = requests.get(
"https://pipefetch.com/v1/instagram/profile",
params={"username": "nasa", "posts": "false"}, # a username, an @handle or a profile URL
headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
timeout=90,
)
if res.status_code == 404:
print("No such account") # not charged
else:
res.raise_for_status()
profile = res.json()["data"]
print(profile["username"], profile["followerCount"], profile["followingCount"], profile["postCount"])followerCount, followingCount and postCount are the exact numbers, not the rounded ones Instagram displays (104M). posts=false leaves the latest posts out for a smaller answer; the price is the same. A private account returns its counts, name and bio with isPrivate true. One profile costs 2 credits, an account that does not exist answers 404 and costs nothing, and a new account has 100 free credits and needs no card. The reference lists every field.
Where it stops: this is not an official API, and Pipefetch is not affiliated with Instagram or Meta. It returns what a profile shows to a visitor who is not logged in: no follower lists, no stories, no posts of private accounts. Every request is read live, so it takes a few seconds (most requests take 2 to 9), and when Instagram does not answer you get a 502 that is not charged and can be retried.
When you have a name, not a username
All three routes start from a username. If you only know what a business is called, the search endpoint finds accounts by the words in their name and returns each with its exact follower count, for 1 credit.
import os
import requests
res = requests.get(
"https://pipefetch.com/v1/instagram/search",
params={"q": "coffee shop", "type": "user"},
headers={"x-api-key": os.environ["PIPEFETCH_API_KEY"]},
timeout=90,
)
if res.status_code == 404:
print("No accounts named like that") # not charged
else:
res.raise_for_status()
for account in res.json()["data"]["results"]:
print(account["username"], account["followerCount"])Know what this search is before you rely on it. Instagram has no account search without a login, so the endpoint asks the advertiser search of Meta's Ad Library. It finds accounts of businesses, brands, organizations and creators. It is not the search box of the Instagram app, and a personal account with no Facebook Page behind it is not found. One search returns 15 accounts at most and usually fewer.
Which one should you use?
| Situation | Use |
|---|---|
| Your own account, or business and creator accounts, and you want Meta's own numbers | The official API |
| A few public accounts, from a script on your own computer | Instaloader |
| Any public username, whatever the account type, from a server or a scheduled job | An HTTP API such as Pipefetch |
| You have a business name and no username | The Pipefetch search endpoint, then any of the three |
Tracking a count over time
None of these routes returns history: each gives the count at the moment you ask. To see growth, read the count on a schedule, once a day is plenty, and store it with the date. With Pipefetch that is 2 credits per account per reading.
A follower count is public, but an account that belongs to a private person is still personal data under laws such as the GDPR. Keep such tracking to organizations, brands and public figures.
Try it with 100 free credits. No card needed. No login, cookies or proxies. Get an API key or read the docs.
Free tools for this
APIs used in this guide
-
2 credits
Instagram Profile API
Exact followers, bio, links, account type and engagement of a public Instagram account, with its latest posts and Reels.
GET /v1/instagram/profile -
1 credit
Instagram Search API
Instagram business and creator accounts named after a keyword, with follower counts, or the hashtags for a word with post counts.
GET /v1/instagram/search
More Instagram guides
- Instagram Basic Display API alternatives: what to use after the shutdown
- Instaloader 401 Unauthorized, 429 and "Login required": what to do
- How to calculate an Instagram engagement rate in Python
- How to get an Instagram follower count in Node.js
- How to get Instagram follower counts in Google Sheets
- How to get Instagram Reel views in Python
Guides for other sources
Every source
YouTube
- How to get a YouTube transcript in Python
- How to get a YouTube transcript in Node.js
- YouTube API quota exceeded: what the error means and how to fix it
- How to find a YouTube channel ID from a handle or URL
- How to download YouTube subtitles as SRT or VTT
- youtube-transcript-api RequestBlocked or IpBlocked: why it happens and how to fix it
- How to get YouTube comments in Python
- How to search YouTube from Python
- How to list a YouTube channel's videos in Python
- How to summarize a YouTube video with an LLM in Python
- How to get YouTube transcripts and video stats in Google Sheets
- How to get YouTube video views and likes in Python
- How to get YouTube transcripts in n8n, Make and Zapier
- LangChain YoutubeLoader fails on a server: why, and a loader that works
- How to get a YouTube channel's subscriber count in Python
- How to give Claude or Cursor access to YouTube (MCP server)
- How to get YouTube comments in Node.js
- How to analyze YouTube comments with an LLM in Python
- How to list a YouTube channel's Shorts in Python
- How to search YouTube from JavaScript
Websites
- Clearbit Logo API alternatives: get a company logo from its domain
- How to extract email addresses from a website in Python
- How to turn a web page into Markdown in Python
- How to detect what a website is built with, in Python
- How to get the contact emails and phone numbers of websites in Google Sheets
- How to build a LangChain tool that reads web pages and searches Google
- How to turn a web page into Markdown in JavaScript for RAG
- How to extract social media links from a website in Python
- How to get a website's favicon in Python
- How to check robots.txt in Python before you fetch a page
TikTok
- How to get a TikTok video's views and likes in Python
- How to get the comments of a TikTok video in Python
- How to get a TikTok follower count in Python
- TikTok Research API: who can get access, and what to do if you cannot
- How to get TikTok video views, likes and shares in Node.js
- How to get TikTok views, likes and follower counts in Google Sheets
- How to get a Facebook Page's posts without app review
- Is there a Facebook Marketplace API?
- Facebook Groups API alternatives after its removal in 2024
- How to get a Facebook Page's follower count and contact details in Python
- How to get Google search results in Python
- pytrends 429 TooManyRequestsError: what it means and what to do
- How to get Google Trends data in Python
- Why is Wyoming first in Google Trends?
- How to get Google search results in Node.js
- How to get Google search results into Google Sheets
- How to give an LLM live Google results with tool calling
Threads
- How to get LinkedIn company data in Python
- How to search LinkedIn jobs from Python
- How to get a LinkedIn company page's latest posts in Python