Meta

Instagram API (Meta)

Instagram professional accounts: profile, media, publish photos, carousels and reels, comments, insights, hashtags and mentions.

SocialGuided#instagram#graph-api#content-publishing#meta#insights#comments

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

The Instagram API lets your app work with Instagram professional accounts (business and creator accounts): read the profile and media, publish photos, carousels and reels, moderate comments, read account and media insights, search hashtags and find mentions. It does not work with personal Instagram accounts. It is part of Meta's Graph API, so requests look like GET https://graph.facebook.com/v27.0/{ig-user-id}/media with a bearer token.

Three ways to log in (pick one)

SetupPeople log in withFacebook Page neededToken your app getsHost
Instagram API with Unified Login (recommended for new apps)Instagram or FacebookNoBusiness Integration System User tokengraph.facebook.com
Instagram API with Instagram LoginInstagramNoInstagram User tokengraph.instagram.com
Instagram API with Facebook LoginFacebookYes, linked to the IG accountFacebook User or Page tokengraph.facebook.com

Meta now releases new features only for Unified Login. Instagram Login cannot use hashtag search or ads; Facebook Login needs a Page connected to the Instagram account. Permission names differ: Facebook/Unified Login use instagram_basic, instagram_content_publish, instagram_manage_comments, instagram_manage_insights; Instagram Login uses the instagram_business_* versions of the same names.

This collection's baseUrl is https://graph.facebook.com/{{graphVersion}} (Unified and Facebook Login). If you use Instagram Login, set baseUrl to https://graph.instagram.com/{{graphVersion}}; every request except hashtag search then works unchanged.

Set up the app, step by step

  1. At developers.facebook.com/apps, create an app owned by a business portfolio and add the use case Manage messaging & content on Instagram.
  2. Open Use cases > Customize and choose your setup tab, e.g. API setup with Unified login.
  3. Unified Login: Create new configuration (it requests an Instagram account and instagram_basic, instagram_manage_messages, instagram_manage_comments, instagram_content_publish; add instagram_manage_insights if you need insights), set your HTTPS redirect URL, and copy the login URL. Your server swaps the returned code for a token at GET /oauth/access_token?client_id&client_secret&code.
  4. For testing, under Generate access tokens invite your Instagram professional account as an Instagram Tester, accept the invite in Instagram (Settings > Website permissions > Apps and websites > Tester invites), then Generate token. Paste it into accessToken.
  5. Run 1. Find your Instagram account to fill igUserId.
  6. Before accounts you do not manage can connect, each permission needs Advanced Access through App Review and the app must be Live. Hashtag search also needs the Instagram Public Content Access feature.

Tokens: Unified Login tokens belong to the client's business portfolio and expire as configured; Instagram Login tokens from the login flow last 1 hour, dashboard-generated ones 60 days and can be refreshed; Facebook Login tokens follow the usual Graph rules (see the Facebook Graph API collection).

How to use this collection

  1. Fill in accessToken (and pageId if you use Facebook Login).
  2. Run the request in 1. that matches your login type: it saves igUserId.
  3. 2. Account and media saves mediaId. 3. Publish saves containerId and mediaId as you go. 4. Comments saves commentId. 6. Hashtags and mentions saves hashtagId.

Limits

Publishing is capped per account per 24 hours (check Check your publishing quota); hashtag search allows 30 unique hashtags per account per 7 days; normal Graph rate limits apply (see rate limiting). The API is free.

Common errors

CodeMeaningWhat to do
190Token expired or invalidLog in again or refresh the token.
10, 200Permission missing or not approvedAdd the permission to your configuration; Advanced Access for other people's accounts.
100Invalid parameter or unsupported field for this login typeCheck field names; some fields exist only with Facebook Login.
9004 / 2207052Media could not be fetched from your URLHost the image or video on a public HTTPS URL.
9007 / 2207027Container not ready to publishPoll status_code until FINISHED.
9 / 2207042Daily publishing limit reachedWait; check content_publishing_limit.
36001 / 2207005Image format not supportedUse JPEG.
4, 17, 32, 613Rate limitedBack off and retry later.

Links

Endpoints 27

1. Find your Instagram account

  • GETUnified Login: list shared Instagram accounts/me/assigned_instagram_accounts?fields=id,usernameWith a Unified Login token, /me is the business integration system user, not the Instagram account, so ask for the Instagram accounts the client shared with…
  • GETFacebook Login: get the Page's Instagram account/{{pageId}}?fields=instagram_business_account{id,username}With Facebook Login, the Instagram account hangs off the Facebook Page it is linked to. Ask the Page (pageId, from GET /me/accounts) for its…
  • GETInstagram Login: who am I{{igLoginBaseUrl}}/me?fields=user_id,username,account_typeWith Instagram Login, /me on graph.instagram.com is the Instagram professional account that logged in. user_id is the account ID used in paths and in…
  • GETInstagram Login: refresh a long-lived tokenhttps://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token={{accessToken}}Extends a long-lived Instagram User token (Instagram Login only) for another 60 days from today. The token must be at least 24 hours old and not yet expired;…

2. Account and media

  • GETGet the account profile/{{igUserId}}?fields=id,username,name,biography,website,profile_picture_url,followers_count,follows_count,media_countReads profile fields of the Instagram professional account: username, name, biography, website, profile_picture_url, followers_count, follows_count and…
  • GETList your media/{{igUserId}}/media?fields=id,caption,media_type,media_url,permalink,timestamp,like_count,comments_count&limit=10Lists the account's published posts, newest first, with cursor paging (limit, paging.next). Without fields you only get IDs. Useful fields: caption,…
  • GETGet one media/{{mediaId}}?fields=id,caption,media_type,media_url,permalink,timestamp,like_count,comments_count,is_comment_enabled,children{id,media_type,media_url}Reads one post. For carousels, expand children to get each item's type and URL. is_comment_enabled shows whether comments are on, alt_text the accessibility…

3. Publish

  • POSTCreate a photo container/{{igUserId}}/mediaStep 1 for a single photo. image_url must be a public HTTPS URL to a JPEG (Meta fetches it; error 9004 if it cannot). Optional: caption (hashtags and…
  • GETCheck container status/{{containerId}}?fields=id,status_code,statusShows whether a container can be published. status_code is one of: Meta suggests checking about once a minute, for up to 5 minutes. Images are usually…
  • POSTPublish a container/{{igUserId}}/media_publishStep 2: publishes the container in containerId (a photo, carousel or reel container). Returns the new media id, saved in mediaId. If the response also has…
  • POSTCarousel: create item 1/{{igUserId}}/mediaA carousel post holds up to 20 images and/or videos (the error message for 2207028 still says 10, so test your size). First create one container per item with…
  • POSTCarousel: create item 2/{{igUserId}}/mediaSecond carousel item, same as item 1 (for a video item, send media_type: "VIDEO" and video_url instead of image_url). Saves its ID in carouselItem2. All…
  • POSTCarousel: create the carousel container/{{igUserId}}/mediaCombines the item containers into one carousel container: media_type = CAROUSEL, children = comma-separated item container IDs in display order, and the…
  • POSTCreate a reel container/{{igUserId}}/mediaCreates a container for a reel: media_type = REELS and a public video_url (MP4 or MOV). Optional: caption, share_to_feed (also show it in the profile grid),…
  • GETCheck your publishing quota/{{igUserId}}/content_publishing_limit?fields=quota_usage,configShows how many posts the account has published through the API in the current 24-hour window (quota_usage) and the limit (config.quota_total,…

4. Comments

  • GETList comments on a media/{{mediaId}}/comments?fields=id,text,timestamp,username,like_count,hiddenLists top-level comments on a post, with cursor paging. Fields: text, timestamp, username (the commenter), like_count, hidden, from (id = Instagram-scoped ID,…
  • POSTReply to a comment/{{commentId}}/repliesPosts a public reply under the comment in commentId, as the account. Body: message. Returns the new comment's id. To answer privately in Instagram Direct…
  • POSTHide a comment/{{commentId}}?hide=trueHides (hide=true) or shows again (hide=false) a comment on the account's media. Comments the account made on its own media are always shown, even if hidden.…
  • DELETEDelete a comment/{{commentId}}Deletes a comment permanently. Only the owner of the media can delete comments on it, even comments written by someone else. Permission: instagram_basic +…
  • POSTTurn comments off for a media/{{mediaId}}?comment_enabled=falseDisables (comment_enabled=false) or re-enables (true) comments on a post. Existing comments stay but no new ones can be added while off. Read the current…

5. Insights

  • GETAccount insights/{{igUserId}}/insights?metric=reach,views,accounts_engaged,total_interactions&period=day&metric_type=total_valueInteraction metrics for the account. Use period=day with metric_type=total_value for a single total over the range (since/until as UNIX timestamps; default:…
  • GETFollower demographics/{{igUserId}}/insights?metric=follower_demographics&period=lifetime&timeframe=this_month&metric_type=total_value&breakdown=countryWhere the account's followers are, by country (or city, age, gender via breakdown). Demographic metrics need period=lifetime, metric_type=total_value and a…
  • GETMedia insights/{{mediaId}}/insights?metric=views,reach,likes,comments,saved,shares,total_interactionsLifetime metrics for one post or reel. Current metrics for feed posts and reels include views, reach, likes, comments, saved, shares, total_interactions;…

6. Hashtags and mentions

  • GETFind a hashtag ID/ig_hashtag_search?user_id={{igUserId}}&q=handmadeTurns a hashtag (without #, no emoji) into a hashtag node ID. user_id is the account making the search (igUserId). Each account can query 30 unique hashtags…
  • GETRecent media for a hashtag/{{hashtagId}}/recent_media?user_id={{igUserId}}&fields=id,caption,media_type,permalink,timestamp,like_count,comments_count&limit=25Public photos, videos and carousels tagged with the hashtag in the last 24 hours, newest first (/top_media gives the most popular instead). user_id is…
  • GETMedia you are tagged in/{{igUserId}}/tags?fields=id,caption,username,media_type,permalink,timestampLists public media in which other accounts tagged your account (photo tags). Filter with media_type (IMAGE, VIDEO, CAROUSEL_ALBUM) or posted_after /…
  • POSTReply to a mention/{{igUserId}}/mentions?media_id={{mentionMediaId}}&comment_id={{mentionCommentId}}&message=Thanks%20for%20the%20shout-out%21Comments on a post whose caption @mentions your account (media_id only), or replies to a comment that @mentions your account (media_id + comment_id). Get the…

API details

Base URL
https://graph.facebook.com/v27.0
https://graph.instagram.com/v27.0
Authentication
A bearer token in the Authorization header
An API key in the access_token query parameter
Operations
27 operations on 27 pathsGET 16POST 10DELETE 1
Main resources
1. Find your Instagram account 42. Account and media 33. Publish 84. Comments 55. Insights 36. Hashtags and mentions 4
Description format
Swastik Codes guided collection, API version checked against the docs on 2026-11-17

How to test the Instagram API (Meta) in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Instagram API (Meta) collection, without the publisher's secrets.
  3. Add your credentialsThis API uses A bearer token in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Unified Login: list shared Instagram accounts” (GET /me/assigned_instagram_accounts?fields=id,username), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Instagram API (Meta)?

Instagram professional accounts: profile, media, publish photos, carousels and reels, comments, insights, hashtags and mentions. It is listed under Social and has 27 endpoints.

Who publishes the Instagram API (Meta)?

It is listed from Meta's public API description (an OpenAPI document), not published by Meta on Swastik Codes. Anyone who controls facebook.com can claim the profile by adding a DNS TXT record.

What is the base URL of the Instagram API (Meta)?

Its description lists 2 base URLs: https://graph.facebook.com/v27.0, https://graph.instagram.com/v27.0. The first is the usual one; the others are typically sandbox or regional servers.

How do I authenticate with the Instagram API (Meta)?

It accepts 2 methods: A bearer token in the Authorization header; an API key in the access_token query parameter.

How many endpoints does the Instagram API (Meta) have?

27 operations on 27 paths (16 GET, 10 POST, 1 DELETE). The largest groups are 1. Find your Instagram account, 2. Account and media, 3. Publish, 4. Comments.

Is forking the Instagram API (Meta) free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.