Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Only for Instagram business or creator accounts connected to your Meta app, with the permissions each call lists in its docs. Tokens are tied to the app user.
- Publishing is two calls: media.create_container, then media.publish. Both change the account, so they are writes.
- Insights data can lag 48 hours; missing data comes back as an empty set, not 0.
- Paging uses cursors in paging.cursors.after; follow paging.next when present.
Endpoints
Get an Instagram professional account
List an account’s media
- Returns up to the 10,000 most recent media. Stories come from the /stories edge, not here.
- media_url is missing for some videos (licensed audio, reels with downloads off): fall back to permalink or thumbnail_url.
- fields: without it only ids come back.
Get one post
Get a post’s insights
- Needs a professional account and the insights permission. Albums have no insights; story metrics expire after 24 hours; stories with under 5 viewers answer error 10.
- Missing data returns an empty set, not 0. Data can lag 48 hours.
Get account-level insights
- follower_count and online_followers need 100+ followers. Demographics return the top 45 only. Data can lag 48 hours. impressions is deprecated: use views.
List comments on a post
- Newest first, at most 50 per query, top-level only unless replies is requested. Cannot be filtered by time.
Look up another business or creator account
- Read-only, public data only; age-gated accounts return nothing. Needs Facebook Login with instagram_manage_insights.
- The media edge pages with before/after cursors but no next link: build the next request yourself.