Scan your whole stack
Are you using insta-node-js?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.0.0
insta-node-js was last scanned on 23 Nov 2026 at version 2.0.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 2.0.0 LATEST | 23 Nov 2026 | No rules fired |
| 1.0.2 | 23 Nov 2026 | No rules fired |
| 1.0.1 | 23 Nov 2026 | No rules fired |
| 1.0.0 | 23 Nov 2026 | Not shown |
| 0.0.0-stage | 23 Nov 2026 | Not shown |
Findings for v2.0.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 2.0.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
💬 Support & community
This is the Telegram channel where I offer support for clients — come join it. There is also another client by the same author, whalibmob — a WhatsApp client for SMS registration and more. Right now I offer support for insta-node-js and whalibmob.
Library for the Instagram API with MQTT support and much more — featured 2026.
A standalone Node.js library for the Instagram mobile API, written in TypeScript. It is fully self-contained: its own HTTP layer, request signing and realtime MQTT stack, with no dependency on any other Instagram client library.
StoryBuilder). They are installed automatically through the optional packages ffmpeg-static and ffprobe-static. A system binary also works (found on PATH, or set FFMPEG_PATH / FFPROBE_PATH).From npm:
npm install insta-node-js
The npm package name is lowercase (insta-node-js), as npm requires; the GitHub repository is Kunboruto20/Insta-node-js.
| Package | Purpose |
|---|---|
undici |
HTTP client (HTTP/1.1 and HTTP/2, keep-alive, HTTP/HTTPS proxies) |
socks |
SOCKS4 / SOCKS5 proxies (HTTP requests and realtime / FBNS MQTT connections) |
sharp |
Image processing (resize, crop, JPEG conversion, thumbnails) |
@hapi/boom |
Errors with HTTP status codes |
ffmpeg-static (optional) |
ffmpeg binary for video processing |
ffprobe-static (optional) |
ffprobe binary for video metadata |
sharp is loaded only when an image has to be processed. On platforms without a prebuilt sharp binary (for example Android / Termux) the library works normally, and only image processing (photo uploads, thumbnails, StoryBuilder) throws a Boom 424 error.
On Android / Termux, install the WebAssembly build of sharp to enable image processing:
npm install @img/sharp-wasm32
Video processing on Termux uses the system ffmpeg:
pkg install ffmpeg
With the WebAssembly build, StoryBuilder works without a caption; captions need a native sharp binary.
import { Client } from 'insta-node-js';
async function main() {
const cl = new Client();
await cl.login('USERNAME', 'PASSWORD');
const user = await cl.userInfoByUsername('instagram');
console.log(user.pk, user.full_name, user.follower_count);
const medias = await cl.userMedias(user.pk, 10);
for (const media of medias) {
console.log(media.code, media.like_count, media.caption_text);
}
}
main().catch(console.error);
CommonJS:
const { Client } = require('insta-node-js');
Promise.user.full_name, media.like_count, media.taken_at.user.pk, media.pk, media.id), because they can exceed Number.MAX_SAFE_INTEGER. Methods accept strings or numbers.media.pk is the numeric media id (3141592653589793238). media.id is "<media_pk>_<owner_pk>". Most media methods accept either.photoUpload(path, caption, { usertags, location })).The library is written in TypeScript and ships full type definitions. This README covers the common tasks with examples, but the client has hundreds of methods; they are all nicely typed, so the full set of methods and their options shows up in your editor's autocomplete (IntelliSense in VS Code and similar). If you need a method that is not in this README, start typing client. and your editor will list what is available, with typed parameters and return values.
import { Client } from 'insta-node-js';
const cl = new Client({
proxy: 'http://user:pass@1.2.3.4:8080', // HTTP, HTTPS, SOCKS4 or SOCKS5 proxy
delayRange: [1, 3], // random pause (seconds) before each private request
requestTimeout: 1, // pause (seconds) between retried requests
timezoneOffset: 7200, // seconds from UTC
timezoneName: 'Europe/Bucharest',
pushDisabled: false,
tlsVerify: true, // or a path to a CA bundle
privateTransport: 'http2', // 'http1' | 'http2' | 'mobile'
publicTransport: 'http1', // 'http1' | 'http2'
sessionRetryTotal: 3,
sessionRetryBackoffFactor: 2,
sessionRetryStatuses: [500, 502, 503, 504],
});
All options are optional. settings accepts an object previously returned by getSettings(); logger accepts a custom logger (see Logging).
const cl = new Client();
await cl.login('USERNAME', 'PASSWORD');
console.log(cl.userId, cl.username);
Logging in every time is slow and looks suspicious to Instagram. Save the session once and reuse it:
import { existsSync } from 'fs';
import { Client, LoginRequired } from 'insta-node-js';
const SESSION_FILE = 'session.json';
async function getClient(): Promise<Client> {
const cl = new Client();
if (existsSync(SESSION_FILE)) {
await cl.loadSettings(SESSION_FILE); // restores cookies, device and uuids
}
await cl.login('USERNAME', 'PASSWORD'); // reuses the session when it is still valid
try {
await cl.getTimelineFeed(); // check that the session works
} catch (err) {
if (err instanceof LoginRequired) {
await cl.relogin(); // fresh login with the same device
} else {
throw err;
}
}
await cl.dumpSettings(SESSION_FILE);
return cl;
}
Settings can also be kept in memory or in a database:
const settings = cl.getSettings(); // plain JSON object
// ... store it ...
const cl2 = new Client({ settings });
// or: cl2.setSettings(settings);
Use the sessionid cookie from a logged-in browser or app:
await cl.loginBySessionid('1234567890%3AabcdEFGH...');
With an authenticator app (TOTP), generate the code from the seed:
const code = cl.totpGenerateCode('YOUR_TOTP_SEED');
await cl.login('USERNAME', 'PASSWORD', false, code);
With a code received by SMS / WhatsApp / app, pass it as verificationCode:
import { TwoFactorRequired } from 'insta-node-js';
try {
await cl.login('USERNAME', 'PASSWORD');
} catch (err) {
if (err instanceof TwoFactorRequired) {
const smsCode = '123456'; // read it from the user
await cl.login('USERNAME', 'PASSWORD', false, smsCode);
} else {
throw err;
}
}
Enable TOTP on your own account:
const seed = await cl.totpGenerateSeed(); // add this seed to your authenticator app
const backupCodes = await cl.totpEnable(cl.totpGenerateCode(seed));
await cl.totpDisable();
When Instagram asks for a security code, the client calls challengeCodeHandler. By default it reads the code from the terminal. Provide your own handler to read it from email, a database, a bot, etc.:
import { ChallengeChoice } from 'insta-node-js';
cl.challengeCodeHandler = async (username, choice) => {
if (choice === ChallengeChoice.EMAIL) {
return await readCodeFromEmail(username);
}
return await readCodeFromSms(username);
};
// when Instagram forces a password change during a challenge
cl.changePasswordHandler = async (username) => 'NEW_STRONG_PASSWORD';
declare function readCodeFromEmail(username: string): Promise<string>;
declare function readCodeFromSms(username: string): Promise<string>;
cl.setCaptchaHandler(async (details) => {
// solve details (site key, url, ...) with your captcha service and return the token
return 'CAPTCHA_TOKEN';
});
await cl.logout();
cl.setProxy('http://user:pass@1.2.3.4:8080');
cl.setProxy('socks5://user:pass@1.2.3.4:1080');
cl.setProxy(null); // no proxy
The proxy is used for every connection the client makes: API and web requests, media downloads (including images passed to uploads as URLs) and the realtime / FBNS MQTT connections (http, https, socks4, socks4a, socks5, socks5h).
cl.setLocale('en_US');
cl.setCountry('US');
cl.setCountryCode(1);
cl.setTimezoneOffset(-5 * 3600, 'America/New_York');
cl.setDevice({
manufacturer: 'samsung',
model: 'SM-S918B',
device: 'dm3q',
android_version: 34,
android_release: '14',
dpi: '480dpi',
resolution: '1080x2340',
cpu: 'qcom',
});
cl.setUserAgent(); // rebuild the user agent from the device settings
Change these before the first login and keep them stable afterwards (they are saved in the settings).
const me = await cl.accountInfo();
console.log(me.username, me.email, me.phone_number);
await cl.accountSetBiography('Hello from Node.js');
await cl.accountChangePicture('./avatar.jpg');
await cl.accountEdit({ full_name: 'New Name', external_url: 'https://example.com' });
await cl.accountSetPrivate();
await cl.accountSetPublic();
await cl.changePassword('OLD_PASSWORD', 'NEW_PASSWORD');
const userId = await cl.userIdFromUsername('instagram');
const user = await cl.userInfo(userId);
const sameUser = await cl.userInfoByUsername('instagram');
console.log(user.username, user.follower_count, user.following_count, user.media_count, user.biography);
// followers / following are Maps keyed by user pk
const followers = await cl.userFollowers(userId, true, 100);
for (const [pk, follower] of followers) console.log(pk, follower.username);
const following = await cl.userFollowing(userId, true, 100);
await cl.userFollow(userId);
await cl.userUnfollow(userId);
await cl.userRemoveFollower(userId);
await cl.userBlock(userId);
await cl.userUnblock(userId);
await cl.closeFriendAdd(userId);
const medias = await cl.userMedias(userId, 20);
const reels = await cl.userClips(userId, 20);
const results = await cl.searchUsers('nasa');
const pk = cl.mediaPkFromCode('B1LbfVPlwIA'); // from a shortcode
const pkFromUrl = await cl.mediaPkFromUrl('https://www.instagram.com/p/B1LbfVPlwIA/');
const code = cl.mediaCodeFromPk(pk);
const media = await cl.mediaInfo(pk);
console.log(media.media_type, media.product_type, media.caption_text, media.like_count, media.comment_count);
// media_type: 1 photo, 2 video (product_type 'feed' | 'igtv' | 'clips'), 8 album
const owner = await cl.mediaUser(pk);
const likers = await cl.mediaLikers(media.id);
await cl.mediaLike(media.id);
await cl.mediaUnlike(media.id);
await cl.mediaSave(media.id);
await cl.mediaArchive(media.id);
await cl.mediaEdit(media.id, 'New caption #tag');
await cl.mediaDelete(media.id);
await cl.mediaSeen([media.id]);
const comments = await cl.mediaComments(media.id, 50);
for (const c of comments) console.log(c.user.username, c.text);
const comment = await cl.mediaComment(media.id, 'Nice! 🔥');
await cl.mediaComment(media.id, 'Reply', comment.pk); // reply to a comment
await cl.commentLike(comment.pk);
await cl.commentLike(comment.pk, true); // unlike
await cl.commentPin(media.id, comment.pk);
await cl.commentBulkDelete(media.id, [comment.pk]);
Photos (JPG, PNG, WEBP; converted and resized automatically):
import { makeUsertag, makeLocation } from 'insta-node-js';
const someone = await cl.userInfoByUsername('instagram');
const photo = await cl.photoUpload('./photo.jpg', 'Caption #hashtag @mention', {
usertags: [makeUsertag({ user: someone, x: 0.5, y: 0.5 })],
location: makeLocation({ name: 'Bucharest', lat: 44.4268, lng: 26.1025 }),
});
console.log(photo.code);
Video, album, Reels and IGTV (video needs ffmpeg):
await cl.videoUpload('./video.mp4', 'My video', { thumbnail: './cover.jpg' });
await cl.albumUpload(['./1.jpg', './2.jpg', './3.mp4'], 'Album caption');
await cl.clipUpload('./reel.mp4', 'My reel #reels', { thumbnail: './cover.jpg' });
const [track] = await cl.searchMusic('summer');
await cl.clipUploadWithMusic('./reel.mp4', 'Reel with music', track);
await cl.igtvUpload('./long-video.mp4', 'Title', 'Description');
Scheduling, coauthors and cross-posting:
await cl.photoUpload('./photo.jpg', 'Scheduled post', {
scheduleAt: new Date(Date.now() + 2 * 3600 * 1000),
coauthorUserIds: [someone.pk],
shareToFacebook: true,
shareToThreads: true,
});
Upload a story (photo or video) with stickers:
import { makeStoryMention, makeStoryLink, makeStoryHashtag } from 'insta-node-js';
const friend = await cl.userInfoByUsername('instagram');
const hashtag = await cl.hashtagInfo('nodejs');
const story = await cl.photoUploadToStory('./story.jpg', 'Story caption', {
mentions: [makeStoryMention({ user: friend, x: 0.5, y: 0.5, width: 0.5, height: 0.1 })],
links: [makeStoryLink({ webUri: 'https://example.com' })],
hashtags: [makeStoryHashtag({ hashtag, x: 0.3, y: 0.7, width: 0.4, height: 0.1 })],
});
await cl.videoUploadToStory('./story.mp4', 'Video story');
Read stories:
const stories = await cl.userStories(friend.pk);
await cl.storySeen(stories.map((s) => s.pk));
const info = await cl.storyInfo(stories[0].pk);
const viewers = await cl.storyViewers(story.pk); // your own story
await cl.storyLike(stories[0].id);
await cl.storyDelete(story.pk);
Build a story image/video with a caption and mentions (StoryBuilder, needs ffmpeg):
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.