Node.js & JavaScript

Instagram API for Node.js

Call public Instagram data from Node.js, Bun, Deno, Next.js, or Cloudflare Workers with the built-in fetch. No Puppeteer, no instagram-private-api sessions, and no proxies to run.

50 free credits on signup · no card required

curl "https://api.profilequery.com/v1/profile?handle=nike" \
  -H "Authorization: Bearer $PROFILEQUERY_KEY"

What you get

Structured JSON, not raw HTML

  • ▹Built-in fetch only, with zero dependencies
  • ▹Works in server routes, serverless functions, edge workers, and cron jobs
  • ▹Typed-friendly flat JSON with consistent field names across endpoints
  • ▹Keep the key server-side: never call it from the browser
  • ▹Cursor pagination with async generators
  • ▹Pay per request with no subscription

Tutorial

Get Instagram data with Node.js

1. A tiny client

const API = "https://api.profilequery.com/v1";

export async function ig<T = any>(path: string, params: Record<string, string> = {}): Promise<T> {
  const url = `${API}/${path}?${new URLSearchParams(params)}`;
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.PROFILEQUERY_KEY}` },
  });
  const body = await res.json();
  if (!res.ok) throw new Error(`${body.error?.code}: ${body.error?.message}`);
  return body.data;
}

const profile = await ig("profile", { handle: "nike" });
console.log(profile.username, profile.followers);

2. Paginate with an async generator

export async function* paginate(path: string, params: Record<string, string>, maxPages = 5) {
  let cursor: string | null = null;
  for (let i = 0; i < maxPages; i++) {
    const page = await ig(path, cursor ? { ...params, cursor } : params);
    yield* page.items;
    cursor = page.next_cursor;
    if (!cursor) break;
  }
}

for await (const reel of paginate("profile/reels", { handle: "nike" }, 3)) {
  console.log(reel.shortcode, reel.view_count);
}

3. Use it in a Next.js route handler

Keep your API key on the server. A route handler proxies just the data your frontend needs.

// app/api/instagram/[handle]/route.ts
import { ig } from "@/lib/ig";

export async function GET(_req: Request, { params }: { params: Promise<{ handle: string }> }) {
  const { handle } = await params;
  const p = await ig("profile", { handle });
  return Response.json({ username: p.username, followers: p.followers, pic: p.profile_pic_url });
}

Example response

What comes back

{
  "data": {
    "id": "13460080",
    "username": "nike",
    "full_name": "Nike",
    "biography": "Just Do It.",
    "is_verified": true,
    "is_private": false,
    "is_business": true,
    "category": null,
    "followers": 291952375,
    "following": 264,
    "posts": 1657,
    "external_url": "http://empli.fi/nike",
    "profile_pic_url": "https://instagram.com/.../nike.jpg",
    "public_email": null,
    "public_phone_number": null
  }
}

Response fields

Fields returned by GET /v1/profile

FieldDescription
idNumeric account id (stable even if the username changes).
usernameThe account's @handle.
full_nameDisplay name shown on the profile.
biographyThe profile's bio text.
is_verifiedWhether the account has a verified badge.
is_privateWhether the account is private.
is_businessWhether this is a business/professional account.
categoryBusiness category label when set (e.g. "Sportswear"); null otherwise.
followersNumber of accounts following this account.
followingNumber of accounts this account follows.
postsTotal number of posts on the profile.
external_urlThe clickable link in the bio, if any.
profile_pic_urlURL of the account's profile picture.
public_emailPublic contact email, if the account exposes one; null otherwise.
public_phone_numberPublic contact phone number, if exposed; null otherwise.

No login required

Nothing to authenticate but your API key

No OAuth flow

One static API key in an Authorization: Bearer header. No redirect, no refresh tokens, no expiring session.

No Meta app review

Never touch Meta's developer platform, Business Verification, or a connected Facebook Page. Sign up directly with Profile Query.

Public data only

Every endpoint returns only what's already visible on Instagram without logging in. Private accounts are never accessible.

Pricing

1 credit per request. Credits start at $8.00 per 1,000 and drop to $6.00 per 1,000 at volume — no subscription, no minimums. New accounts get 50 free credits.

See full pricing

FAQ

Instagram API for Node.js, explained

Do I need an npm package?

No. It's plain HTTPS + JSON, so the fetch built into Node 18+, Bun, and Deno is enough.

Can I call it from the browser?

Don't. Your API key would be visible to anyone. Call it from a server route, serverless function, or worker, and send only the fields you need to the client.

Is this an alternative to instagram-private-api or Puppeteer scraping?

Yes, for reading public data. You don't log in to Instagram, run a headless browser, or rotate proxies. Breakage on Instagram's side is fixed upstream without a redeploy on yours.

What does it cost?

Most calls are 1–2 credits, from $8.00 per 1,000. New accounts get 50 free credits.

Start pulling node.js data

Create a free key and make your first request in under a minute — 50 credits on us.