This post may be a bit outdated. Try these instead:
Instagram is pretty dang popular.
According to its press page, Instagram has over 500 million users and receives 95 million video and photo uploads daily.
Now that they’ve added live and ephemeral video 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…
Credit: @AurelyCerise
https://rapidapi.com/collection/instagram-apis
https://rapidapi.com/v.sobolev/api/Instagram
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.
Client ID
and Client Secret
Here’s what that process should look like.
Now, we’ll need to generate an access_token
. While you can technically use your Client ID
and Client Secret
to call the Instagram.getAccessToken
method, we made the process a little easier with this access_token
generator. Here’s what you need to do.
access_token
Again, here’s a GIF for your viewing pleasure.
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 package page 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 endpoints require them.
What is the Instagram API?
As of June 2016, Instagram restricted a lot of access 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.
In order to enforce these new rules, Instagram has created multiple scopes for OAuth access tokens as well as a Sandbox mode.
While older versions of the Instagram API only required a client_id
, now all requests require an access_token
. Each access_token
generated will have a scope associated with it. Scopes define what an access_token
can and cannot be used for.
When you register an app on Instagram, you’ll get an access token with basic
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 mediaNeeds additional permission:
public_content
– to read any public profile info and media on a user’s behalffollower_list
– to read the list of followers and followed-by userscomments
– to post and delete comments on a user’s behalfrelationships
– to follow and unfollow accounts on a user’s behalflikes
– to like and unlike media on a user’s behalfIn order to get the additional scopes outside of basic
, you’ll need to submit your app for review with Instagram directly. To see what endpoints of the Instagram API require permissions, jump down to our section on functionalities and scopes.
Another way Instagram monitors new 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:
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.
To see each Instagram API endpoint and it’s parameters (including access_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
– requires public_content
scopesearchUser
– requires public_content
scopegetUsersFollows
– requires follower_list
scopegetUsersFollowers
– requires follower_list
scopegetUsersRequestedBy
– requires follower_list
scopegetRelationshipToUser
– requires relationships
scopefollowerUser
– requires relationships
scopeunfollowUser
– requires relationships
scopeapproveUserRequest
– requires relationships
scopeignoreUserRequest
– requires relationships
scopeThat’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.
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.
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.
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.
We're thrilled to announce the latest update to the Rapid Enterprise API Hub (version 2024.3)!…
Are you curious about what your API consumers are searching for? Is your Hub effectively…
The RapidAPI team is excited to announce the February 2024 update (version 2024.2) for the…
This January's release brings exciting features and improvements designed to empower you and your developers.…
Rapid API is committed to providing its users with the best possible experience, and the…
In today's fast-paced digital world, APIs (Application Programming Interfaces) have become the backbone of modern…
View Comments
Hi,
I want to gather all comments about special hashtag. Can you help me? The number of collected comments are note very important for me.
this post is outdated
hi i want to instagram live api
can help me
Unfortunately this article is outdated, and in need of updates
We are currently trying to get a list of followers for purposes of analysing cross-marketing between influencers however FB developer has made it hard to even find this information, on the endpoints to use, our application is currently in testing mode or phase and should be able to use the endpoints however nothing is mentioned on their documentation or pointing out that a user would need additional permissions in order to perform these tasks is it possible that these features have been discontinued??
Nice