Sign in

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_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Responses

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.

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