Skip to main content

Instagram hashtag mining: search, info and posts through an API

· 3 min read
Product documentation and integration guides

Hashtags are Instagram's own taxonomy. Mined properly, a seed word expands into its whole semantic neighborhood — every competitor tag, sized by volume, with the posts to back it. Three endpoints do it.

Step 1: search the neighborhood​

GET /v1/ig/hashtag/search/{query}

The hashtag search returns every tag matching the query with its media count — #gymgirl, #gymgirlfit, #gymgirls… This is the expansion step: from one seed to the full variant list, volume-ranked:

from getsocialapi import Client

ig = Client(api_key="gsa_live_...").instagram

tags = ig.hashtag_search("gymgirl")["results"]
for t in sorted(tags, key=lambda x: -x.get("media_count", 0)):
print(t["name"], t["media_count"])

A leading # is accepted and trimmed — #gym girl resolves the same as gymgirl.

Step 2: size each tag​

GET /v1/ig/hashtag/info/{tag}

Hashtag info resolves a tag to its id and authoritative media count. In search results the counts can be cached; before committing crawl budget, re-check the finalists.

The volume tiers that matter:

Media countTierStrategy
10M+megavisibility lottery; poor targeting
100k–10Mcompetitivewhere ranking is realistic
1k–100knichehigh relevance, low reach — mix in

Step 3: walk the posts​

GET /v1/v2/hashtag/posts/{tag}?max_id=<cursor>

Hashtag posts return the native page (~15–18 posts) with next_max_id for pagination. Items carry caption, like/comment counts, owner and timestamps — everything needed for engagement-rate scoring per tag:

posts, cursor = [], None
while True:
page = ig.hashtag_posts("#gymgirl", max_id=cursor)
posts += page["posts"]
cursor = page.get("next_max_id")
if not cursor or len(posts) >= 200:
break

avg_er = sum(p["like_count"] for p in posts) / len(posts)

What the dataset answers​

  • Tag selection — relevance × competitiveness × observed engagement, per variant.
  • Posting patterns — taken_at histograms: when a tag's audience actually posts (proxy for when they browse).
  • Creator discovery — owners recurring across a tag's top posts are its real community anchors; pull their profiles next.

Scale honestly​

A 50-tag neighborhood at 200 posts each is ~700 requests. Checkpoint next_max_id per tag — cursors are stable strings, so the crawl can resume across days within plan limits.

Search, size, walk — three calls, one dataset, on getsocialapi.com. First 100 free.

Build with GetSocialAPI​

Explore Instagram API for capabilities, pricing and integration examples. Create an account to start with 100 free calls, or follow the quickstart.