instagrapi
Fast and effective Instagram Private API wrapper
What it is and what it does
instagrapi is an unofficial Python wrapper around Instagram's private mobile API and public web endpoints. It handles authentication, session persistence, challenge flows, and rate-limit recovery to support automation tasks like downloading user posts, searching locations, sending direct messages, uploading stories and reels, and reading insights. The library combines both API flows to maximize coverage of Instagram's features.
The package is designed for testing, research, and controlled internal automation rather than production account management. It depends on requests for HTTP, PySocks for proxy support, pydantic for data validation, Pillow for image handling, and pycryptodomex for cryptographic operations. Optional extras add TLS fingerprint impersonation (curl) and video composition (MoviePy 2.2.1 + ffmpeg). The maintainers explicitly recommend official Instagram APIs for business workflows and hosted providers like HikerAPI for production private API infrastructure.
Use it for:
- Download another user's posts and media in bulk for archival or analysis.
- Automate direct message sending and reading for internal team workflows or testing.
- Search and retrieve location metadata and posts by geographic area.
- Upload stories, reels, and feed posts programmatically for content scheduling.
- Monitor account insights and engagement metrics via the private API.
- Receive real-time direct message notifications over MQTT for reactive automation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Unofficial Instagram API wrapper that automates private mobile and public web flows for users, media, stories, direct messages, and uploads with session persistence and challenge handling.
Yes, if your use case is internal testing, research, or controlled automation on accounts you own or manage. No, if you need production-grade stability or are building customer-facing features—use official Instagram APIs instead. The library is actively maintained and has no known vulnerabilities, but private API automation is inherently fragile because Instagram's account trust, device state, and rate limits change independently of the library. For production infrastructure, consider a hosted provider.
Install
instagrapi on PyPI
pip
pip install instagrapiuv
uv add instagrapipoetry
poetry add instagrapiInstalling instagrapi
Before you install
Low friction install with five runtime dependencies (requests, PySocks, pydantic, Pillow, pycryptodomex). Active maintenance with release 2 days ago. Requires Python 3.10+; Python 3.9 support was dropped in version 2.5.0 due to upstream security patch constraints.
License in practice
MIT license permits commercial and private use with minimal restrictions—suitable for internal automation and testing workflows.
Quickstart
pip install instagrapi
from instagrapi import Client
cl = Client()
cl.login(USERNAME, PASSWORD)
user_id = cl.user_id_from_username(USERNAME)
medias = cl.user_medias(user_id, 20)
Requires Python 3.10 or later. Private API automation is fragile in production—account trust, proxies, device state, challenges, and rate limits can change independently of the library.
Verify before relying
- Whether optional video dependencies (MoviePy 2.2.1, ffmpeg) are required for your specific use case or only for video/story uploads.
- Whether curl-backed TLS impersonation (instagrapi[curl] extra) is necessary for your target endpoints or if standard requests suffices.
- Stability and rate-limit behavior of the private mobile API flows in your deployment environment.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — requests, PySocks, pydantic, Pillow, pycryptodomex |
| Maintenance | actively maintained — 2 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,033,035/month — #3,350 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: instagrapi-2.18.14-py3-none-any.whl
Keywords: instagram private api, instagram-private-api, instagram api, instagram-api, instagram, instagram-scraper, instagram-client, instagram-stories, instagram-feed, instagram-reels, instagram-insights, downloader, uploader, videos, photos, albums, igtv, reels, stories, pictures, instagram-user-photos, instagram-photos, instagram-metadata, instagram-downloader, instagram-uploader, instagram-note
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
instaloaderDownloads public and private Instagram…
permissive · top 15,000 on PyPI
zernio-sdkUnified Python client for publishing social…
permissive · top 15,000 on PyPI
TikTokApiUnofficial Python wrapper for retrieving public…
permissive · top 15,000 on PyPI
late-sdkOfficial Python SDK for publishing social media…
permissive · top 15,000 on PyPI
socid-extractorParses HTML and API responses from 130+ social…
permissive · top 15,000 on PyPI
KurigramKurigram is an asynchronous Python framework…
copyleft · top 15,000 on PyPI
snscrapeScrapes user profiles, posts, hashtags, and…
copyleft · top 15,000 on PyPI
ytmusicapiytmusicapi lets you programmatically interact…
permissive · top 15,000 on PyPI
shotgun-api3Official Python API client for Autodesk Flow…
unclear · top 15,000 on PyPI
pushbullet.pyA Python client library for the Pushbullet API…
permissive · top 15,000 on PyPI