Search code examples
apitokeninstagraminstagram-api

Get media from public accounts with instagram API


I'm working for a company that displays content on big screens located on public places like GYMs or waiting rooms.

One client asked app that shows Instagram content from celebrities accounts, so I created one using the Instagram API.

The problem is that the app is in sandbox mode and it gets blank data.

It seems I can only show media from sandbox users (not Beyonce), when I submitted for review it was rejected because it doesn't meet the requirements.

Is there a way to make it work?

During tests I used a valid access token I found on internet, but I don't think that is a valid solution.


Solution

  • You are correct, when app is in sandbox mode you are only able to see data on Instagram from sandbox users which you have set in advance. You won't get any public data on Instagram in this mode.

    According to the API, your app doesn't have the criteria required to get approved.

    From the Permissions Review page:

    Valid Use Cases

    We will approve submissions of apps that fall into these use cases:

    • To help individuals share their own content with 3rd party apps
    • To help brands and advertisers understand and manage their audience and digital media rights
    • To help broadcasters and publishers discover content, get digital > rights to media, and share media with proper attribution

    They also listed use cases of applications that won't get approval and it seems like your app matches one of them:

    Here are some examples of scenarios that will not be approved:

    • One-off projects. If you are an agency building websites or other integrations, note that we don't grant permissions to clients created for one-off projects. If you are interested in building a product, platform, or widget that will be used as a service across multiple projects, then you may submit a single client_id that you can use across multiple projects
      ...

    To get approved you should modify your application to correspond with criteria, perhaps build multiple projects?

    You can also try to pull down the data from this URL: https://www.instagram.com/<username>/media/

    For Beyonce account, use: https://www.instagram.com/beyonce/media/

    Lastly, the access token is unique per-app, so you can't be using a random one. Here is a tutorial on how to generate access token for your app.