Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

instagram-private-api

> 开发工具
Open source

NodeJS Instagram private API SDK. Written in TypeScript.

6.5K stars0 likes2 views
WebsiteGitHub

About

NodeJS Instagram private API SDK. Written in TypeScript.

NodeJS Instagram private API client


Next Major Version

Nerix and I are excited to announce the next 3.x.x version of this library. It features an extended list of capabilities and is a significant release. We have substantially expanded the functionality and possibilities. The library has transformed into a monorepository and is now a set of libraries connected in an ecosystem. It consists of:

  • Android API
  • Web API
  • FBNS, Realtime

We've made some design decisions and simplified the state management process. Now, you can easily create a snapshot of the account state, save it in persistent storage, and restore a 1-to-1 copy with just one function call. With new realtime features, you can listen for new direct messages, notifications, and other events.

You can take a look at the type documentation for the next version by following this link – https://docs.igpapi.com

The new version is hosted in a private repository and access is paid. Members receive exhaustive support for the entire integration process.

Contact me in telegram or email for details.

Table of Contents

  • Install
  • Support us
  • Examples
  • Basic Concepts
    • Feeds
    • Repositories
    • Services
  • Contribution
  • Useful Links
    • Special Thanks
    • Thanks to Contributors
    • End User License Agreement (EULA)

Install

From npm

bash
npm install instagram-private-api

From github

bash
npm install github:dilame/instagram-private-api

This package uses url-regex-safe (GitHub) to check for links when sending direct messages. By default, the safe regex engine re2 is not installed. ⚠ It's highly recommended for you to install re2 by running npm install re2, else you will be vulnerable to CVE-2020-7661.

Support us

If you find this library useful for you, you can support it by donating any amount

BTC: 1Dqnz9QuswAvD3t7Jsw7LhwprR6HAWprW6

Examples

You can find usage examples here.

Note for JavaScript users: As of Node v.13.5.0, there isn't support for ESModules and the 'import'-syntax. So you have to read the imports in the examples like this:

import { A } from 'b' ➡ const { A } = require('b')

…

Basic concepts

You can find documentation in the docs folder. Consider starting in IgApiClient (index module), the root class.

You'll often see ig in the docs. This just refers to the client, an instance of IgApiClient holding the state for one user.

typescript
import { IgApiClient } from 'instagram-private-api';

// This is the general convention on how to name the client
//    vv
const ig = new IgApiClient();

// login, load a session etc.

Repositories

Repositories implement low-level operations - every method sends exactly one api-request.

  • See the list of available repositories here.
  • See the list of their keys in IgApiClient here.

You access repositories on the client (IgApiClient) by their lower-case (camelCase) name without the Repository suffix. For example, you access the instance of AddressBookRepository by ig.addressBook.

Feeds

Feeds represent paginated endpoints like a user's feed (UserFeed). Think of feeds like (async-)iterators/streams/observables (in fact feeds are async iterable and observable (feed.item$)). Every feed is accessible via ig.feed.feedName() (camelCase name). ig.feed is the FeedFactory that creates feeds for you connected to the instance of ig.

  • See the list of available feeds here.
  • See the list of their keys in FeedFactory (ig.feed) here.
  • See this example and learn how to work with library feeds.

Most of the feeds require initialization parameter(s), like a user-pk (id).

Services

Services will help you to maintain some actions without calling a couple repository methods or perform complex things like pre and postlogin flow simulations or photo/video publishing.

  • See the list of available repositories here.
  • See the list of their keys in IgApiClient here.

Debugging

In order to get debug infos provided by the library, you can enable debugging. The prefix for this library is ig. To get all debug logs (recommended) set the namespace to ig:*.

Node

In Node you only have to set the environment variable DEBUG to the desired namespace. Further information

Contribution

If you need features that is not implemented - feel free to implement and create PRs!

Plus we need some documentation, so if you are good in it - you are welcome.

Setting up your environment is described here.

Useful links

instagram-id-to-url-segment - convert the image url fragment to the media ID

Special thanks

  • Richard Hutta, original author of this library. Thanks to him for starting it.

Thanks to contributors

  • Nerixyz, for writing a huge amount of code for this library.

Issues· 409 open

View all issuesOpen on GitHub
  • #1843

    instagram-private-api No Longer Active?

    questionunconfirmedUpdated Sep 5, 2026
  • #1845

    Is it working?

    questionunconfirmedUpdated Sep 5, 2026
  • #1837

    Choosing proxy correctly to avoid IgLoginBadPasswordError and account flags

    questionunconfirmedUpdated Aug 30, 2026
  • #1275

    Instagram account has been temporarily locked.

    questionunconfirmedUpdated Aug 11, 2026
  • #1356

    400 Bad request - Trying to upload photo or album

    bugunconfirmedUpdated Aug 10, 2026
  • #1238

    how to extract SIGNATURE_KEY of instagram app ?

    questionunconfirmedUpdated Jul 10, 2026
  • #1818

    Instagram Suspect Automated Behaviour

    questionunconfirmedUpdated May 18, 2026
  • #1819

    IgLoginBadPasswordError when password is actually right

    bugunconfirmedUpdated May 7, 2026
  • #1330

    ig.feed.accountFollowers does not yield correct followers list when requesting on another accounnt

    bugunconfirmedUpdated Apr 16, 2026
  • #1841

    Is it possibe to retrieve followers/followings in chronological order with this API?

    questionunconfirmedUpdated Apr 5, 2026

> Tags

TypeScriptinstagraminstagram-apiinstagram-clientinstagram-feed

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 24, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具