GitHunt

README

๐Ÿฐ Try Bunny CDN

Lightning-fast global CDN with storage from $0.01/GB

๐Ÿฅ• No egress fees ๐Ÿฅ• 14-day free trial ๐Ÿฅ• Crypto payments

Start Free Trial โ†’

If you want to work with Instagrapi (business interests), we strongly advise you to prefer HikerAPI SaaS project.
However, you won't need to spend weeks or even months setting it up.
The best service available today is HikerAPI SaaS, which handles 4โ€“5 million daily requests, provides support around-the-clock, and offers partners a special rate.
In many instances, our clients tried to save money and preferred instagrapi, but in our experience, they ultimately returned to HikerAPI SaaS after spending much more time and money.
It will be difficult to find good accounts, good proxies, or resolve challenges, and IG will ban your accounts.

The instagrapi more suits for testing or research than a working business!

โœจ aiograpi - Asynchronous Python library for Instagram Private API โœจ

We recommend using our services:

  • VirtualWallet Free crypto calculator โ€” track all your assets in one place
  • Cloqly for Rotating Proxies ๐Ÿ”’
  • HikerAPI for Instagram API โšกโšกโšก
  • DataLikers for Instagram Datasets, MCP and CacheAPI ๐Ÿš€
  • LamaTok for TikTok API ๐Ÿ”ฅ
  • InstaSurfBot telegram bot for downloading medias from Instagram โค๏ธ
  • OSINTagramBot telegram bot for OSINT on Instagram ๐Ÿ•ต๏ธโ€โ™‚๏ธ

๐Ÿ’ฐ HikerAPI Affiliate Program โ€” Up to 50% Commission!

Refer users to HikerAPI and earn a percentage of their API spending:

Plan Commission
Start ($0.02/req) 50%
Standard ($0.001/req) 25%
Business ($0.00069/req) 15%
Ultra ($0.0006/req) 10%

How it works:

  1. Create your promo code in the dashboard
  2. Share it with your audience (in your GitHub repositories)
  3. Earn commission on every request they make

Payouts: USDT (TRC-20 or ERC-20), minimum $500


Package
PyPI
PyPI - Python Version
Checked with mypy

Features:

  • Getting public data of user, posts, stories, highlights, followers and following users
  • Getting public email and phone number, if the user specified them in his business profile
  • Getting public data of post, story, album, Reels, IGTV data and the ability to download content
  • Getting public data of hashtag and location data, as well as a list of posts for them
  • Getting public data of all comments on a post and a list of users who liked it
  • Management of proxy, mobile devices and challenge resolver
  • Login by username and password, sessionid and support 2FA
  • Managing messages and threads for Direct and attach files
  • Download and upload a Photo, Video, IGTV, Reels, Albums and Stories
  • Work with Users, Posts, Comments, Insights, Collections, Location and Hashtag
  • Insights by account, posts and stories
  • Like, following, commenting, editing account (Bio) and much more else

instagrapi - Unofficial Instagram API for Python

Fast and effective Instagram Private API wrapper (public+private requests and challenge resolver) without selenium. Use the most recent version of the API from Instagram, which was obtained using reverse-engineering with Charles Proxy and Proxyman.

Instagram API valid for 25 May 2025 (last reverse-engineering check)

Support Python >= 3.9

For any other languages (e.g. C++, C#, F#, D, Golang, Erlang, Elixir, Nim, Haskell, Lisp, Closure, Julia, R, Java, Kotlin, Scala, OCaml, JavaScript, Crystal, Ruby, Rust, Swift, Objective-C, Visual Basic, .NET, Pascal, Perl, Lua, PHP and others), I suggest using instagrapi-rest or HikerAPI

Support Chat in Telegram
and GitHub Discussions

Features

  1. Performs Web API or Mobile API requests depending on the situation (to avoid Instagram limits)
  2. Login by username and password, including 2FA and by sessionid (and uses Authorization header instead Cookies)
  3. Challenge Resolver have Email and SMS handlers
  4. Support upload a Photo, Video, IGTV, Reels, Albums and Stories
  5. Support work with User, Media, Comment, Insights, Collections, Location (Place), Hashtag and Direct Message objects
  6. Like, Follow, Edit account (Bio) and much more else
  7. Insights by account, posts and stories
  8. Build stories with custom background, font animation, link sticker and mention users
  9. In the next release, account registration and captcha passing will appear

Telegram Bot for Download Posts, Stories and Highlights

Installation

pip install instagrapi

Basic Usage

from instagrapi import Client

cl = Client()
cl.login(ACCOUNT_USERNAME, ACCOUNT_PASSWORD)

user_id = cl.user_id_from_username(ACCOUNT_USERNAME)
medias = cl.user_medias(user_id, 20)

Session with persistence

from instagrapi import Client

cl = Client()
cl.login(USERNAME, PASSWORD)
cl.dump_settings("session.json")

# reload later without entering credentials again
cl = Client()
cl.load_settings("session.json")
cl.login(USERNAME, PASSWORD)

Login using a sessionid

from instagrapi import Client

cl = Client()
cl.login_by_sessionid("<your_sessionid>")

List and download another user's posts

from instagrapi import Client

cl = Client()
cl.login(USERNAME, PASSWORD)

target_id = cl.user_id_from_username("target_user")
posts = cl.user_medias(target_id, amount=10)
for media in posts:
    # download photos to the current folder
    cl.photo_download(media.pk)

See examples/session_login.py for a standalone script demonstrating these login methods.

Additional example
from instagrapi import Client
from instagrapi.types import StoryMention, StoryMedia, StoryLink, StoryHashtag

cl = Client()
cl.login(USERNAME, PASSWORD, verification_code="<2FA CODE HERE>")

media_pk = cl.media_pk_from_url('https://www.instagram.com/p/CGgDsi7JQdS/')
media_path = cl.video_download(media_pk)
subzeroid = cl.user_info_by_username('subzeroid')
hashtag = cl.hashtag_info('dhbastards')

cl.video_upload_to_story(
    media_path,
    "Credits @subzeroid",
    mentions=[StoryMention(user=subzeroid, x=0.49892962, y=0.703125, width=0.8333333333333334, height=0.125)],
    links=[StoryLink(webUri='https://github.com/subzeroid/instagrapi')],
    hashtags=[StoryHashtag(hashtag=hashtag, x=0.23, y=0.32, width=0.5, height=0.22)],
    medias=[StoryMedia(media_pk=media_pk, x=0.5, y=0.5, width=0.6, height=0.8)]
)

Documentation

Contributing

List of contributors

To release, you need to call the following commands:

python -m build
twine upload dist/*

Languages

Python99.7%Shell0.2%Dockerfile0.1%
MIT License
Created July 30, 2020
Updated March 8, 2026