Log inStart Free Trial
easyCoexistence Official APIs

Instagram hashtag search API: finding posts by hashtag

Instagram's hashtag search finds public photos and videos that carry a hashtag, in two calls. GET /ig_hashtag_search with user_id and q returns the hashtag's ID, then GET /<HASHTAG_ID>/top_media lists the most popular posts and /recent_media those published in the last 24 hours. An account can query 30 unique hashtags in a rolling 7 days, with Facebook Login or Unified Login.

easyCoexistence connects Instagram with Instagram Login, so Claude, ChatGPT or your own code works on the account's own posts, comments, mentions and insights through Meta's official API, and its comments and mentions can be forwarded to your endpoint as they arrive.

30

Unique hashtags one business or creator account can query in a rolling 7-day period.

24 hours

recent_media returns only media published within 24 hours of the query.

50

Most results per page from top_media, which pages with an after cursor only.

Not supported

Hashtag search with the Instagram API with Instagram Login, in Meta's comparison of the three setups.

Static

Hashtag IDs are static and global: a hashtag keeps the same ID for each app and user.

How does hashtag search work?

In two steps, made on behalf of an Instagram business or creator account whose ID goes in user_id. GET /ig_hashtag_search with q set to the hashtag's name returns its ID, which Meta says is static and global, so it can be stored. GET /<HASHTAG_ID>/top_media or /recent_media, with user_id and fields, then lists the posts.

Finding a hashtag's ID, then its recent posts
GET /ig_hashtag_search?user_id=<IG_ID>&q=coffee

{ "data": [ { "id": "<HASHTAG_ID>" } ] }

GET /<HASHTAG_ID>/recent_media
  ?user_id=<IG_ID>
  &fields=id,media_type,permalink,timestamp,like_count,comments_count

What is the difference between top_media and recent_media?

top_media returns the most popular photos and videos tagged with the hashtag, where Meta judges popularity by a mix of views and viewer interaction. recent_media returns the most recently published ones, limited to media published within 24 hours of the query, and Meta notes that its responses are not always in chronological order. Both return public media only, leave out promoted, boosted and ad media, and page through results 50 at a time with an after cursor.

Which fields come back?

The media fields Meta's references list for both edges, which return public photos and videos only:

  • id, media_type (CAROUSEL_ALBUM, IMAGE or VIDEO), permalink and timestamp.
  • caption and comments_count, plus like_count unless the owner has hidden like counts.
  • children for album media, and media_url for other media, though not for videos with copyrighted or licensed audio.
  • Not username: Meta does not allow it on media returned by hashtag search.

What are the limits?

Meta sets them per account and per hashtag:

  • 30 unique hashtags in a rolling 7 days. A hashtag counts from its first query; querying it again in that time is free and does not restart its 7 days.
  • Fetching top_media or recent_media counts as querying the hashtag, even when its ID is already stored.
  • GET /<IG_ID>/recently_searched_hashtags lists the unique hashtags the account has searched in the current week.
  • Hashtags on Stories and emojis in queries are not supported, and hashtags Meta deems sensitive or offensive return a generic error.
  • Media found this way cannot be commented on through the API.

What does hashtag search need?

App Review approval for the Instagram Public Content Access feature and the instagram_basic permission, which Meta requires before an app can use it, and a user access token from Facebook Login for a person who can perform tasks on the linked Page, or a Unified Login token. Meta's overview lists hashtag search as not supported with Instagram Login, and its calls fall under Meta's Platform rate limits rather than Instagram's per-account call budget. The allowed uses Meta lists include finding content from your hashtag campaigns, understanding public sentiment about your brand and identifying contest entrants.

Can you search hashtags through easyCoexistence?

easyCoexistence connects Instagram with Instagram Login, which reaches the connected account's own posts, comments, mentions and insights. Meta offers hashtag search with Facebook Login and Unified Login only, so it is outside this connection. What the connection covers instead: the account's own posts through list_social_posts, and its comments and mentions, forwarded to your endpoint as they arrive.

Common mistakes

  • Spending the weekly quota on tests. Each new hashtag counts toward the 30 for 7 days, and fetching its media counts even with a stored ID.
  • Requesting username on hashtag results. Meta does not return it for media found through hashtag search.
  • Reading recent_media as an archive. It covers media published in the 24 hours before the query, and not in strict chronological order.
  • Calling it with an Instagram Login token. Meta marks hashtag search not supported in that setup.
Doing this with EasyCoexistence

US$ 9 to US$ 0.75 per connection per month, falling as you add connections, with the first 3 days free.

easyCoexistence is a multichannel API and MCP server that connects AI agents such as Claude and ChatGPT to WhatsApp, Instagram, TikTok, Facebook and more. On WhatsApp it uses Coexistence: the business keeps using its number in the WhatsApp Business app while the AI works through Meta's official API.

Frequently asked questions

Can the Instagram API search hashtags without App Review?

No. Meta requires App Review approval for the Instagram Public Content Access feature and instagram_basic before an app can call hashtag search.

Can I see who posted with a hashtag?

Not by username, which Meta leaves out of hashtag results. Each post's permalink opens it on Instagram.

Does hashtag search include Stories?

No. Meta does not support hashtags on Stories, and both edges return public photos and videos.

Does querying the same hashtag again count twice?

No. Repeat queries within its 7 days do not count against the 30 and do not restart the hashtag's timer.

Keep reading

Connect your first channel in two minutes.

No platform reviews to wait for. Connect WhatsApp, Instagram, TikTok or another channel, then ask your AI to post, reply or report, and watch it work.

  • 3 days free
  • Cancel any time
  • Official APIs only
  • Monitored 24/7

Verified on