Docs / Instagram API Tutorial — Your First Call in Under a Minute

Instagram API Tutorial — Your First Call in Under a Minute

Sign up, copy the key, send one GET request. There is no OAuth handshake to implement and nothing to install.

Maintained by the InScrape API team · Last reviewed 2026-09-19

Step 1 — get a key

Create an account and the dashboard shows a key immediately, along with 100 free credits. No card, no Instagram login, no Meta app review queue. The key is a plain string beginning with sk_ and it is the only credential the API accepts. Copy it into an environment variable now, because the plaintext is displayed once and never again.

export INSCRAPE_KEY="sk_YOUR_KEY_HERE"

Step 2 — send the request

Every endpoint is a GET with query parameters and one header. This one reads a public profile and costs 1 credit. Swap natgeo for any handle; a confirmed private account returns 200 with available profile details and is charged at the endpoint rate.

curl "https://api.socialscrape.dev/v1/instagram/profile?handle=natgeo" \
  -H "x-api-key: $INSCRAPE_KEY"

Step 3 — read the envelope

Every success response, on every endpoint, has the same top-level metadata. The account data you asked for is under data; everything beside it tells you what the call cost, when it started, how long it took and which lookup triggered it. You never need a separate usage call to know your balance.

{
  "success": true,
  "credits_charged": 1,
  "credits_remaining": 99,
  "processing_time_ms": 1842,
  "requested_at": "2026-09-13T14:32:18Z",
  "query": { "username": "natgeo" },
  "data": {
    "id": "787132",
    "handle": "natgeo",
    "full_name": "National Geographic",
    "is_verified": true,
    "is_private": false,
    "follower_count": 279000000,
    "following_count": 158,
    "media_count": 30412,
    "biography": "Experience the world through the eyes of National Geographic photographers.",
    "external_url": "https://on.natgeo.com/instagram"
  }
}

The same call in Node

No SDK. fetch is enough, and checking res.ok before touching data is the one thing worth doing from the start, because error responses have no data key at all.

const res = await fetch(
  "https://api.socialscrape.dev/v1/instagram/profile?handle=natgeo",
  { headers: { "x-api-key": process.env.INSCRAPE_KEY } },
);

const body = await res.json();
if (!res.ok) throw new Error(`${body.error.code}: ${body.error.message}`);

console.log(body.data.follower_count, body.credits_remaining);

The same call in Python

requests, or httpx, or urllib. The header name is the only thing that has to be exact. The per-language code reference pages carry the same call with a pagination loop and error handling already written, in Python, Node.js, PHP, Go, Java and curl.

import os
import requests

res = requests.get(
    "https://api.socialscrape.dev/v1/instagram/profile",
    params={"handle": "natgeo"},
    headers={"x-api-key": os.environ["INSCRAPE_KEY"]},
    timeout=30,
)

body = res.json()
if not res.ok:
    raise RuntimeError(f"{body['error']['code']}: {body['error']['message']}")

print(body["data"]["follower_count"], body["credits_remaining"])

Step 4 — pick the endpoint you actually need

The endpoint catalogue covers profiles, posts, single posts, reels, reposts, stories, highlights, highlight items, comments, followers, following, tagged posts, similar accounts, user search, popular search and hashtag posts. Each has its own reference page with parameters and response fields. All of them use the same header and response envelope, so the second endpoint takes about thirty seconds to integrate.

What this API does not do

It is read-only and public-only. It cannot post, comment, like or follow, it cannot read direct messages, notifications or saved posts, it cannot return insights such as reach and impressions, and it cannot read private accounts. Follower emails and phone numbers are not returned because they are not public. If your product needs to publish to an account or read a private metric on an account you own, that is the Instagram Graph API's job, not ours.

FAQ

Do I need an Instagram account to use this?

No. You never supply Instagram credentials, cookies or a session. The API reads what is publicly visible without logging in.

How long does setup take?

One header. There is no SDK to install, no OAuth redirect to register and no app review, so the first successful call usually happens inside a minute of signing up.

What does the free tier cover?

100 credits on signup, which is 100 requests on most endpoints or 50 pages of followers or following. They do not expire, so exploration goes further than a trial window.

Is there a sandbox or test key?

No separate sandbox. The free credits run against live endpoints and real data, which means what you test is exactly what you ship.

Related