400 error - Instagram API - Fetching media items based on Hashtags in Sandbox mode

575 Views Asked by At

I try to fetch photos based on hashtags using Instagram API(Sandbox mode). Using below API

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 if I use https://api.instagram.com/v1/users/self/media/recent/?access_token=<My Access Token> then its returning recent 20 media items.

In my sandbox I have authenticated 1 more user but I am not getting any media items other than mine. I am following the official documentation of Instagram API.

Please provide your inputs for this behavior.

1

There are 1 best solutions below

0
Krystian On

/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:/