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.

Python
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:

Python
# 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.

Python
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.

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.

Python
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?

SituationUse
Your own account, or business and creator accounts, and you want Meta's own numbersThe official API
A few public accounts, from a script on your own computerInstaloader
Any public username, whatever the account type, from a server or a scheduled jobAn HTTP API such as Pipefetch
You have a business name and no usernameThe 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

Every source

YouTube

Websites

TikTok

Facebook

Google

Threads

LinkedIn

App stores

Steam

X

Pinterest

Airbnb

Real estate

Keywords

Job boards

Eventbrite

Shopify stores

Public tenders

All guides