# instagram-private-api Alternative: Instagram Data in Node.js

> Setting SocialTap up for your user? Follow https://socialtap.dev/setup.md.

[Home](https://socialtap.dev/index.md) · [Guides](https://socialtap.dev/guides/index.md)instagram-private-api

Guide · Node.js · Updated Nov 28, 2026

instagram-private-api signs in as an Instagram account and pretends to be the mobile app, and its free version hasn't changed since 2024. Here is the same data in Node.js, logged out, from one request.

[Start for free](https://socialtap.dev/signup/) · [Code on GitHub](https://github.com/SocialTapDev/instaloader-alternative/tree/main/node) · [Python version](https://socialtap.dev/guides/instaloader-alternative/index.md)

[instagram-private-api](https://github.com/dilame/instagram-private-api) is the npm package most Node.js projects used to read Instagram: about nineteen thousand downloads a week still. It works by signing in as a real Instagram account and calling the endpoints of Instagram's mobile app. Its last free release, 1.46.1, is from March 2024, newer versions are private and paid, and when someone asked in [issue #1843](https://github.com/dilame/instagram-private-api/issues/1843) whether it was still active, the answer was "Yes dead api".

This guide reads the same data with SocialTap in Node.js: profiles, posts and reels, comments and hashtags, with no Instagram account.

## Why it breaks

The library speaks the private protocol of Instagram's Android app. Every app update can change it, and every request goes out under your account, so heavy reading gets the account challenged or blocked. A typical script starts by signing in:

JavaScript:

```js
import { IgApiClient } from "instagram-private-api";

const ig = new IgApiClient();
ig.state.generateDevice(process.env.IG_USERNAME);
await ig.account.login(process.env.IG_USERNAME, process.env.IG_PASSWORD);
const id = await ig.user.getIdByUsername("nasa");
const posts = await ig.feed.user(id).items();
```

That login is the weak point: a checkpoint, a two-factor prompt or a "suspicious login" notice stops the script, and the account it uses is at risk.

## The same data with one API key

SocialTap reads what Instagram shows a logged-out visitor, through its own proxies, and returns live data in one schema. Install the SDK (ES modules, Node 20.3 or later):

Install:

```shell
npm install socialtap
```

Get a key on the [signup page](https://socialtap.dev/signup/) and set it as `SOCIALTAP_API_KEY`. Every account starts with 100 free credits. This reads one profile:

TypeScript SDK:

```typescript
// Save this as app.mjs (an ES module) and run: node app.mjs
import { SocialTap } from "socialtap";

const client = new SocialTap(); // apiKey defaults to process.env.SOCIALTAP_API_KEY

const res = await client.instagram.profile.get({ handle: "https://www.instagram.com/natgeo/" });
console.log(res.data);
console.log(res.credits.charged, res.meta.request_id);
```

`ig.user.getIdByUsername` and the user info call become one request. The answer has the follower, following and post counts, the bio, links, verification and profile picture.

## Walk an account's posts

`ig.feed.user(id).items()` becomes `client.instagram.posts.iterate()`, an async iterator that fetches page after page, 12 posts a page, until the list ends or a guard stops it:

TypeScript SDK:

```typescript
// Save this as app.mjs (an ES module) and run: node app.mjs
import { SocialTap, APIError, NotFoundError, PrivateOrUnavailableError } from "socialtap";

const client = new SocialTap(); // apiKey defaults to process.env.SOCIALTAP_API_KEY

try {
  // Stops at the end of the list, or at the first guard it reaches.
  const items = client.instagram.posts.iterate({ handle: "nasa" }, { maxPages: 10, maxCredits: 100 });
  for await (const item of items) {
    console.log(item);
  }
  console.log(items.pagesFetched, items.creditsCharged, items.stopReason, items.endReason);
} catch (err) {
  if (err instanceof NotFoundError) {
    // The item does not exist or was deleted.
    console.error(err.code, err.remediation);
  } else if (err instanceof PrivateOrUnavailableError) {
    // The item exists but isn't public: it is private, age- or region-restricted, or needs a login.
    console.error(err.code, err.remediation);
  } else if (err instanceof APIError) {
    // Retryable errors reach you only after the SDK's own retries. Failed requests cost no credits.
    console.error(err.code, err.status, err.retryable, err.remediation, err.requestId);
  } else throw err;
}
```

Each post has its caption, hashtags, mentions, publish time, media and its like, comment and view counts, in the same fields as a TikTok or YouTube post.

## From instagram-private-api to SocialTap

| instagram-private-api | SocialTap | Endpoint |
| --- | --- | --- |
| `ig.user.searchExact(name)` | `client.instagram.profile.get()` | [Instagram Profile API](https://socialtap.dev/apis/instagram/profile/index.md) |
| `ig.feed.user(id).items()` | `client.instagram.posts.iterate()` | [Instagram Posts API](https://socialtap.dev/apis/instagram/posts/index.md) |
| `ig.media.info(id)` | `client.instagram.post.get()` | [Instagram Post API](https://socialtap.dev/apis/instagram/post/index.md) |
| `ig.feed.mediaComments(id).items()` | `client.instagram.comments.iterate()` | [Instagram Comments API](https://socialtap.dev/apis/instagram/comments/index.md) |
| `ig.feed.tags(tag).items()` | `client.instagram.hashtagPosts.iterate()` | [Instagram Hashtag Posts API](https://socialtap.dev/apis/instagram/hashtag-posts/index.md) |

The SDK has no runtime dependencies (it uses `fetch`), and it runs in Node, Deno, Bun and Cloudflare Workers.

## What it costs

You pay per successful request, and a list request returns a page:

- Posts of an account: $0.06–$0.17 per 1,000 posts.
- Comments: $0.03–$0.08 per 1,000 comments.
- Profiles: $0.75–$1.97 per 1,000 profiles.

Failed requests and cache hits cost nothing. See [plans and packs](https://socialtap.dev/pricing/index.md).

## Frequently asked questions

### Is instagram-private-api still maintained?

Not the free version. Its last npm release, 1.46.1, is from March 2024, and later versions are sold privately. Instagram has changed its app many times since.

### Do I need an Instagram account?

No. SocialTap reads Instagram logged out. You send a username or a link with your SocialTap API key, and no Instagram account is involved, so none can be banned.

### Can I read private accounts?

No. A private account returns its public profile, with `is_private` true, but its posts aren't public. A scraper that signs in can read only the private accounts its own account follows.

### Does it work from a server or a serverless function?

Yes. It's an HTTPS request with your key, so it runs from any server, a Lambda or a Cloudflare Worker. The Instagram rate limits that hit cloud IPs are ours to handle.

## The endpoints in this guide

Each one is a single request with the same API key.

- [Instagram Profile APIExact follower counts, bio and bio links.$0.75–$1.97 per 1,000 profiles](https://socialtap.dev/apis/instagram/profile/index.md)

- [Instagram Posts APIPosts, reels and carousels from a profile.$0.06–$0.17 per 1,000 posts](https://socialtap.dev/apis/instagram/posts/index.md)

- [Instagram Post APIPost, reel or carousel with media, likes and views.$0.75–$1.97 per 1,000 posts](https://socialtap.dev/apis/instagram/post/index.md)

- [Instagram Comments APIOn a post or reel, newest first, with likes.$0.03–$0.08 per 1,000 comments](https://socialtap.dev/apis/instagram/comments/index.md)

- [Instagram Hashtag Posts APITop reels that carry a hashtag.$0.03–$0.08 per 1,000 posts](https://socialtap.dev/apis/instagram/hashtag-posts/index.md)

## Replace instagram-private-api with one API key.

Get a key, run the code above and see live data in a minute. Failed requests are free.

100free credits

- No credit card
- Failed requests are free
- Works on all 310 endpoints

[Start for free](https://socialtap.dev/signup/) [Read the docs](https://socialtap.dev/docs/index.md)

---

[HTML version](https://socialtap.dev/guides/instagram-private-api-alternative/) · [Docs index for AI agents](https://socialtap.dev/llms.txt) · [All docs in one file](https://socialtap.dev/llms-full.txt)
