Search code examples
androidiphonewindows-phone-8instagraminstagram-api

Instagram “You Cannot Like this Media” 400 status code


I am aware that the Instagram API was down a few hours ago, but it seems to be back up now. The problem is, when we post data to Instagram saying to like a specific photo, we get this error:

{"meta":{"error_type":"APINotAllowedError","code":400,"error_message":"you cannot like this media"}} We have gotten this error before, but we don't understand why we are getting it. Keep in mind, we logged into an alternate account which means that account hasn't even liked the media yet.

If it helps at all to know, we are running the like command by requesting the url https://api.instagram.com/v1/media/{media-id}/likes with {media-id} being replaced by the image id, and we are including the user's access token in the body of the http request. This is obviously a post request

There is no Instagram documentation on why we would get this message. Does anyone have a solution?


Solution

  • I've run into the same thing and I found that there were three cases where I received this error:

    1. The photo has been deleted. If you are caching media data and trying to like it later this could come up.
    2. The user is private. You can't like a photo if the user is private and they haven't given you permission to follow them.
    3. You've done too much liking with the public API. If you try to like a photo and find that it's neither deleted nor is the user private, then Instagram has put a temporary ban on your account from liking via the api. I'm not sure what triggers this other than excessive liking. You'll need to wait up to a week without making any high-volume likes via that access token for the timeout to expire (although you can to a test every once in a while to see if this timeout has expired).