# Instagram Hashtag Search API: Get Posts by Hashtag

Use the Instagram hashtag search API: ig_hashtag_search, top_media and recent_media, the 30-hashtag weekly limit, Public Content Access, and the fields you get.

Canonical page: https://www.tryadeli.com/blog/instagram-hashtag-search-api
Last updated: 2026-10-26

By Mika Reyes, Co-founder, Adeli. Published 2026-10-26.

## The short answer

The Instagram hashtag search API is two calls in the Instagram Graph API: ig_hashtag_search turns a hashtag into an ID, then top_media or recent_media returns public posts that use it. It needs the Facebook Login version of the API, App Review for the Instagram Public Content Access feature, and the instagram_basic permission. Each account can query 30 unique hashtags per rolling 7 days.

**The Instagram hashtag search API is a two-step flow in the Instagram Graph API: `GET /ig_hashtag_search` turns a hashtag into a hashtag ID, then `GET /{hashtag-id}/top_media` or `/recent_media` returns public posts that use it.** Every call runs on behalf of an Instagram professional account, and that account can query **30 unique hashtags per rolling 7 days**.

Access is the hard part. Hashtag search needs the Facebook Login version of the API and App Review for a feature called **Instagram Public Content Access**. For the rest of the platform, see our [Instagram API](https://www.tryadeli.com/blog/instagram-api-guide) guide.

## What do you need before you start?

**Hashtag search needs Facebook Login, an approved feature, and one permission.** Per Meta's [hashtag search guide](https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/hashtag-search):

- **The right API version.** Meta documents hashtag search for the Instagram API with Facebook Login and with Unified Login. Calls go to `graph.facebook.com`.
- **Instagram Public Content Access.** A feature, not a permission, that your app requests in App Review.
- **`instagram_basic`.** Also through App Review. If the user's Page role was granted through Business Manager, add one of `ads_management`, `business_management`, or `pages_read_engagement`.
- **A User access token** from a Facebook user approved for tasks on the Page linked to the Instagram account.
- **The IG user ID** of that professional account. Every hashtag call takes it as `user_id`.

**Instagram Login can't do this.** Meta now steers new apps toward the Instagram Login version. Charles Jiang and Sairaj Bharath Yalamanchili wrote on the [Meta for Developers blog](https://developers.facebook.com/blog/post/2024/07/30/instagram-api-with-instagram-login/) on July 30, 2024:

> "We recommend using Instagram API with Instagram Login to take advantage of these latest updates."

That advice holds for publishing, comments, and messaging. If hashtag search is on your roadmap, though, plan for Facebook Login from the start, since switching later means your users reconnect. Our [Instagram API permissions](https://www.tryadeli.com/blog/instagram-api-permissions) post compares the two permission sets.

## Step 1: Get the hashtag ID with ig_hashtag_search

**Call `ig_hashtag_search` with your IG user ID and the hashtag name, without the `#`.**

```bash
curl -G "https://graph.facebook.com/v26.0/ig_hashtag_search" \
  --data-urlencode "user_id=<IG_USER_ID>" \
  --data-urlencode "q=coffee" \
  --data-urlencode "access_token=$FB_USER_ACCESS_TOKEN"
```

The response is a list with one ID:

```json
{ "data": [{ "id": "17843857450040591" }] }
```

**Cache the ID.** Meta's [ig_hashtag_search reference](https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/ig-hashtag-search) says hashtag IDs are "both static and global", so the same hashtag has the same ID for every app and every user. Caching it saves a call, but it doesn't save quota: fetching media for a hashtag still counts as querying it.

Two inputs fail: **emojis aren't supported** in hashtag queries, and hashtags Meta deems sensitive or offensive return a generic error.

## Step 2: Get posts by hashtag with top_media or recent_media

**Request `top_media` for the most popular posts, or `recent_media` for posts from the last 24 hours, with `user_id` and a `fields` list.**

```bash
curl -G "https://graph.facebook.com/v26.0/17843857450040591/recent_media" \
  --data-urlencode "user_id=<IG_USER_ID>" \
  --data-urlencode "fields=id,caption,media_type,media_url,permalink,timestamp,like_count,comments_count,children{media_url}" \
  --data-urlencode "limit=50" \
  --data-urlencode "access_token=$FB_USER_ACCESS_TOKEN"
```

| | `top_media` | `recent_media` |
|---|---|---|
| **Returns** | The most popular public photos and videos with the hashtag | Public photos and videos published within 24 hours of the query |
| **Order** | By popularity | Not always chronological, per Meta |
| **Page size** | Up to 50 per page | Up to 50 per page |
| **Cursors** | `after` only | `after` only |
| **Reference** | [top_media](https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/ig-hashtag/top-media) | [recent_media](https://developers.facebook.com/docs/instagram-platform/instagram-graph-api/reference/ig-hashtag/recent-media) |

**Pagination is unusual.** Both edges return only an `after` cursor, and Meta notes its value stays the same on every page. Keep following `paging.next` until it disappears.

**`recent_media` only covers the last 24 hours.** To collect every post with a hashtag over a week, poll it during the week and dedupe by `id`. You can't backfill.

## Which fields does hashtag search return?

**Hashtag search returns a short list of IG Media fields, and `username` isn't one of them.** Per Meta's references, you can request:

| Field | Notes |
|---|---|
| `id` | The media ID |
| `caption` | The caption text |
| `media_type` | `IMAGE`, `VIDEO`, or `CAROUSEL_ALBUM` |
| `media_url` | Not returned for carousel albums; omitted for video with copyrighted or licensed audio |
| `children` | Carousel albums only; use it to get each item's `media_url` |
| `permalink` | The post's public URL |
| `timestamp` | Creation time in UTC |
| `like_count` | Omitted when the owner hides like counts |
| `comments_count` | Comments on the post |

**You can't request `username`**, so a hashtag feed can't show who posted without the user opening the permalink. You also **can't comment on posts found through hashtag search**, per Meta's guide.

## What are the Instagram hashtag search API limits?

**The main limit is 30 unique hashtags per Instagram account in any rolling 7-day window.** Meta's guide sets out how it counts:

- **Per account, not per app.** The 30 belong to the Instagram professional account in `user_id`.
- **Unique hashtags.** Querying the same hashtag again within 7 days doesn't count again.
- **Media fetches count.** Calling `top_media` or `recent_media` counts as querying that hashtag, even with a cached ID.
- **Track usage.** `GET /{ig-user-id}/recently_searched_hashtags` lists the unique hashtags the account searched in the current week.

Other limits from the references:

- **Public posts only.** No private accounts.
- **No promoted posts.** Boosted and ad media are excluded.
- **No Stories.** Hashtags on Stories aren't supported.
- **Rate limits still apply.** Every call also counts toward the app's call budget for that account; see our [Instagram API rate limit](https://www.tryadeli.com/blog/instagram-api-rate-limit) guide.

**Design for 30.** If your product lets customers track hashtags, make 30 per connected account a visible limit in your UI, and show what's left from `recently_searched_hashtags`.

## Can the Instagram API get posts from an account instead of a hashtag?

**Yes, for accounts that authorized your app, and for other Business or Creator accounts through business discovery.** Hashtag search is for discovery across public posts. To read one account's feed, use the media edge, covered in our guide to [getting Instagram posts with the Graph API](https://www.tryadeli.com/blog/instagram-api-get-posts).

## Where does Adeli fit?

**Adeli's documented API doesn't include hashtag search; it covers the accounts your users connect.** If your product needs hashtag discovery, the calls above run on your own Meta app with Public Content Access.

For everything that happens on your users' own accounts, Adeli holds the Meta developer app, carried Meta's review, and refreshes every connected account's tokens:

- **Publish** feed posts, Reels, Stories, and carousels from one endpoint ([Instagram on Adeli](https://www.tryadeli.com/product/instagram)).
- **List posts** from every connected account, with likes and comments ([List posts](https://www.tryadeli.com/docs/api/posts/list-posts)).
- **Read account insights** for views, reach, interactions, and accounts engaged ([analytics API](https://www.tryadeli.com/social-media-analytics-api)).

An AI content tool can pair the two: hashtag research on their own Meta app, then publishing to customers' accounts through Adeli. [Adeli for AI content generation](https://www.tryadeli.com/use-cases/ai-content-generation) shows that setup, and your first 2 user profiles are free on [pricing](https://www.tryadeli.com/pricing).

## Frequently asked questions

### Can I search Instagram hashtags with Instagram Login?

Meta documents hashtag search for the Instagram API with Facebook Login and with Unified Login, not for the Instagram API with Instagram Login. To search hashtags, your users connect through Facebook Login with an Instagram professional account linked to a Facebook Page.

### How many hashtags can I search with the Instagram API?

Each Instagram professional account can query 30 unique hashtags in a rolling 7-day window. Repeat queries on the same hashtag inside that window don't count again, and fetching a hashtag's top or recent media counts as querying it.

### Can the hashtag search API return the username of a post?

No. Meta's top_media and recent_media references say you can't request the username field on media returned by hashtag search. You get the caption, media type, media URL, permalink, timestamp, and like and comment counts.

### Does Instagram hashtag search return Stories or Reels?

Hashtag search returns public photos and videos. Meta says hashtags on Stories aren't supported, and promoted or boosted posts aren't returned.

## Related Adeli pages

- [Instagram API for Developers](https://www.tryadeli.com/product/instagram.md): Publish, schedule, and read analytics for Instagram through one API. Adeli owns the Instagram developer app, token refresh, and Meta review. Free to start.
- [Social Media API for AI Content Generation Tools](https://www.tryadeli.com/use-cases/ai-content-generation.md): Publish the videos and carousels your AI tool creates to TikTok, YouTube, Instagram, and more, then show users how they performed.
- [Social Media Analytics API](https://www.tryadeli.com/social-media-analytics-api.md): Adeli's analytics API: Instagram, TikTok, Facebook Page, and YouTube insights endpoints, plus per-post engagement on every post an account has made.
- [All posts on the Adeli blog](https://www.tryadeli.com/blog.md)

## About the author

Mika Reyes is the CEO behind Adeli and a tech and AI content creator. She was previously co-founder and CEO of Parallax, which was acquired by Phantom, and a product lead at LinkedIn. She is a Forbes 30 Under 30 honoree.
