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_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxMCP 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/mcpAuthenticate 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.
| Status | code | Meaning | Billed? |
|---|---|---|---|
| 400 | missing_parameter | A required parameter is absent or malformed. | No |
| 401 | invalid_api_key | Missing, malformed, or revoked key. | No |
| 402 | insufficient_credits | Out of credits; top up to continue. | No |
| 404 | not_found | Well-formed request, but no public data (private, deleted, or nonexistent). | Yes |
| 502 | upstream_error | Data provider hiccup; safe to retry. | No |
| 504 | upstream_timeout | Upstream 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/profileGet profile
Full public profile for an account.
GET /v1/profile/aboutAccount age & country
Account creation date, country of registration, and past usernames.
GET /v1/profile/postsGet posts
Recent posts (feed) for an account.
GET /v1/profile/reelsGet reels
Reels (clips) for an account.
GET /v1/profile/storiesGet stories
Currently-active stories for an account.
GET /v1/profile/highlightsGet highlights
Story highlight reels for an account.
GET /v1/profile/followersGet followers
A page of accounts that follow this account.
GET /v1/profile/followingGet following
A page of accounts this account follows.
GET /v1/insights/profile/engagementEngagement rate
Engagement rate computed from recent posts.
GET /v1/insights/profile/best-timeBest time to post
Best hours & days to post, from recent engagement.
GET /v1/insights/profile/statsAccount stats
Posting cadence and content-format breakdown.
GET /v1/insights/profile/auditFake-follower audit
Estimate real vs. suspicious followers from a sample.
GET /v1/insights/profile/qualifyLead fit scoring
AI score for how well an account fits your ideal lead.
GET /v1/insights/profile/summaryProfile summary
AI sales/CRM brief for an account.
GET /v1/insights/profile/nicheNiche classifier
AI niche, categories and brand voice.
GET /v1/insights/profile/similarSimilar accounts
Find and rank accounts similar to one you give.
GET /v1/insights/post/imageAnalyze image (vision)
AI vision tags for a post's image.
GET /v1/insights/post/commentsComment sentiment
AI sentiment + themes over a post's comments.
GET /v1/insights/hashtagAnalyze hashtag
Competitiveness & velocity for a hashtag.
GET /v1/insights/profile/captionGenerate captions
Write captions in an account's own voice.
GET /v1/insights/profile/dm-openerDM opener
Personalized cold-outreach opener for an account.
GET /v1/postGet post
Full details for a single post or reel.
GET /v1/post/commentsGet comments
Comments on a post or reel.
GET /v1/post/likersGet likers
Accounts that liked a post.
GET /v1/hashtag/topTop hashtag posts
Top-ranked posts for a hashtag.
GET /v1/hashtag/recentRecent hashtag posts
Most recent posts for a hashtag.
GET /v1/locationGet location
Details for a place / location.
GET /v1/location/postsLocation posts
Recent posts tagged at a location.
GET /v1/search/usersSearch users
Search accounts by keyword.
GET /v1/search/hashtagsSearch hashtags
Search hashtags by keyword.
GET /v1/search/locationsSearch locations
Search places by keyword.
GET /v1/creditsGet credit balance
Your account's current credit balance.