Find public IG Media that has been tagged with specific hashtags.
In order to use this API, you must undergo App Review and request approval for:
Instagram Public Content Access
featureinstagram_basic
permissionThe Hashtag Search API consists of the following nodes and edges:
GET /ig_hashtag_search
— to get a specific hashtag's node IDGET /{ig-hashtag-id}
— to get data about a hashtagGET /{ig-hashtag-id}/top_media
— to get the most popular photos and videos that have a specific hashtagGET /{ig-hashtag-id}/recent_media
— to get the most recently published photos and videos that have a specific hashtagGET /{ig-user-id}/recently_searched_hashtags
— to determine the unique hashtags an Instagram Business or Creator Account has searched for in the current weekRefer to each endpoint's reference documentation for supported fields, parameters, and usage requirements.
To get all of the photos and videos that have a specific hashtag, first use the /ig_hashtag_search
endpoint and include the hashtag and ID of the Instagram Business or Creator Account making the query. For example, if the query is being made on behalf of the Instagram Business Account with the ID 17841405309211844
, you could get the ID for the "#coke" hashtag by performing the following query:
GET graph.facebook.com/ig_hashtag_search ?user_id=17841405309211844 &q=coke
This will return the ID for the “#Coke” hashtag node:
{ "id" : "17873440459141021" }
Now that you have the hashtag ID (17873440459141021
), you can query its /top_media
or /recent_media
edge and include the Business Account ID to get a collection of media objects that have the “#coke” hashtag. For example:
GET graph.facebook.com/17873440459141021/recent_media ?user_id=17841405309211844
This would return a response that looks like this:
{ "data": [ { "id": "17880997618081620" }, { "id": "17871527143187462" }, { "id": "17896450804038745" } ] }