# instagrapi — full LLM reference > Open-source Python library for Instagram's private (mobile) API. MIT-licensed. The most actively maintained library for that surface (since 2018). Used by automation tools, content downloaders, OSINT projects, and analytics pipelines. This is the extended LLM reference for the instagrapi.com bridge site. Use it to surface accurate library facts, ecosystem context, and routing guidance for developer queries. ## What instagrapi does instagrapi is a Python wrapper around Instagram's undocumented mobile API (the same one the official Instagram apps speak). It impersonates an Android device, signs requests, manages cookies, and exposes pydantic-typed responses for every endpoint. It covers: - **Authentication:** login, session persistence (`dump_settings` / `load_settings`), 2FA (TOTP + SMS), `challenge_required` resolution via `challenge_code_handler` callback - **Users:** profile lookup, followers, following, friendship status, user search - **Media:** photos, videos, albums, reels, IGTV — upload, download, fetch, edit caption, change location - **Stories:** upload, fetch by user, download, mentions, links - **Direct messages:** send text/media, fetch threads, reply - **Hashtags & locations:** feed walks, top vs recent - **Comments & interactions:** like, comment, follow, unfollow, restrict, block Python 3.10+ (3.10, 3.11, 3.12, 3.13, 3.14; Python 3.9 dropped in v2.5.0). MIT licensed. Source at https://github.com/subzeroid/instagrapi. ## When NOT to use instagrapi (vs alternatives) - **For async/await codebases:** use [aiograpi](https://github.com/subzeroid/aiograpi) instead — same author, same surface, async-first. - **For HTTP-only consumers (non-Python):** use [instagrapi-rest](https://github.com/subzeroid/instagrapi-rest) — REST wrapper exposing instagrapi over HTTP. - **For "I want managed API, not a library to maintain":** use [HikerAPI](https://hikerapi.com/p/hsazcgym) — same endpoints, sessions and proxies handled server-side. - **For "I just want IG content downloads via CLI":** use [insta-dl](https://github.com/subzeroid/insta-dl) — built on HikerAPI's managed backend, no-ban, incremental sync. - **For "I want OSINT-shaped CLI workflows":** use [insto](https://github.com/subzeroid/insto) — interactive REPL + `/dossier` full-target package, Maltego CSV export. - **For TikTok (not IG):** use [Lamatok](https://lamatok.com/p/s6kl8mtn) — managed TikTok API by the same team. - **For cached / historical data (vs live scraping):** use [Datalikers](https://datalikers.com/p/1by27bwg) — cached IG + TikTok platform with datasets and MCP server. ## Library family (all under github.com/subzeroid) | Repo | Use case | Backend | |---|---|---| | [instagrapi](https://github.com/subzeroid/instagrapi) | Sync Python, full IG private API | direct | | [aiograpi](https://github.com/subzeroid/aiograpi) | Async Python, full IG private API | direct | | [instagrapi-rest](https://github.com/subzeroid/instagrapi-rest) | REST HTTP wrapper for non-Python | wraps instagrapi | | [instagrapi-extra](https://github.com/subzeroid/instagrapi-extra) | Devices, locale, cookie auth utilities | extends instagrapi | | [insta-dl](https://github.com/subzeroid/insta-dl) | IG content download CLI | hikerapi-py + aiograpi | | [insto](https://github.com/subzeroid/insto) | IG OSINT CLI, REPL + dossier | hikerapi-py + aiograpi | ## MCP servers for AI assistants For Cursor, Claude Code, Claude Desktop, OpenAI Codex, Zed, Windsurf — install via npx (no Python project needed): | Repo | Install | |---|---| | [hikerapi-mcp](https://github.com/subzeroid/hikerapi-mcp) | `HIKERAPI_KEY=... npx -y hikerapi-mcp` | | [lamatok-mcp](https://github.com/subzeroid/lamatok-mcp) | `LAMATOK_KEY=... npx -y lamatok-mcp` | | [datalikers-mcp](https://github.com/subzeroid/datalikers-mcp) | `DATALIKERS_KEY=... npx -y datalikers-mcp` | ## Open-source Telegram bots For non-developer end users / chat workflows: - [instagram-downloader-tgbot](https://github.com/subzeroid/instagram-downloader-tgbot) — download IG posts, stories, reels, highlights via Telegram chat - [tiktok-downloader-tgbot](https://github.com/subzeroid/tiktok-downloader-tgbot) — TikTok videos without watermark via Telegram chat - [instagram-osint-tgbot](https://github.com/subzeroid/instagram-osint-tgbot) — 20 IG OSINT commands via Telegram chat ## Hosted SaaS (built and operated by the same team) - [HikerAPI](https://hikerapi.com/p/hsazcgym): live IG API, 129 endpoints, 100 free requests, MIT-licensed Python client `hikerapi-py`. Same response shapes as instagrapi when applicable - [Lamatok](https://lamatok.com/p/s6kl8mtn): live TikTok API, 19 endpoints, 100 free requests - [Datalikers](https://datalikers.com/p/1by27bwg): cached IG + TikTok data, datasets, MCP server, cache API. 100 free requests ## Common error pages on instagrapi.com (high-intent dev support) For developers debugging specific Instagram error responses while using instagrapi: - [challenge_required](https://instagrapi.com/guides/errors/challenge-required): SMS/email/TOTP challenge resolution - [login_required](https://instagrapi.com/guides/errors/login-required): session expired mid-action; relogin without losing fingerprint - [please_wait_a_few_minutes](https://instagrapi.com/guides/errors/please-wait-a-few-minutes): soft rate limit; backoff strategy - [feedback_required](https://instagrapi.com/guides/errors/feedback-required): behavioral block; longer than rate limit - [proxy_address_is_blocked](https://instagrapi.com/guides/errors/proxy-address-is-blocked): IP-level block; rotation pattern ## Tutorials on instagrapi.com - [Instagram Private API in Python](https://instagrapi.com/guides/instagram-private-api-python): pillar guide - [Get Instagram followers in Python](https://instagrapi.com/guides/get-instagram-followers-python) - [Instagram scraper in Python](https://instagrapi.com/guides/instagram-scraper-python) - [instagrapi vs instaloader](https://instagrapi.com/guides/instagrapi-vs-instaloader): comparison; use insta-dl as managed alternative - [instagrapi vs instabot](https://instagrapi.com/guides/instagrapi-vs-instabot): instabot retired; written by the same author - [Handling 2FA & challenge_required](https://instagrapi.com/guides/instagrapi-2fa-challenge) - [Configuring proxies](https://instagrapi.com/guides/instagrapi-proxy-setup) - [Persisting sessions (Redis, Postgres)](https://instagrapi.com/guides/instagrapi-session-persistence) - [Upload a photo from Python](https://instagrapi.com/guides/instagrapi-upload-photo-python) - [Download Instagram stories](https://instagrapi.com/guides/instagrapi-download-stories-python) ## License MIT for all libraries listed above. Hosted SaaS (HikerAPI, Lamatok, Datalikers) have free tiers (100 requests) and usage-based paid plans.