Instagram Graph API details

Many data scientists employ Artificial Intelligence to solve various tasks in the realm of Computer vision. The field that focuses on giving the machines the ability to “see” and understand images similar to how humans do it.
Many of these algorithms relay on Machine learning and often require massive number of data points to learn and generalize.
With over 40 billion images shard on Instagram across its history, it represents a massive source for data for such tasks.
In this article we will see if it is possible to use Instagram Graph API to get this type of data.


  • The graph API does not require any fees, the only requirement is for the app to approved which can be a rather strict process
  • The API cannot access Instagram consumer accounts (i.e., non-Business or non-Creator Instagram accounts). The Instagram Basic Display API can but it is built around a single user account to build clients for Instagram.
  • The Instagram Graph API is built on the Facebook Graph API. It functions in the same way and supports the same features, with the key difference being authentication.
  • We only list end-points that are important for a social media analysis service and thus we are not interested in publishing end-points.


 to connect to instagram official api, we need app to be approved which can be a rather strict process,

Meaning that we can only get access-token after signing up our website and get approved by instagram.

To  gain access to the Graph API, a developer will need:

  • An Instagram Business Account or Instagram Creator Account
  • A Facebook Page connected to that account
  • A Facebook Developer account that can perform Tasks on that Page
  • A registered Facebook App with Basic settings configured

If request is approved, we can get the following data after logging:

  • Our own account data (.e.g number of followers, following, posts and comments, hashtags)
  • People we are following (or public accounts) data(.e.g number of followers, following, posts)
  • People with private accounts data (.e.g number of followers, following)

APIs details

API Description Resource example Notes
Business Discovery The Business Discovery API is a subset of Instagram Graph API endpoints that allow you to get basic metadata and metrics about other Instagram Business and Creator Accounts. Given a username it can return stats about its social media engagement as well as listing the media published by the user. here Data about age-gated Instagram Business Accounts will not be returned.
Getting replies to a comment Returns a list of comment objects that represents the replays to a specific comment here This operation is only possible if the access token belongs to the user who published the original comment
Search for Hashtags Return a list of hashtag ids that corresponds to a specific query here You can query a maximum of 30 unique hashtags on behalf of an Instagram Business or Creator Account within a rolling, 7 day period. Once you query a hashtag, it will count against this limit for 7 days. Subsequent queries on the same hashtag within this time frame will not count against your limit, and will not reset its initial query 7 day timer. The API will return a generic error for any queries that include hashtags that are deemed sensitive or offensive. This process requires formal app review
Get hashtag’s recent media Returns a list of the most recently published photo and video IG Media objects published with a specific hashtag.

here Only returns public photos and videos. Only returns media objects published within 24 hours of query execution. Responses are paginated with a maximum limit of 50 results per page. You can query a maximum of 30 unique hashtags within a 7 day period. You cannot request the username field on returned media objects. Responses will not include any personally identifiable information. A very similar end-point is available for retrieving the most recent media objects of a hashtag
Get insights to a media object Returns insights data on a IG Media object. Values for each metric are calculated at the time of the request. And several engagement metrics can be returned based on the type of the media object, see the end-point details here Using a user account you, can measure engagement only to media objects (stories, videos, ..) published by that user Insights data is not available for IG Media objects within album IG Media objects. Story IG Media object insights are only available for 24 hours, However it is possible to store them using a webhook Story IG Media object metrics with values less than 5 will return a value of -1.
Get insights to a whole account Returns insights on an IG User. Metric values are calculated upon request. There are several metrics that can be returned see the endpoint here Insights data is not available on IG Users that have fewer than 100 followers.
Mentions API The Mentions API is a subset of Instagram Graph API endpoints and Webhooks. They allow you to identify captions, comments, and media in which an Instagram Business or Creator Account’s alias has been tagged or @mentioned. It is possible to get these information through normal REST requests or by subscribing to a webhook to recieve Instagram Webhooks notifications whenever an Instagram user mentions an Instagram Business or Creator Account. here Mentions on Stories are not supported. When using webhooks to listens for mentions, you should store any received data if you plan on using it later. Private IG Media objects will not be returned The usual flow of a mentions API is illustrated in the following section

Mentions API workflow

The simplest workflow to get and analyze mentions data goes like this, this is the simplest feed-like workflow to get information about the brand:

  1. Set up an Instagram webhook that’s subscribed to the mentions field. This webhook will give notifications every time your account is mentioned or tagged in a comment or media object
  2. Set up a script that can parse the Webhooks notifications and identify comment/media IDs.
  3. Use the IDs to query the GET /{ig-user-id}/mentioned_comment or GET /{ig-user-id}/mentioned_media endpoints to get more information about each comment/media object.
  4. Do your social media analysis
  5. Optionally respond to the media or comment by posting to POST /{ig-user-id}/mentions

Rate limits

  • There are 2 main authentication types in Facebook’s Graph API user-access-tokens and app-access-token, the rate limits depends on the authentication scheme
  • for the Business Discover and Hashtag APIs the requests rate is limited as follows:
    • if the app is authenticated using an application access token then the rate limit per hour is 200 * number of users where The Number of Users is based on the number of unique daily active users an app has. In cases where there are slow periods of daily usages, such as if your app has high activity on weekends but low activity over weekdays, the weekly and monthly active users are used to calculate the number of users for your app. Apps with high daily engagement will have higher rate limits than apps with low daily engagement, regardless of the actual number of app installs. Note that this is not a per User limit but a limit on calls made by your app. Any individual User can make more than 200 calls per hour using your app, as long as the total calls from your app does not exceed the app maximum. For example, if your app has 100 Users, your app can make 20,000 calls per hour. However, your top ten most engaged Users could make 19,000 of those calls.
    • In case of user-based authentication the requests are counted against that user’s call count the individual user rate limit is kept secret for security reasons.
  • For all the other APIs Requests made by your app to the Instagram Graph API are counted against the app’s call count. An app’s call count is the number of calls during a rolling 24 hour window and is calculated as follows: Calls within 24 hours = 4800 * Number of Impressions, where the Number of Impressions is the number of times any content from your Instagram account entered a person’s screen. This means that users with greater influence have higher caps.

How can I go over these limits?

One option is to relay on unofficial scrappers like LevPasha or realsirjoe or even to write your own scrapper using chromium pupeteer. However all of these methods are subject to detection and ban by Instagram.


  • The Graph API is designed in a very limited manner this limitation is on 2 levels:
    • Based on accessibility: most of the content available in Instagram can’t be extracted using the Graph API, for example, the API doesn’t allow you to get a list of posts of other people, comments and photos on the posts, or get a list of posts with a certain hashtag.
    • Based on rate limits: even for the allowed content, the rate limits depend on the number of users using your app.
  • The ability to create a twitter-like feed from which we can find mentions of a certain brand is limited to tags and mentions of customers this might not be a big issue since people mostly do tag the brand, However, if a full coverage of the text ( mentions of entities outside regular mentions and tags) is needed then a dedicated “Illegal” scraper is needed to get these entities, there are some people how created such scrapers for data science projects. However such project is not sustainable over a long period “lawsuits”

Do you know that we use all this and other AI technologies in our app? Look at what you’re reading now applied in action. Try our Almeta News app. You can download it from Google Play or Apple’s App Store.

Leave a Reply

Your email address will not be published. Required fields are marked *