Instagram Hashtag Scraper

How to build an Instagram hashtag dataset you can trust

Published

An Instagram hashtag dataset is a table with one row per post under a tag, collected over a window you chose, with the columns fixed before you start. Building one takes four decisions: which tag, which dates, how many rows at most, and which fields each row carries. Then you need a way to pull the posts that answers those decisions exactly, and a record of what was left out. Get the decisions right and the collection is the easy part. Get them wrong and the numbers you compute later will look fine and describe something else.

This page walks through the job start to finish. It starts with the ways you can do it with no tool at all, covers the official API and its limits as of September 2026, and ends with the automatic way this site documents.

What a usable hashtag dataset looks like

Before collecting anything, write down the shape of the table. A dataset that grows its columns as you go is one where early rows and late rows mean different things.

A useful minimum, one row per post:

ColumnWhat it holdsWhy it matters
shortcodeThe post's unique codeYour dedup key
urlLink to the postLets anyone check a row by hand
takenAtWhen it was publishedEvery window and trend depends on it
captionThe post textTopic, language, sentiment coding
hashtagsEvery tag in the captionCo-occurring tags, campaign overlap
likeCount, commentCountEngagement at collection timeOnly valid with a collection date beside it
ownerUsernameWho postedCounting distinct accounts
mediaTypeImage, video or carouselFormat mix

Record the collection time for the whole dataset too. Like and comment counts keep moving after you read them, so a count without the date it was read is a number nobody can reproduce.

Two rules save most of the pain later:

Step by step: building an Instagram hashtag dataset

  1. Pick the tag and write down why. One tag per dataset keeps the question clear. If a campaign runs two tags, collect them separately and join on the shortcode, so a post using both is counted once.
  2. Fix the window. "The last seven days" means nothing a month from now. Write the start and end dates, and the time zone.
  3. Set a row cap. A cap protects your budget and your time. Pick it from the question: a sample of 500 recent posts answers "what are people posting under this tag", while a full week of a busy tag might be thousands.
  4. Collect. Use one of the methods below.
  5. Clean. Dedupe on shortcode, drop rows outside the window, keep empty cells empty.
  6. Write the method note. Tag, window, cap, collection date, method, and how many rows were dropped and why. This is the part people skip, and it is the part a reviewer asks for first.

The manual way, and when it is enough

You can build a small hashtag dataset with nothing but the Instagram app and a spreadsheet. Open the tag, scroll the recent posts, and copy the link, date, account and caption of each into a row.

This is enough when:

It stops working fast. Scrolling is slow, you cannot tell reliably where you stopped, engagement counts are read by eye, and there is no clean way to repeat the same collection next week. The method note is also hard to write honestly, because "I scrolled until I got tired" is not a stopping rule.

The official API, and its limits

Meta offers hashtag access through the Instagram Graph API. It is free and first-party, and if your dataset fits inside its rules it is a sound choice. The rules, from Meta's own developer reference as of September 2026:

RuleWhat Meta's reference says
Hashtag budgetA maximum of 30 unique hashtags in any 7-day period
RecencyRecent media returns only posts published in the 24 hours before the query
ContentPublic photos and videos only
Page sizeUp to 50 results per page
OrderResults do not always arrive in chronological order

The 24-hour recency rule decides most dataset jobs. A dataset covering a week has to be collected by querying every day, without a gap, from the start of the window. If you missed the first three days, the API cannot give them back. It also needs a Meta app with the right permissions and a business or creator account, which is a setup step before the first row.

Our Instagram hashtag API comparison covers the third-party APIs too, with their prices.

The script way

If you write Python, there are open-source libraries that read Instagram with your own login. They are free and flexible, and you own every line. They also make you the maintainer: sessions expire, Instagram changes its responses, and a script left running on a server is the first thing to hit a rate limit. Our guides to Python Instagram API options and to Instaloader alternatives cover that route in detail.

A script is the right call when the dataset is part of a larger pipeline you already run, or when you need fields or media files a hosted tool does not return.

The automatic way: rows delivered to a dataset

The Instagram Hashtag Scraper is built for exactly this job. It is an Apify actor: you give it one hashtag, a session cookie for an Instagram account you control, a row cap and a date window, and it writes the posts to your own Apify dataset, newest first. You export that as CSV, JSON or Excel from Apify.

How it maps to the six steps above:

It charges $0.0005 per delivered post, and only for rows that reach your dataset. Duplicates, posts outside your window and posts past your cap are not charged, and a run that returns nothing costs nothing. A dataset of 1,000 posts costs $0.50.

Know its limits before you plan around it. It reads one hashtag per run and only the recent feed, not the top posts. It returns the cover image of a carousel, not each slide, and it does not collect comments, profiles or follower lists. Reaching far into the past means walking forward through pages from today, so it suits collecting as you go better than digging up an old window. The limits page lists every one.

Collecting a dataset over time

Most research datasets are built forward: you start collecting when the campaign or event starts, and keep going until it ends. The pattern that works:

  1. Schedule a run per day on the tag, with onlyPostsNewerThan set to a little more than a day so consecutive runs overlap.
  2. Append each run's rows to one table.
  3. Dedupe across runs on the shortcode. Dedup inside the scraper is per run, so the overlap produces repeats you remove yourself. A repeat is also useful: its newer like count is a second reading.
  4. Keep each run's end reason in a log. A day that ended on a refused session is a gap in your data, and you want to know it is a gap rather than a quiet day.

Before committing to a tag, the free hashtag checker shows its recent activity without starting a run, which helps you set a sensible cap.

Which way fits your dataset

Your datasetBest fit
Under 50 posts, one-offBy hand in a spreadsheet
Up to 30 tags, collected daily from day one, with a Meta appThe official Graph API
Part of a pipeline you maintain in PythonAn open-source library
One tag, a fixed window and cap, exported as rowsA hosted actor such as ours

Whichever you pick, the dataset is only as good as its method note. Write down the tag, the window, the cap, the date you collected, and what was dropped. If you then want to turn the rows into figures, our piece on Instagram hashtag analytics covers what the public post data can and cannot measure.

When you are ready to collect, getting started walks through the first run.

All articles