How to Connect to Instagram's API in 3 Easy Steps [Tutorial] | RapidAPI (2024)

This post may be a bit outdated. Try these instead:

  • How to use the Instagram API with JavaScript
  • How to use the Instagram API with PHP
  • How to use the Instagram API with Python
  • How to use the Instagram API with Ruby

Instagram is pretty dang popular.


View the Best Instagram APIs

According to its press page, Instagram has over 500 million users and receives 95 million video and photo uploadsdaily.

Now that they’ve added live and ephemeralvideo features, that number should only get bigger.

However, connecting to the Instagram API to build stuff can be a pain in the…app (#punintended).

This article will go through…

  • How to connect to (and use) the Instagram API quickly and easily (go here)
  • What you can and can’t build with the Instagram API (go here)
  • A list of which functionalities that require additional permissions(go here)

How to Connect to Instagram's API in 3 Easy Steps [Tutorial] | RapidAPI (1)

Credit: @AurelyCerise

You might like these APIs:

https://rapidapi.com/collection/instagram-apis

https://rapidapi.com/v.sobolev/api/Instagram

How to Connect to the Instagram API

To get started with using the Instagram API:

Here’s how to connect to the API and start making calls.

Here’s a step-by-step summary of what was on the video.

Step 1: Create a Instagram Developer Account

  1. Go to Instagram developer page
  2. Click on Register Your Application
  3. Click on Register a New Client
  4. Fill the form and click on Register
  5. Go to Clients manager.
  6. Click on Manage in your application block.
  7. Copy and save your credentials:Client ID and Client Secret

Here’s what that process should look like.

How to Connect to Instagram's API in 3 Easy Steps [Tutorial] | RapidAPI (2)

Step 2: Generate an Access Token

Now, we’ll need to generate an access_token. While you can technically use yourClient ID and Client Secretto call theInstagram.getAccessToken method, we made the process a little easier with thisaccess_tokengenerator.Here’s what you need to do.

  1. Click Manage on the Instagram developer client tab
  2. Go to the Security tab
  3. Add the following URL:https://rapidsoftwaresolutions.github.io/OAuthTokenGenerator/instagram/2.html
  4. Uncheck the box “Disable implicit Auth”
  5. Save
  6. Copy your client ID
  7. Paste it in the “generate” tab on thethe generator toolto get anaccess_token

Again, here’s a GIF for your viewing pleasure.

How to Connect to Instagram's API in 3 Easy Steps [Tutorial] | RapidAPI (3)

Step 3:Call the Instagram API with RapidAPI

Now, we’ll call the API! We’ll use RapidAPI since we can export code snippets in multiple languages (NodeJS, Python, PHP, Java, Objective-C, cURL) and make the API call directly from the browser. Go ahead and visit the RapidAPI Instagram packagepage to try it for yourself.

You’ll notice that some functions will return an error regarding access_token scopes and permissions. Read on for what these scopes are and which instagram api endpointsrequire them.

Instagram API: What You Can and Can’t Build

What is the Instagram API?
As of June 2016, Instagramrestricted a lot ofaccess to their API. While this was likely a business decision on their part to increase Instagram downloads over third-party apps, Instagram’s change makes it trickier to know what you can and can’t build as a developer.

Here are the three types of apps that Instagram says that it can support in their announcement.

  1. Apps that help individuals share their own content with 3rd party app
  2. Apps that help brands and advertisers understand and manage their audience and media rights
  3. Apps that help broadcasters and publishers discover content, get digital rights to media, and share media with proper attribution

In order to enforce these new rules, Instagramhas created multiple scopesfor OAuth access tokens as well as a Sandbox mode.

OAuth Access TokenScopes

While older versions of the Instagram API only required a client_id, nowall requests require an access_token. Eachaccess_tokengenerated will have a scope associated with it.Scopes define what anaccess_tokencan and cannot be used for.

When you register an app on Instagram, you’ll get an access token withbasic authorization, which means that you will be able to read a user’s profile info and media. Other API functions require additional permission. Here’s the breakdown of the token authorizations:

Given:

  • basic – to read a user’s profile info and media

Needs additional permission:

  • public_content – to read any public profile info and media on a user’s behalf
  • follower_list – to read the list of followers and followed-by users
  • comments – to post and delete comments on a user’s behalf
  • relationships – to follow and unfollow accounts on a user’s behalf
  • likes – to like and unlike media on a user’s behalf

In order to get the additional scopes outside of basic, you’ll need tosubmit your app for reviewwith Instagram directly. To see what endpoints of the Instagram API require permissions, jump down to our section on functionalities and scopes.

Sandbox Mode

Another way Instagram monitorsnew developments is by introducing a Sandbox mode. Before an app can go live, it must go through Sandbox mode. This mode allows Instagram to review your app to see if it meets one of its three uses cases (jump to section).

The most important things to know about Sandbox mode are as follows:

  • Limited content:Sandbox mode only displays 20 posts of whatever users are uploaded manually into the app.
  • Limited users:You can invite up to 10 users into Sandbox mode. The app will let them display only their most recent 20 posts as well.

Sandbox mode can be a little confusing. Here’s one point of clarification that we’ve found people get stuck on. You can request additional access_token scopes from within Sandbox mode; you don’t need to go live to request them.

Need more info? We’ve found this article by Emerson This to be extremely helpful.

Instagram APIEndpoints by Required Access Token Scope

To see each Instagram API endpoint and it’s parameters (includingaccess_token scope required ), visit this page on the Instagram developer portal.

For RapidAPI’s endpoints, here are the ones that require a specific access_token scope.

  • getCurrentUserLikedMedia– requirespublic_contentscope
  • searchUser– requirespublic_contentscope
  • getUsersFollows– requiresfollower_listscope
  • getUsersFollowers– requiresfollower_listscope
  • getUsersRequestedBy– requiresfollower_listscope
  • getRelationshipToUser– requiresrelationshipsscope
  • followerUser– requiresrelationshipsscope
  • unfollowUser– requiresrelationshipsscope
  • approveUserRequest– requiresrelationshipsscope
  • ignoreUserRequest– requiresrelationshipsscope

That’s about it! Let us know in the comments if you have any questions or if you have a project to share regarding the Instagram API.


View the Best Instagram APIs

FAQ

Does Instagram have an API?

Yes, you can find the official documentation at https://www.instagram.com/developer/, or browse multiple Instagram APIs at https://rapidapi.com/collection/instagram-apis.

What data can I get from the Instagram API?

The API can be used to get their media, manage and reply to comments on their media, identify media where they have been @mentioned by other Instagram users, find hashtagged media, and get basic metadata and metrics about other Instagram Businesses and Creators.

How do I get access to Instagram APIs on RapidAPI?

Easy, simply navigate to rapidapi.com, sign up for a free account, search for 'Instagram APIs' and test those APIs directly in your browser. Copy the code snippets and integrate them into your website or app.

4.8/5 - (192 votes)

How to Connect to Instagram's API in 3 Easy Steps [Tutorial] | RapidAPI (2024)
Top Articles
Latest Posts
Article information

Author: Jamar Nader

Last Updated:

Views: 6084

Rating: 4.4 / 5 (75 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Jamar Nader

Birthday: 1995-02-28

Address: Apt. 536 6162 Reichel Greens, Port Zackaryside, CT 22682-9804

Phone: +9958384818317

Job: IT Representative

Hobby: Scrapbooking, Hiking, Hunting, Kite flying, Blacksmithing, Video gaming, Foraging

Introduction: My name is Jamar Nader, I am a fine, shiny, colorful, bright, nice, perfect, curious person who loves writing and wants to share my knowledge and understanding with you.