Skip to content
Back to Blog

APINovember 26, 20266 min read

Instagram hashtag API: how to get posts and accounts by hashtag

The official API can read the posts under a hashtag, within tight limits. It cannot tell you who posted them. How Hashtag Search works step by step and what to use when you need the accounts.

A hashtag is a ready-made audience: people who post about coffee, crossfit or wedding photography tag their posts with it. This guide shows what the official Instagram hashtag API returns, as read in Meta's documentation on November 26, 2026, the limits that come with it and how to get the accounts behind a hashtag when the posts are not enough.

How Hashtag Search works

Getting posts by hashtag takes two calls. The first turns the hashtag name into an ID:

Step 1: hashtag name to hashtag ID
curl -G "https://graph.facebook.com/v27.0/ig_hashtag_search" \
  --data-urlencode "user_id=YOUR_IG_USER_ID" \
  --data-urlencode "q=coffee" \
  --data-urlencode "access_token=YOUR_ACCESS_TOKEN"

# { "data": [ { "id": "17843857450040591" } ] }

The second reads the posts tagged with it, either the most popular or the most recent:

Step 2: top or recent posts for that hashtag
curl -G "https://graph.facebook.com/v27.0/HASHTAG_ID/top_media" \
  --data-urlencode "user_id=YOUR_IG_USER_ID" \
  --data-urlencode "fields=id,caption,media_type,permalink,like_count,comments_count,timestamp" \
  --data-urlencode "access_token=YOUR_ACCESS_TOKEN"

# replace top_media with recent_media for posts from the last 24 hours

The user_id is the ID of your own Instagram professional account: Meta counts every query against it. Getting the token is covered in the Instagram API key and access token guide.

What you get back

EdgeReturnsGood to know
top_mediaThe most popular posts tagged with the hashtagCapped at 200 results per query from February 16, 2027
recent_mediaPosts tagged with the hashtag in the last 24 hoursNot always in chronological order

Each post comes with its ID, caption, media type, media URL, permalink, like and comment counts and timestamp. Pages hold up to 50 posts. Promoted posts and ads are left out. The author is not in the list: Meta's documentation states that the username field cannot be requested on these posts. No profile, no follower count. You see what people post under a hashtag. Who posted it stays hidden.

The limits

  • 30 unique hashtags per rolling 7 days for each Instagram account making the queries. Reading top_media or recent_media counts as a query, even with an ID you already have.
  • Hashtags with emojis are not supported. Hashtags Meta deems sensitive return a generic error.
  • App Review for the Instagram Public Content Access feature before you can query hashtags for real.
  • Facebook Login or Unified Login only. Apps built on Instagram Login have no Hashtag Search.
  • Calls follow the platform rate limit: 200 x the number of users of your app, per hour.
  • From February 16, 2027, Meta caps a top_media query at 200 results.

Every rate limit and access level of the official API is gathered in the Instagram API limits guide.

Getting the accounts behind a hashtag

For lead generation, influencer sourcing or market research, the posts are a means: what you want is the list of accounts that use the hashtag, with their bio, follower count and the email or phone they show publicly. A data API reads public profiles the way a visitor would and returns them as rows, personal accounts included. With the IGLeads API it is one call:

Accounts posting under two hashtags, bio mentioning a word
curl -X POST https://api.igleads.ai/v1/leads/hashtag \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "hashtags": ["specialtycoffee", "coffeeroaster"], "limit": 500, "filters": { "bioKeywords": ["roastery"] } }'

# then GET /v1/leads/jobs/{id} until it is done, then /v1/leads/jobs/{id}/results
Official Hashtag SearchIGLeads API
What it returnsPostsAccounts with their public profile fields
Author of each postNoYes
Public email or phoneNoYes, when the profile shows one
Hashtags per week30 per accountNo weekly cap
SetupMeta app, App Review, professional accountAn API key

API access is included in the Business plan ($199 a month) and the Scale plan ($399 a month), with up to 10 searches running at the same time. One credit is spent per lead with an email found. The same call in Python is in the Instagram API with Python guide. The other ways to search Instagram by API are in the Instagram search API guide.

Frequently asked questions

Does Instagram have a hashtag API?

Yes. Hashtag Search in the official Instagram API turns a hashtag name into a hashtag ID. You then read the top media or the recent media tagged with it. It needs an app with Facebook Login, App Review for Instagram Public Content Access and an Instagram professional account on your side.

How many hashtags can I query with the Instagram API?

30 unique hashtags per rolling 7 days for each Instagram account that makes the requests. Querying the same hashtag again within that window does not count twice.

Can I get the username of the people who posted under a hashtag?

Not from the official API. The media returned by top_media and recent_media do not include the username or the profile of their author. A data API returns the accounts behind a hashtag with their public profile fields.

How far back does recent_media go?

recent_media only returns posts published in the last 24 hours. For older posts you are left with top_media, which returns the most popular ones.

Ready to extract Instagram leads?

See 25 leads from your own target free. Unlock them from $19, no subscription needed.

Free preview of 25 leads. No Instagram login, no card. View pricing