Instagram API

Apps created on or after Nov 17, 2015 will start in Sandbox Mode and function on newly updated API rate-limits and behaviors. Prior to going Live, and being able to be used by people other than the developers of the app, these apps will have to go through a new review process.

Go to and login to your Instagram account. If you don’t already have one you have to sign up for Instagram via a mobile app and not the desktop browser.

Once you have logged in, click on Manage Clients (top right hand corner)
Then Register a new Client.

Once you have done this you will be given a Client ID and Client Secret.

Before you can go any further, in order to connect to the Instagram API you need to generate an access token using your secret developer key. There are a couple of ways to do this but I found the most simplest way on this website:

I go to this URL (replacing MY-CLIENT-ID with my actual client ID):

It then returns the access token:

I found this python script here: and I have updated it to work in the sandbox.

from time import sleep
from instagram.client import InstagramAPI

api = InstagramAPI(access_token=access_token,
recent_media, url = api.tag_recent_media(tag_name=”coding”, count=5) # 1

for media in recent_media:
# Where the media is
id_ =
# List of users that like the image
users = [user.username for user in media.likes]
# If you have already like the picture, do nothing
print(“IN PHOTO”)

# If you haven’t liked the photo then do it

# Sleep to make instagram stop complaining

print (“Done”)

Be the first to comment

Leave a Reply

Your email address will not be published.