Instagram API reference

A REST API for public Instagram data. JSON in, JSON out, one bearer token. Base URL: https://api.instagramapi.dev/v1

Build this with an AI agent

Paste this prompt into Claude, Codex, or any coding agent.

Quickstart

Create a key in your dashboard, then fetch a profile:

curl "https://api.instagramapi.dev/v1/profile?handle=nike" \
  -H "Authorization: Bearer $INSTAGRAMAPI_KEY"

Prefer to generate a client or wire this into an AI agent? Grab the OpenAPI spec (https://api.instagramapi.dev/openapi.json). It works with Swagger/Redoc, Postman, SDK generators, and agent tool loaders like ChatGPT Actions and LangChain.

Authentication

Pass your secret key as a bearer token on every request. You can also use the x-api-key header. Keys are created and revoked from the dashboard and are shown in full only once.

Authorization: Bearer ig_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

MCP server

Every endpoint is also exposed as an MCP tool, so AI assistants (Claude Code, Claude Desktop, Cursor, agent frameworks) can call the API conversationally. The server speaks Streamable HTTP at:

https://api.instagramapi.dev/mcp

Authenticate with the same bearer API key as the REST API. Tool names mirror endpoint paths with underscores (profile/posts profile_posts), inputs match the documented query params, and results are the same JSON envelope — billed identically, with meta.credits_remaining in every result.

claude mcp add --transport http instagram https://api.instagramapi.dev/mcp \
  --header "Authorization: Bearer ig_live_YOUR_KEY"

Tool-call failures come back as structured errors with the same code values as REST (see Errors), so agents can recover — top up on insufficient_credits, fix input on missing_parameter. Clients that can't send custom headers (e.g. claude.ai web custom connectors, which require OAuth) aren't supported yet. More on the MCP overview page.

Responses

Every successful response uses the same envelope: your payload under data, plus a meta object with billing info. A single resource (like a profile or post) comes back as a flat object:

{
  "data": {
    "id": "13460080",
    "username": "nike",
    "full_name": "Nike",
    "followers": 291952375
    // …
  },
  "meta": {
    "endpoint": "profile",
    "request_id": "req_8f3c1a2b",
    "credits_charged": 1,
    "credits_remaining": 4987,
    "ms": 412
  }
}

List endpoints (posts, followers, comments, search, …) wrap results in items with a next_cursor:

{
  "data": {
    "items": [ /* … */ ],
    "next_cursor": "QVFE..."
  },
  "meta": { "endpoint": "profile/followers", "credits_charged": 2, "credits_remaining": 4985, "ms": 530 }
}

To page, pass next_cursor back as the cursor query parameter; a null cursor means the last page. Billing also comes back as x-credits-remaining and x-request-id response headers.

Billing

Credits are charged per request. Most endpoints cost 1 credit.Endpoints that must first resolve an account or post to fetch a sub-resource, like followers, a profile's posts, or a post's comments, cost 2 credits. The exact cost is shown on every endpoint's reference page and returned as meta.credits_charged.

The rule for whether you're charged is simple: if your request is well-formed and we query Instagram for you, it's billed, even when the answer is “no public data here.” A lookup for a private, deleted, or nonexistent account is a real query on our side, so it bills (and returns 404). What you are never charged for: input we reject before querying (a missing or malformed parameter), authentication problems, an empty balance, or a provider/network error on our side.

Errors

Errors return a matching HTTP status and a typed body. The Billed? column below follows the rule above: your input errors and our outages are free; a well-formed request that reaches Instagram is billed even if no data comes back.

StatuscodeMeaningBilled?
400missing_parameterA required parameter is absent or malformed.No
401invalid_api_keyMissing, malformed, or revoked key.No
402insufficient_creditsOut of credits; top up to continue.No
404not_foundWell-formed request, but no public data (private, deleted, or nonexistent).Yes
502upstream_errorData provider hiccup; safe to retry.No
504upstream_timeoutUpstream took too long; safe to retry.No

Pagination

List endpoints return meta.next_cursor. Pass it back as the cursor query param to get the next page. When next_cursor is null, you've reached the end.

Endpoints

GET /v1/profile

Get profile

Full public profile for an account.

GET /v1/profile/about

Account age & country

Account creation date, country of registration, and past usernames.

GET /v1/profile/posts

Get posts

Recent posts (feed) for an account.

GET /v1/profile/reels

Get reels

Reels (clips) for an account.

GET /v1/profile/stories

Get stories

Currently-active stories for an account.

GET /v1/profile/highlights

Get highlights

Story highlight reels for an account.

GET /v1/profile/followers

Get followers

A page of accounts that follow this account.

GET /v1/profile/following

Get following

A page of accounts this account follows.

GET /v1/insights/profile/engagement

Engagement rate

Engagement rate computed from recent posts.

GET /v1/insights/profile/best-time

Best time to post

Best hours & days to post, from recent engagement.

GET /v1/insights/profile/stats

Account stats

Posting cadence and content-format breakdown.

GET /v1/insights/profile/audit

Fake-follower audit

Estimate real vs. suspicious followers from a sample.

GET /v1/insights/profile/qualify

Lead fit scoring

AI score for how well an account fits your ideal lead.

GET /v1/insights/profile/summary

Profile summary

AI sales/CRM brief for an account.

GET /v1/insights/profile/niche

Niche classifier

AI niche, categories and brand voice.

GET /v1/insights/profile/similar

Similar accounts

Find and rank accounts similar to one you give.

GET /v1/insights/post/image

Analyze image (vision)

AI vision tags for a post's image.

GET /v1/insights/post/comments

Comment sentiment

AI sentiment + themes over a post's comments.

GET /v1/insights/hashtag

Analyze hashtag

Competitiveness & velocity for a hashtag.

GET /v1/insights/profile/caption

Generate captions

Write captions in an account's own voice.

GET /v1/insights/profile/dm-opener

DM opener

Personalized cold-outreach opener for an account.

GET /v1/post

Get post

Full details for a single post or reel.

GET /v1/post/comments

Get comments

Comments on a post or reel.

GET /v1/post/likers

Get likers

Accounts that liked a post.

GET /v1/hashtag/top

Top hashtag posts

Top-ranked posts for a hashtag.

GET /v1/hashtag/recent

Recent hashtag posts

Most recent posts for a hashtag.

GET /v1/location

Get location

Details for a place / location.

GET /v1/location/posts

Location posts

Recent posts tagged at a location.

GET /v1/search/users

Search users

Search accounts by keyword.

GET /v1/search/hashtags

Search hashtags

Search hashtags by keyword.

GET /v1/search/locations

Search locations

Search places by keyword.

GET /v1/credits

Get credit balance

Your account's current credit balance.