Search code examples
instagraminstagram-api

instagram username search not match with query


I am calling instagram's API with this URL

https://api.instagram.com/v1/users/search?q=mtv&count=1&client_id=add38d4ea81e4665962b939c96a929a3&count=1

It's supposed to respond with the username 'mtv' as specified in the q parameter, but the JSON response returns the username 'mtvbrasil'

{"meta":{"code":200},"data":[{"username":"mtvbrasil","profile_picture":"https:\/\/instagramimages-a.akamaihd.net\/profiles\/profile_43768325_75sq_1380500869.jpg","id":"43768325","full_name":"MTV Brasil"}]}

Solution

  • Instagram's search API does not work as expected! It does not always return the same results as their mobile client returns.

    Try adding double quotes to your search term:

    https://api.instagram.com/v1/users/search?q="mtv"&count=1&client_id=add38d4ea81e4665962b939c96a929a3

    In other cases it might not return your best match as the first result, so you might need to not provide a count parameter and check all the results for your more desired match.