# 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
- **Stats:** 7 total users, 6 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# 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 is designed to stay lightweight because it only works with hashtag feeds and does not spend compute on unrelated Instagram surfaces. Actual cost depends on how many hashtags you run, how deep pagination goes, and how many retries are needed, but simple runs with a handful of hashtags should stay relatively cheap compared with broader Instagram scrapers.

If you only need a few dozen or a few hundred hashtag posts, start with a small `maxItems` value. If you need large historical-style pulls across multiple hashtags, enable full pagination and scale gradually so you can estimate the cost profile from real runs.

### 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 Actors

If you need broader Instagram coverage, see these related Actors:

- [Instagram Scraper](https://apify.com/api-ninja/instagram-scraper) for a wider Instagram scraping workflow
- [Instagram Posts Scraper](https://apify.com/api-ninja/instagram-posts-scraper) for post-focused Instagram extraction

### 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("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=api-ninja/instagram-hashtag-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Hashtag Scraper",
        "description": "#️⃣ Scrape Instagram hashtag posts fast with clean input, deep pagination, and export-ready data. Zero clutter, just hashtags.",
        "version": "0.0",
        "x-build-id": "HT2TeY2YerPtTW5nJ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/api-ninja~instagram-hashtag-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-api-ninja-instagram-hashtag-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/api-ninja~instagram-hashtag-scraper/runs": {
            "post": {
                "operationId": "runs-sync-api-ninja-instagram-hashtag-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/api-ninja~instagram-hashtag-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-api-ninja-instagram-hashtag-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "hashtags"
                ],
                "properties": {
                    "hashtags": {
                        "title": "🏷️ Hashtag Queries",
                        "type": "array",
                        "description": "Enter hashtags to scrape. Supported formats: `travel`, `#travel`, `explore/tags/travel`, or `https://www.instagram.com/explore/tags/travel/`.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "🔢 Max Items Per Hashtag",
                        "minimum": 30,
                        "type": "integer",
                        "description": "Maximum number of posts to collect for each hashtag. Ignored when parse-all is enabled.",
                        "default": 50
                    },
                    "scrapeAllResults": {
                        "title": "♾️ Parse All Available Posts",
                        "type": "boolean",
                        "description": "If enabled, the Actor keeps following pagination until the hashtag feed has no more pages.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
