How to get an Instagram follower count in Node.js
Checked on 2026-11-24.
From Node.js there are three ways to read an Instagram follower count. Meta's official API answers a plain fetch call, but only for business and creator accounts and only after you set up an app and a token. The npm package instagram-private-api logs in as an Instagram account of yours. An HTTP API reads the public profile of any username with one key.
1. Meta's official API, with fetch
The official route is the Instagram Platform. It is a plain HTTPS API, so fetch, built into Node.js 18 and newer, is all the code needs. Its overview states the condition up front: "To use the APIs, your app users must have an Instagram professional account." For somebody else's numbers there is Business Discovery, which its reference describes as a way "to get data about other Instagram Business or Creator IG Users". You send the request to your own account's ID and name the other account inside the fields parameter. This is the request from Meta's guide, in JavaScript:
const ME = process.env.IG_ACCOUNT_ID; // the ID of your own professional account
const url = new URL(`https://graph.facebook.com/v27.0/${ME}`);
url.searchParams.set('fields', 'business_discovery.username(bluebottle){followers_count,media_count}');
url.searchParams.set('access_token', process.env.IG_ACCESS_TOKEN);
const body = await (await fetch(url)).json();
if (body.error) {
console.log(body.error.message);
} else {
const { followers_count, media_count } = body.business_discovery;
console.log(followers_count, media_count);
}bluebottle is the account Meta's own example reads. Before the first call you need an Instagram professional account of your own, a Meta app and an access token. The reference asks for a Facebook User access token with the permissions instagram_basic, instagram_manage_insights and pages_read_engagement, and the guide says the API "is available with both the Instagram API with Facebook Login and the Instagram API with Unified Login", the setup the overview recommends for new integrations. If the app serves only your own account, "Standard Access is all your app needs". An app that other people connect their accounts to needs Advanced Access, which "requires App Review and Business Verification". Long-lived tokens are "valid for 60 days and can be refreshed before they expire".
Where it stops: at personal accounts, because the Platform is for professional accounts and Business Discovery reads business and creator accounts only, and at age-gated ones: "Data about age-gated Instagram professional accounts will not be returned." A username does not tell you which kind of account it belongs to, so a list of usernames will have gaps. And it is a lot of setup for one number: an app, a professional account and a token to keep fresh.
2. npm packages that read Instagram directly
On npm, instagram-private-api calls itself an "Instagram private API wrapper for full access to instagram". It works as a logged-in user: the example in its README logs in with an Instagram username and password (ig.account.login(...)) before it reads anything, and its user.usernameinfo() method then returns a user with follower_count.
Where it stops: at the login. It needs an Instagram account of yours, and every request is made as that account. Use one you can afford to lose, never one that is not yours, and read Instagram's Terms of Use before you automate an account. The package is not new either: the latest version on npm is 1.46.1, published on 7 March 2024, and its README says the next major version "is hosted in a private repository and access is paid". Older tutorials use instagram-web-api, whose latest version, 2.2.2, came out on 6 August 2020.
If you work in Python, the Python version of this guide covers the Instaloader library, and the guide to its 401, 429 and login errors covers what happens when Instagram refuses.
3. An HTTP API, with fetch or the npm client
With Pipefetch the profile is one HTTPS request with one key. It reads the public profile, so there is no Instagram account, no Meta app and no token, and it makes no difference whether the account is personal, business or creator. A plain fetch call:
const url = new URL('https://pipefetch.com/v1/instagram/profile');
url.searchParams.set('username', 'nasa'); // a username, an @handle or a profile URL
url.searchParams.set('posts', 'false'); // leave the latest posts out; same price
const res = await fetch(url, {
headers: { 'x-api-key': process.env.PIPEFETCH_API_KEY },
signal: AbortSignal.timeout(90_000),
});
if (res.status === 404) {
console.log('No such account'); // not charged
} else if (!res.ok) {
throw new Error(`Pipefetch answered ${res.status}`); // a 502 is not charged and can be sent again
} else {
const { data } = await res.json();
console.log(data.username, data.followerCount, data.followingCount, data.postCount);
}Or with the client from npm, pipefetch, which has no dependencies, includes TypeScript types and retries a 502 by itself:
// npm install pipefetch
import Pipefetch, { NotFoundError } from 'pipefetch';
const pf = new Pipefetch(); // reads PIPEFETCH_API_KEY
try {
const profile = await pf.instagramProfile('nasa', { posts: false });
console.log(profile.followerCount, profile.isPrivate, profile.accountType);
console.log(pf.credits); // what the request cost and what is left
} catch (error) {
if (error instanceof NotFoundError) console.log('No such account'); // not charged
else throw error;
}followerCount, followingCount and postCount are the exact numbers, not the rounded ones Instagram displays (104M). A private account returns its counts, name and bio with isPrivate true. One profile costs 2 credits, an account that does not exist answers 404 and costs nothing, and a new account has 100 free credits and needs no card. The reference lists every field, including the latest posts you get when you leave posts on.
Where it stops: this is not an official API, and Pipefetch is not affiliated with Instagram or Meta. It returns what a profile shows to a visitor who is not logged in: no follower lists, no stories, no posts of private accounts. Every request is read live, so it takes a few seconds (most take 2 to 9 seconds), and when Instagram does not answer you get a 502 that is not charged.
Which one should you use?
| Situation | Use |
|---|---|
| Your own account, or business and creator accounts, and you want Meta's own numbers | The official API with fetch |
| You need what only a logged-in user sees, with your own account and at your own risk | instagram-private-api |
| Any public username, whatever the account type, from a server or a scheduled job | An HTTP API such as Pipefetch |
Keep tokens and keys on the server
Whichever route you take, the call belongs in server code: a Node.js process, an API route or a serverless function. An Instagram access token or a Pipefetch key that ships to the browser can be read by anyone who opens the page. Read the count on the server and send only the number to the page.
If you only know what a business is called, the search endpoint finds business and creator accounts by the words in their name, with their follower counts, for 1 credit. It asks the advertiser search of Meta's Ad Library, so it is not the search of the Instagram app, and a personal account with no Facebook Page behind it is not found.
Try it with 100 free credits. No card needed. No login, cookies or proxies. Get an API key or read the docs.
APIs used in this guide
-
2 credits
Instagram Profile API
Exact followers, bio, links, account type and engagement of a public Instagram account, with its latest posts and Reels.
GET /v1/instagram/profile -
1 credit
Instagram Search API
Instagram business and creator accounts named after a keyword, with follower counts, or the hashtags for a word with post counts.
GET /v1/instagram/search
More Instagram guides
- How to get an Instagram follower count in Python
- Instagram Basic Display API alternatives: what to use after the shutdown
- Instaloader 401 Unauthorized, 429 and "Login required": what to do
- How to calculate an Instagram engagement rate in Python
- How to get Instagram follower counts in Google Sheets
- How to get Instagram Reel views in Python
Guides for other sources
Every source
YouTube
- How to get a YouTube transcript in Python
- How to get a YouTube transcript in Node.js
- YouTube API quota exceeded: what the error means and how to fix it
- How to find a YouTube channel ID from a handle or URL
- How to download YouTube subtitles as SRT or VTT
- youtube-transcript-api RequestBlocked or IpBlocked: why it happens and how to fix it
- How to get YouTube comments in Python
- How to search YouTube from Python
- How to list a YouTube channel's videos in Python
- How to summarize a YouTube video with an LLM in Python
- How to get YouTube transcripts and video stats in Google Sheets
- How to get YouTube video views and likes in Python
- How to get YouTube transcripts in n8n, Make and Zapier
- LangChain YoutubeLoader fails on a server: why, and a loader that works
- How to get a YouTube channel's subscriber count in Python
- How to give Claude or Cursor access to YouTube (MCP server)
- How to get YouTube comments in Node.js
- How to analyze YouTube comments with an LLM in Python
- How to list a YouTube channel's Shorts in Python
- How to search YouTube from JavaScript
Websites
- Clearbit Logo API alternatives: get a company logo from its domain
- How to extract email addresses from a website in Python
- How to turn a web page into Markdown in Python
- How to detect what a website is built with, in Python
- How to get the contact emails and phone numbers of websites in Google Sheets
- How to build a LangChain tool that reads web pages and searches Google
- How to turn a web page into Markdown in JavaScript for RAG
- How to extract social media links from a website in Python
- How to get a website's favicon in Python
- How to check robots.txt in Python before you fetch a page
TikTok
- How to get a TikTok video's views and likes in Python
- How to get the comments of a TikTok video in Python
- How to get a TikTok follower count in Python
- TikTok Research API: who can get access, and what to do if you cannot
- How to get TikTok video views, likes and shares in Node.js
- How to get TikTok views, likes and follower counts in Google Sheets
- How to get a Facebook Page's posts without app review
- Is there a Facebook Marketplace API?
- Facebook Groups API alternatives after its removal in 2024
- How to get a Facebook Page's follower count and contact details in Python
- How to get Google search results in Python
- pytrends 429 TooManyRequestsError: what it means and what to do
- How to get Google Trends data in Python
- Why is Wyoming first in Google Trends?
- How to get Google search results in Node.js
- How to get Google search results into Google Sheets
- How to give an LLM live Google results with tool calling
Threads
- How to get LinkedIn company data in Python
- How to search LinkedIn jobs from Python
- How to get a LinkedIn company page's latest posts in Python