Instagram API returns error when try to fetch media items based on hashtags

I try to fetch the media items(photos) based on hashtags using Instagram API. Currently my app runs in sandbox mode. When i try to fetch the results from API endpoint from using the link

https://api.instagram.com/v1/tags/awesome/media/recent?access_token=<My Access token>

I am getting the error

> {"meta": {"code": 400, "error_type": "OAuthPermissionsException",
> "error_message": "This client has not been approved to access this
> resource."}}

But when i try https://api.instagram.com/v1/users/self/media/recent/?access_token=<My Access Token> I am getting all my recent media items (total 20 since i am in sandbox mode)

In my sandbox i have authenticated 1 more user but i am not getting any hashtags based media items from any account. I am following the official documentation of Instagram API.

What could be the reason for this behavior and how can i get posts based on hashtags?

1 answer

  • answered 2018-05-16 16:03 Astaz3l

    /tags endpoints requires public_content scope enabled for your app. Without it you will not be able to use this endpoint. To be honest right now it is not possible to submit your app for review if you want to have public_content permission. Old Instagram API accepts apps for review only for basic scope. You should try to switch to Facebook Graph API, but please keep in mind that right now it supports only Instagram Business Accounts.

    You can try to filter out media that does not contain the tag you wish in response from /self/media/recent endpoint. I know, not the best solution:/