# Instagram Hashtag Scraper (`api-ninja/instagram-hashtag-scraper`) Actor

\#️⃣ Scrape Instagram hashtag posts fast with clean input, deep pagination, and export-ready data. Zero clutter, just hashtags.

- **URL**: https://apify.com/api-ninja/instagram-hashtag-scraper.md
- **Developed by:** [API ninja](https://apify.com/api-ninja) (community)
- **Categories:** Social media, Automation, Developer tools
- **Features:** Limited permissions
- **Stats:** 257 total users, 16 monthly users, 100.0% runs succeeded, 10 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### What does Instagram Hashtag Scraper do?

**Instagram Hashtag Scraper** extracts public post data from [Instagram](https://www.instagram.com) hashtag feeds with **simple input, pagination support, and structured dataset output**. It is built for users who want a focused **Instagram hashtag API alternative** without extra profile, reels, audio, or location settings getting in the way.

Just enter one or more hashtag queries such as `travel`, `#travel`, `explore/tags/travel`, or the full Instagram hashtag URL, set a limit or enable full pagination, and run the Actor. On Apify, you also get API access, scheduling, monitoring, integrations, dataset export, and scalable runs in one package.

### Why use this Instagram hashtag scraper?

Scraping Instagram hashtag data is useful when you want to monitor trends, discover viral content, study audience interests, or build your own internal dashboard from public Instagram posts.

Common use cases:

- 🔎 Track trending hashtag content in a niche such as travel, beauty, crypto, sports, or fashion.
- 📈 Monitor content performance across hashtags by comparing likes, comments, media type, and posting patterns.
- 🤝 Discover creators and pages posting inside a target hashtag ecosystem.
- 🧠 Collect raw Instagram hashtag data for analytics, lead research, media monitoring, or content strategy.
- 🔄 Automate recurring data collection with Apify scheduling and download results through API, CSV, Excel, or JSON.

Unlike a broad Instagram scraper, this Actor is intentionally narrow. It focuses on **hashtag feeds only**, which makes the input easier to understand and the output easier to process.

### What can this Instagram hashtag scraper do?

- ✅ Scrape public Instagram hashtag feeds only
- ✅ Accept multiple hashtag formats
- ✅ Follow pagination automatically with `end_cursor`
- ✅ Limit results per hashtag or scrape all available pages
- ✅ Return raw post objects enriched with a few practical helper fields such as `sourceHashtag`, `previewImageUrl`, and `captionText`
- ✅ Run on the Apify platform with monitoring, logs, integrations, API access, and scheduling

### What Instagram data can this Actor extract?

The Actor returns the original post objects from the hashtag feed and exposes the most useful fields in the dataset view.

| Field                                    | Description                              |
| ---------------------------------------- | ---------------------------------------- |
| `sourceHashtag`                          | The hashtag query that produced the post |
| `id`                                     | Instagram post ID                        |
| `shortcode`                              | Public shortcode of the post             |
| `captionText`                            | Extracted caption text                   |
| `comments_disabled`                      | Whether comments are disabled            |
| `edge_media_to_comment.count`            | Comment count                            |
| `edge_liked_by.count`                    | Like count                               |
| `media_type`                             | Media type returned by Instagram         |
| `product_type`                           | Instagram product/media category         |
| `taken_at_timestamp`                     | Publish timestamp                        |
| `dimensions.width` / `dimensions.height` | Post dimensions                          |
| `display_url` / `thumbnail_src`          | Image URLs                               |
| `owner.id`                               | Owner ID                                 |
| `accessibility_caption`                  | Alt-style description when available     |

### How to scrape Instagram hashtag data

1. Open **Instagram Hashtag Scraper** on Apify.
2. Add one or more hashtag queries to the input. You can use `travel`, `#travel`, `explore/tags/travel`, or a full Instagram hashtag URL.
3. Set `Max Items Per Hashtag` if you want to stop after a certain number of posts.
4. Enable `Parse All Available Posts` if you want the Actor to keep following pagination until the feed ends.
5. Start the run and monitor progress in the log.
6. Download the dataset in JSON, CSV, Excel, or HTML, or use it directly through the Apify API.

### Input

Instagram Hashtag Scraper has intentionally simple input:

- `hashtags`: A list of hashtag queries
- `maxItems`: Maximum number of posts to collect per hashtag
- `scrapeAllResults`: Whether to ignore the limit and continue through all available pages

See the **Input** tab in Apify Console for the latest field descriptions and examples.

#### Example input

```json
{
    "hashtags": ["travel", "#nature", "explore/tags/food", "https://www.instagram.com/explore/tags/photography/"],
    "maxItems": 50,
    "scrapeAllResults": false
}
```

### Output

You can download the dataset extracted by Instagram Hashtag Scraper in various formats such as **JSON, HTML, CSV, or Excel**.

#### Example output

```json
[
    {
        "sourceHashtag": "travel",
        "id": "3903246104967849291",
        "__typename": "GraphImage",
        "shortcode": "DYrHab1iSVL",
        "captionText": "The US Citizenship and Immigration Services has introduced a major policy shift...",
        "comments_disabled": false,
        "taken_at_timestamp": 1779523217,
        "display_url": "https://scontent.cdninstagram.com/...",
        "thumbnail_src": "https://scontent.cdninstagram.com/...",
        "dimensions": {
            "height": 1350,
            "width": 1080
        },
        "edge_media_to_comment": {
            "count": 0
        },
        "edge_liked_by": {
            "count": 1
        },
        "owner": {
            "id": "3417754169"
        }
    }
]
```

### How much does it cost to scrape Instagram hashtags?

This Actor uses **pay-per-event pricing** with a **$0.10 minimum total charge per run**.

| Charge | Free plan | Bronze-Diamond plans |
| --- | ---: | ---: |
| Actor start | $0.01 | $0.01 |
| Result saved to the default dataset | $0.015 per result | $0.001 per result |

The Actor start event is charged once per GB of memory, with at least one event per run. The final cost depends mainly on how many hashtag-post records are saved. Start with a small `maxItems` value and enable full pagination only when needed. Check the Actor's **Pricing** tab for the latest rates before starting a large run.

### Tips for better results

- 💡 Use short test runs first with a low `maxItems` value before launching larger jobs.
- 💡 If you only need fresh samples from a hashtag, keep `scrapeAllResults` disabled.
- 💡 Use multiple focused hashtags instead of one very broad hashtag when you want cleaner data.
- 💡 Use Apify scheduling to refresh the same hashtag datasets automatically every hour or every day.
- 💡 Use the Apify API or integrations if you want to move results into Google Sheets, Make, Zapier, or your own backend.

### Other Instagram Scraping Tools

If you like this Actor, you might also find these Instagram tools useful:

- 📊 **[Instagram Scraper](https://apify.com/api-ninja/instagram-scraper)**: Extract profiles, reels, hashtags, locations, audio feeds, and other public Instagram content.
- 📸 **[Instagram Posts Scraper](https://apify.com/api-ninja/instagram-posts-scraper)**: Collect posts, reels, tagged content, or reposts from public profiles.

### FAQ, disclaimers, and support

#### Is it legal to scrape Instagram?

This Actor is intended for scraping **public Instagram data only**. It does not log in, access private accounts, or collect hidden information. However, scraped results may still contain personal data published by users. You are responsible for using the data in compliance with Instagram terms, GDPR, and any other laws or regulations that apply to your jurisdiction and use case.

#### Is this an official Instagram API?

No. This Actor is an **Instagram hashtag scraping tool** and a practical **Instagram hashtag API alternative** for public data extraction on Apify.

#### What if I need profiles, posts, or broader Instagram coverage?

Use one of the related Actors linked above if your use case extends beyond hashtag feeds.

#### Where do I get help?

If you run into an issue, use the **Issues** tab on the Actor page and include:

- the hashtag input you used
- whether `scrapeAllResults` was enabled
- the approximate time of the run
- any relevant log excerpts

Feedback is useful here because hashtag feeds can change over time, and real examples make fixes faster.

# Actor input Schema

## `hashtags` (type: `array`):

Enter hashtags to scrape. Supported formats: `travel`, `#travel`, `explore/tags/travel`, or `https://www.instagram.com/explore/tags/travel/`.

## `maxItems` (type: `integer`):

Maximum number of posts to collect for each hashtag. Ignored when parse-all is enabled.

## `scrapeAllResults` (type: `boolean`):

If enabled, the Actor keeps following pagination until the hashtag feed has no more pages.

## Actor input object example

```json
{
  "hashtags": [
    "travel",
    "#nature",
    "explore/tags/food",
    "https://www.instagram.com/explore/tags/photography/"
  ],
  "maxItems": 50,
  "scrapeAllResults": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "hashtags": [
        "travel",
        "#nature",
        "explore/tags/food",
        "https://www.instagram.com/explore/tags/photography/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-ninja/instagram-hashtag-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "hashtags": [
        "travel",
        "#nature",
        "explore/tags/food",
        "https://www.instagram.com/explore/tags/photography/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("api-ninja/instagram-hashtag-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "hashtags": [
    "travel",
    "#nature",
    "explore/tags/food",
    "https://www.instagram.com/explore/tags/photography/"
  ]
}' |
apify call api-ninja/instagram-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,api-ninja/instagram-hashtag-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/miTA7Jb333damThjf/builds/AqPAOH1Kl15OKygRy/openapi.json
