Type “Instagram API” into GitHub and the most starred results are unofficial. They wrap the private API, the one the Instagram app uses on your phone. This guide explains what that means in practice, using the libraries' own READMEs and Meta's documentation as read in November 2026.
What the Instagram private API is
The Instagram app on Android and iOS talks to Instagram's servers through an internal API. Meta does not document it, give keys for it or support anyone who calls it from outside the app. Unofficial libraries imitate the app so a script can send the same requests: the ping/instagram_private_api README describes an app client that emulates the official app.
Developers use it because the official Instagram Platform only serves professional accounts (business or creator) and never returns the list of people who follow an account. The Instagram API guide details what the official API covers.
The main unofficial libraries
| Library | Language | What its README says |
|---|---|---|
| instagrapi | Python 3.11+ | Unofficial wrapper combining public web and private mobile API flows, with challenge handling |
| instagram-private-api | Node.js, TypeScript | Private API SDK that mimics the Android app; the next major version sits in a paid private repository |
| instagram_private_api | Python | Written when Instagram clamped down on developer access; tested on Python 2.7 and 3.5 |
All three are open source under the MIT license. None is affiliated with Instagram or Meta. The oldest one states it plainly: independent, unofficial, not for spam, use at your own risk.
What a call looks like
from instagrapi import Client
cl = Client()
cl.login("YOUR_INSTAGRAM_USERNAME", "YOUR_PASSWORD") # your own account
user_id = cl.user_id_from_username("yourcompetitor")
followers = cl.user_followers(user_id, amount=200)The first line that matters is the login. Every request after it runs as your Instagram account, from your IP address.
The risks, in the maintainers' own words
- Fragile in production. The instagrapi README: private API automation is fragile in production because account trust, proxies, device state, challenges and rate limits can change independently of the library.
- Your account is on the line. The instagram_private_api README: excessive logins is a surefire way to get your account flagged for removal.
- Challenges and blocks. instagrapi documents the errors you will meet: challenge_required, feedback_required, please_wait_a_few_minutes, proxy_address_is_blocked and 429 rate limits.
- Changes without notice. The same README warns that Instagram can change or restrict the public web paths independently of the library. A script that ran last month can stop on any app update.
- Made for testing. instagrapi says it is best suited for testing, research and controlled internal automation, and advises the official APIs for account-owned business workflows.
In practice you end up running several accounts, buying proxies and writing retry logic for challenges. That is a second product to maintain next to the one you wanted to build.
Safer options, by use case
| You need | Use | Instagram login |
|---|---|---|
| To publish, moderate comments or read insights for your own accounts | The official Instagram API | Your professional account, through OAuth |
| Posts and metadata of a few profiles for a personal archive | Instaloader | Optional for public posts |
| Followers, hashtag or post audiences with their public contact details | A data API | None |
The official API
It covers publishing, comments, messages and insights for business and creator accounts that connect to your app. Getting started means an app and a token, covered in the Instagram access token guide.
Instaloader
A Python tool to download posts and metadata. It also needs a login for followers lists and stories, so it shares some of the same risks. Its limits are in the Instaloader guide.
A data API
A data API returns the accounts behind a competitor, a hashtag or a post as rows, with the email or phone they show publicly. You send an API key and no Instagram account is involved on your side.
import requests
job = requests.post(
"https://api.igleads.ai/v1/leads/competitors",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"usernames": ["yourcompetitor"], "limit": 200},
).json()
# then GET /v1/leads/jobs/{id} until it is done, then /v1/leads/jobs/{id}/resultsThe API comes with the Business ($199 a month) and Scale ($399 a month) plans. Endpoints are on the developer page. The Python guide compares the official API, a data API and Instaloader with working code.
Frequently asked questions
What is the Instagram private API?
It is the internal API the Instagram mobile app talks to. Meta does not document it or offer it to developers. Unofficial libraries such as instagrapi in Python or instagram-private-api in Node.js imitate the app to call it.
Is the Instagram private API safe to use?
Its own maintainers warn that it is fragile. The instagrapi README says private API automation is fragile in production and that the library is best suited for testing, research and controlled internal automation. The calls run on a logged-in Instagram account: that account takes the risk of challenges and limits.
Can my account get banned for using an unofficial Instagram API?
The libraries document the warnings you get first: challenge_required, feedback_required and 429 rate limit errors. The README of instagram_private_api states that excessive logins is a surefire way to get an account flagged for removal.
What should I use instead of the Instagram private API?
For accounts you own or manage, the official Instagram API, which serves business and creator accounts. For public data on accounts you do not manage, such as followers or the emails they show, a data API that takes an API key and needs no Instagram login.