instagramapi API reference
A REST API for public Instagram data. JSON in, JSON out, one bearer token. Base URL: https://api.instagramapi.dev/v1
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"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_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxResponses
Every successful response uses the same envelope: your payload under data, plus a meta object with billing and pagination info.
{
"data": { /* the Instagram object(s) you asked for */ },
"meta": {
"endpoint": "profile",
"request_id": "8f3c...",
"credits_charged": 1,
"credits_remaining": 4987,
"next_cursor": null,
"ms": 412
}
}The same numbers come 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/creditsGet credit balance
Your account's current credit balance.
GET /v1/profileGet profile
Full public profile for an account.
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/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.