How to Use Instagram API for Effective Social Media Analytics [2024]

Instagram’s API is complex but essential for marketers. It provides detailed insights to improve brand strategy. This guide shows how to use the Graph API for social media analytics, even with minimal technical knowledge.

Table of Content

There’s no easy way to say this: Instagram’s API is complicated.

One major reason is that Instagram regularly updates its API, leading to frequent changes in features and permissions. 

Additionally, the multiple, unclear documentation pages make it hard to find the right information and use the API effectively.

So, why even bother using the API when the mobile app can give you basic insights?

Why Use Instagram’s API, Anyways?

Instagram is a goldmine for marketers looking to generate leads.

With over 2 billion active users each month and 93% of marketers leveraging it to attract new customers, Instagram is a no-brainer platform for any brand.

If you’re already using Instagram to promote your brand, it’s important to analyze the data from your brand account. 

The Instagram API is a free tool that lets you do just this by analyzing your brand’s data and returning meaningful insights. This helps you see what’s working and what’s not, so you can use it to increase your brand’s online presence and ultimately drive more sales.

However, you don’t need to be a developer or data analyst to operate the API. Luckily, Instagram lets you interact with the API using a no-code tool that’s fairly easy to use.

In this article, we’ll show you how to use Instagram API to dig impactful data from your Instagram account with the minimum possible knowledge. Let’s get started!

What Is Instagram’s API (And Why It’s Ideal For Social Media Analysis)

Instagram’s API allows you to access and analyze insights from your Instagram account. You can use this data further to increase account engagements, improve sales, and make better business decisions.

To perform social media analytics for our Instagram account we’ll be using the Graph API provided by Instagram.

Graph API is good for businesses looking to track key metrics like:

  • Engagement rates on different posts
  • Audience demographics
  • Follower growth
  • Effectiveness of your hashtags

And much much more.

For example, imagine you’re running a fashion brand and want to understand which types of posts resonate most with your audience. This data helps you see which styles or promotions are driving the most interest. 

Now, let’s say you notice that posts about a new shirt collection are getting a lot more likes and comments.

You can double down on these particular posts for this new shirt collection to reach more people’s feeds and drive potential sales.

Prerequisites For Using Instagram’s Graph API

Here are some things you need before starting with the Graph API.

  • If you haven’t already, switch your Instagram account to a Business or Creator account.
  • A Facebook developer account that you can register for here.
  • A basic Facebook app. (Something we’ll cover in this article)
  • You’ll also need a Facebook page that’s connected to this Instagram account. 

We won’t be using the Facebook page. It’s only necessary because we’ll be using the Instagram API with Facebook Login, which requires you to have a page connected to your Instagram account.

A Facebook app is needed so you can generate a unique access token based on the information provided while creating the app.

Don’t worry though, as we’ll still be working solely on your Instagram account.

Setting Up The Graph API [2024]

Registering For A Facebook (Meta) Developers Account

Firstly, we need to register for a Facebook Developers account. To do that:

Here, you’ll need to create a new account or log in using your existing Facebook account.

  • Once done, you’ll automatically be redirected to the following page.
  • If not, you can click the “My Apps” tab here.

Creating A Simple Facebook App

Now, we need to create a simple Facebook app. 

Creating a Facebook app is necessary because it gives you access to the Instagram API and generates the access tokens needed to securely connect to your Instagram account and pull data. 

To do this:

  • Click on the “Create App” button here.
  • Here, you can select the business portfolio from your Facebook account. In our case, we’ll choose the “I don’t want to connect a business portfolio yet” option as we’re using a test account.
  • Next, you will be asked about the kind of app you want to create. If unsure, just select “Other” and click on Next. You can always edit this information later.
  • Select the app type as “Business”.
  • In the final step, add an app name, contact email, and optionally a business portfolio from your Facebook account.
  • Click on the Create app button.

You’ll need to enter your Facebook account’s password to proceed.

Adding Products To Your App

Next, you’ll be shown the following screen where you need to add 2 products to this app:

Instagram & Facebook Login for Business.

  • Firstly, click on the Set up button next to “Instagram”.

  • Once done, simply go back and do the same for “Facebook Login for Business”.

You don’t need to configure anything in these products as of now.

Configuring Permissions & Features [Optional]

The "Permissions and Features" section in a Facebook app controls what data the app can access from Instagram and what actions it can perform. 

It ensures your app only accesses the specific information you need, like viewing posts or insights, while protecting other data.

  • You can access it under App Review > Permissions and Features.

By default, your Facebook app will have basic permissions. To access advanced permissions, you’ll need to request and get approval for those specific permissions.

  • Click the “Request advanced access” and then click the Continue request button at the bottom.

You’ll be asked to verify your business details and provide related business documents. The whole process can take up to 5 days.

You can check the status of your requests under Requests.

Generating And Using Access Tokens In The Graph API

Access tokens allow your app to securely access and retrieve data from your Instagram account, like posts, followers, and insights, based on the permissions you've granted.

To generate an access token:

  • Access your “Graph API Explorer” tool under Tools.

The Graph API Explorer visually lets you interact with the Instagram API by providing a simple, user-friendly interface. 

Once generated, the access token will be automatically used in all the queries that’ll fetch insights for your brand’s Instagram account.

You can select the data you want to access (like posts or follower counts) and see the results instantly on the screen, without writing any code.

  • Here, you’ll need to type and add a “instagram_basic” & “pages_show_list” permission.

Here’s how they will look:

  • Once added, click on the Generate Access Token button here.

You’ll be asked to connect your Facebook account and your brand’s business Instagram account associated with the Facebook page.

Once completed, you'll be redirected back to the Graph API Explorer where you’ll see the following access token generated with the attached permissions (instagram_basic & pages_show_list).

Fetching Insights Related To Your Instagram Business Account

This is where we’ll be performing social media analytics for your brand’s Instagram account.

Here, you can play around with different queries and get data related to your brand’s Instagram account.

As an example, we’ll run a sample query. If we run the: /me?fields=id,first_name here. We’ll get the first name and ID associated with the account:

Similarly, your_id//insights?metric=impressions,reach,profile_views&period=day, will give you detailed insights about the impressions, reach, and other data associated with your business account.

Here’s an example output for the above query:

{
  "data": [
    {
      "name": "impressions",
      "period": "day",
      "values": [
        {
          "value": 32,
          "end_time": "2018-01-11T08:00:00+0000"
        },
        {
          "value": 32,
          "end_time": "2018-01-12T08:00:00+0000"
        }
      ],
      "title": "Impressions",
      "description": "Total number of times the Business Account's media objects have been viewed",
      "id": "instagram_business_account_id/insights/impressions/day"
    },
    {
      "name": "reach",
      "period": "day",
      "values": [
        {
          "value": 12,
          "end_time": "2018-01-11T08:00:00+0000"
        },
        {
          "value": 12,
          "end_time": "2018-01-12T08:00:00+0000"
        }
      ],
      "title": "Reach",
      "description": "Total number of times the Business Account's media objects have been uniquely viewed",
      "id": "instagram_business_account_id/insights/reach/day"
    },
    {
      "name": "profile_views",
      "period": "day",
      "values": [
        {
          "value": 15,
          "end_time": "2018-01-11T08:00:00+0000"
        },
        {
          "value": 15,
          "end_time": "2018-01-12T08:00:00+0000"
        }
      ],
      "title": "Profile Views",
      "description": "Total number of users who have viewed the Business Account's profile within the specified period",
      "id": "instagram_business_account_id/insights/profile_views/day"
    }
  ]
}

Note: Some insights may not be available for accounts having less than 100 followers.

You can check out Meta’s official documentation to get more queries to dig out more insights. Here are the relevant pages.

Ready to Simplify Your Instagram Analytics?

Struggling with Instagram’s complex API? Phyllo is here to help. 

Phyllo’s API makes it easy to access detailed Instagram data, including stories, influencer insights, and much more.

Focus on growing your brand while Phyllo handles your data.

Download our detailed guide on how to leverage Instagram Stories for influencer marketing

Download Now
Pratik Haldankar
Pratik is a B2B tech writer specializing in SaaS, E-commerce, and Cloud. He helps startups and agencies drive traffic and grow 2x organically with effective content creation.

Be the first to get insights and updates from Phyllo. Subscribe to our blog.

Ready to get started?

Sign up to get API keys or request us for a demo

/*