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

This scraper extracts users from Instagram based on a hashtag. Just enter a hashtag and set the number of usernames you need. It collects user details like usernames, IDs, and captions, making it perfect for social media analysis and research. 🚀

- **URL**: https://apify.com/coderx/instagram-hashtag-scraper.md
- **Developed by:** [CoderX](https://apify.com/coderx) (community)
- **Categories:** Automation, Lead generation, Social media
- **Stats:** 399 total users, 5 monthly users, 98.8% runs succeeded, 5 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $1.50 / 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.

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

## Instagram Hashtag Scraper

**Pull structured post data from any Instagram hashtag — no account, no login, no friction.**

Point it at a hashtag. Get back clean JSON with every post, reel, and carousel that lives under it — engagement numbers, author profiles, audio metadata, location pins, and more. Built for analysts, marketers, and developers who need Instagram data that's actually usable.

---

### What It Does

Instagram hashtag feeds are a goldmine of public content intelligence — trending sounds, emerging creators, geo-tagged posts, sponsored content signals. This scraper surfaces all of it in a consistent, queryable structure.

Hand it a hashtag and it returns:

- Full post and reel metadata (captions, timestamps, media URLs)
- Engagement signals: likes, comments, plays, reshares
- Author snapshots: follower count, account type, verification
- Audio context: track name, artist, trending status
- Location data: venue name, city, coordinates
- Collaboration flags: paid partnerships, co-authors, tagged users

No credentials. No cookies. No session maintenance on your end.

---

### Input

| Parameter     | Type    | Required | Default  | Description |
|---------------|---------|----------|----------|-------------|
| `hashtag`     | String  | ✅       | —        | The hashtag to scrape, without the `#`. E.g. `travel`, `fitness`, `streetphotography` |
| `scrape_type` | String  | ❌       | `recent` | `recent` for newest posts, `top` for highest-performing |
| `max_items`   | Integer | ❌       | `24`     | How many posts to retrieve. Minimum is `24` |
| `cursor`      | String  | ❌       | —        | Resume token from a previous run *(paid only)* |

**Example:**

```json
{
  "hashtag": "streetphotography",
  "scrape_type": "top",
  "max_items": 100
}
````

***

### Output

Each record in the dataset is one post, reel, or carousel. Here's the full field breakdown.

#### Core Post Fields

| Field                | Type    | Description |
|----------------------|---------|-------------|
| `id`                 | String  | Instagram internal post ID |
| `shortcode`          | String  | Shortcode used in the post URL |
| `url`                | String  | Direct link to the post |
| `taken_at`           | Integer | Publish time as Unix timestamp |
| `taken_at_timestamp` | String  | Publish time in ISO 8601 / UTC |
| `scraped_at`         | String  | When this record was collected |
| `product_type`       | String  | `clips` = Reel, `feed` = standard post |
| `media_type`         | Integer | `1` = Photo · `2` = Video · `8` = Carousel |

#### Author (`author` object)

| Field             | Type    | Description |
|-------------------|---------|-------------|
| `id`              | String  | Instagram user ID |
| `username`        | String  | Handle |
| `full_name`       | String  | Display name |
| `is_verified`     | Boolean | Blue checkmark status |
| `is_private`      | Boolean | Private account flag |
| `follower_count`  | Integer | Follower count at scrape time |
| `account_type`    | Integer | `1` = Personal · `2` = Creator · `3` = Business |
| `profile_pic_url` | String  | Profile picture URL |

#### Content

| Field                  | Type    | Description |
|------------------------|---------|-------------|
| `caption`              | String  | Full caption text |
| `hashtags`             | Array   | Hashtags parsed from caption |
| `mentions`             | Array   | @mentions parsed from caption |
| `caption_is_edited`    | Boolean | Whether caption was edited post-publish |
| `carousel_media_count` | Integer | Slide count (carousel posts only) |

#### Engagement

| Field                          | Type    | Description |
|-------------------------------|---------|-------------|
| `like_count`                  | Integer | Instagram likes |
| `comment_count`               | Integer | Instagram comments |
| `play_count`                  | Integer | Total video/reel plays |
| `ig_play_count`               | Integer | Instagram-side play count |
| `fb_play_count`               | Integer | Facebook play count (cross-posts) |
| `fb_like_count`               | Integer | Facebook likes |
| `fb_comment_count`            | Integer | Facebook comments |
| `reshare_count`               | Integer | Reshare count |
| `like_and_view_counts_disabled` | Boolean | True if creator has hidden counts |

#### Media

| Field              | Type    | Description |
|--------------------|---------|-------------|
| `video_url`        | String  | Highest-quality video URL |
| `thumbnail_url`    | String  | Post thumbnail URL |
| `duration_seconds` | Float   | Video length in seconds |
| `original_width`   | Integer | Media width in pixels |
| `original_height`  | Integer | Media height in pixels |
| `has_audio`        | Boolean | Whether audio is present |

#### Audio (`audio` object)

Handles all three Instagram audio structures automatically.

| Field                  | Type    | Description |
|------------------------|---------|-------------|
| `title`                | String  | Track title (licensed music) |
| `artist`               | String  | Artist or original audio creator |
| `type`                 | String  | `licensed_music`, `original_sound`, or audio type flag |
| `is_explicit`          | Boolean | Explicit content flag |
| `original_audio_title` | String  | Custom label for original audio |
| `is_trending`          | Boolean | Whether the audio is trending in Reels |

#### Location (`location` object)

| Field     | Type   | Description |
|-----------|--------|-------------|
| `pk`      | String | Location ID |
| `name`    | String | Venue or place name |
| `address` | String | Street address |
| `city`    | String | City |
| `lat`     | Float  | Latitude |
| `lng`     | Float  | Longitude |

#### Collaboration & Rights

| Field                        | Type    | Description |
|-----------------------------|---------|-------------|
| `is_paid_partnership`        | Boolean | Sponsored content flag |
| `coauthor_usernames`         | Array   | Co-author handles |
| `has_tagged_users`           | Boolean | Whether users are tagged in post |
| `can_viewer_reshare`         | Boolean | Resharing allowed |
| `ig_media_sharing_disabled`  | Boolean | Sharing disabled by creator |

***

### Sample Record

```json
{
  "id": "3621480123456789012",
  "shortcode": "DAbc1234XYZ",
  "url": "https://www.instagram.com/reel/DAbc1234XYZ/",
  "taken_at": 1720000000,
  "taken_at_timestamp": "2024-07-03T12:00:00+00:00",
  "scraped_at": "2025-04-13T09:30:00+00:00",
  "product_type": "clips",
  "media_type": 2,
  "author": {
    "id": "123456789",
    "username": "jane.travels",
    "full_name": "Jane Wanderlust",
    "is_verified": false,
    "is_private": false,
    "follower_count": 48200,
    "account_type": 2,
    "profile_pic_url": "https://..."
  },
  "caption": "Golden hour in Santorini 🌅 #travel #greece #sunset #reels",
  "hashtags": ["travel", "greece", "sunset", "reels"],
  "mentions": [],
  "like_count": 4821,
  "comment_count": 112,
  "play_count": 98400,
  "video_url": "https://...",
  "thumbnail_url": "https://...",
  "duration_seconds": 14.5,
  "has_audio": true,
  "audio": {
    "title": "Golden Hour",
    "artist": "JVKE",
    "type": "licensed_music",
    "is_explicit": false,
    "original_audio_title": null,
    "is_trending": true
  },
  "location": {
    "pk": "213204004",
    "name": "Santorini, Greece",
    "city": "Santorini",
    "lat": 36.3932,
    "lng": 25.4615
  },
  "is_paid_partnership": false,
  "coauthor_usernames": [],
  "has_tagged_users": true
}
```

***

### Pagination & Resuming Runs *(Paid)*

Long scrapes can be paused and continued without data loss. The final record in every paid dataset includes a `_metadata` block:

```json
{
  "_metadata": {
    "cursor": "QVFDZjJmUTdQcGQ4VUluUFZMa3N...",
    "total_scraped": 500,
    "unique_items": 498,
    "hashtag": "travel"
  }
}
```

To resume: copy the `cursor` value, start a new run with the same hashtag, and paste it into the **Resume Cursor** field. The scraper picks up from the exact point it left off — no re-scraping, no duplicates.

***

### Free vs Paid

| Feature                    | Free   | Paid              |
|----------------------------|--------|-------------------|
| Posts per run              | ~24    | Up to `max_items` |
| Scrape type (recent / top) | ✅     | ✅                |
| Full output fields         | ✅     | ✅                |
| Pagination cursor          | ❌     | ✅                |
| Resume interrupted runs    | ❌     | ✅                |
| Priority support           | ❌     | ✅                |

***

### How to Use It

**Trend monitoring** — run it on a niche hashtag weekly and compare engagement velocity over time. Spot content formats gaining traction before they peak.

**Creator discovery** — filter top posts for accounts with sub-50K followers and high engagement rates. That's your emerging influencer list.

**Audio tracking** — `is_trending` on the `audio` object tells you which sounds are gaining velocity in Reels before the mainstream catches on.

**Location intelligence** — need to understand content patterns from a specific city or venue? Filter by `location.city` or use the lat/lng coordinates for geo-clustering.

**Pipeline integration** — the output is clean, flat JSON. Drop it directly into BigQuery, Airtable, a CRM enrichment flow, or any BI tool. No cleaning required.

***

### Technical Notes

- Works on **public hashtags only** — content must be visible to unauthenticated Instagram users
- Deduplication is built in — safe to run overlapping time windows without getting duplicate records
- Automatic retry on failures — up to 3 attempts per request with exponential backoff
- Handles all three Instagram audio data structures without any configuration

***

### Disclaimer

This scraper collects only publicly available content — the same data visible to anyone browsing Instagram without an account. No private data, credentials, or messages are accessed or stored. Use responsibly and in accordance with applicable laws and platform terms of service. The developer assumes no liability for misuse.

***

### Support

Found a bug or need a custom configuration? Use the **Issues** tab on this Actor's page. Paid users get priority responses.

# Actor input Schema

## `hashtag` (type: `string`):

Enter the Instagram hashtag to scrape (without #). Example: travel, fitness, reelsinstagram.

## `scrape_type` (type: `string`):

Select which feed to scrape: Recent (latest posts) or Top (high-performing posts).

## `max_items` (type: `integer`):

Maximum number of posts/reels to scrape. The scraper will stop once this limit is reached.

## `cursor` (type: `string`):

Use a cursor from a previous run to continue scraping from where you left off. Leave empty to start from the beginning.

## Actor input object example

```json
{
  "hashtag": "instagram",
  "scrape_type": "recent",
  "max_items": 24
}
```

# Actor output Schema

## `results` (type: `string`):

Access all scraped posts and reels in JSON format from the dataset.

# 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 = {
    "hashtag": "instagram",
    "scrape_type": "recent",
    "max_items": 24
};

// Run the Actor and wait for it to finish
const run = await client.actor("coderx/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 = {
    "hashtag": "instagram",
    "scrape_type": "recent",
    "max_items": 24,
}

# Run the Actor and wait for it to finish
run = client.actor("coderx/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 '{
  "hashtag": "instagram",
  "scrape_type": "recent",
  "max_items": 24
}' |
apify call coderx/instagram-hashtag-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=coderx/instagram-hashtag-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Hashtag Scraper",
        "description": "This scraper extracts users from Instagram based on a hashtag. Just enter a hashtag and set the number of usernames you need. It collects user details like usernames, IDs, and captions, making it perfect for social media analysis and research. 🚀",
        "version": "0.0",
        "x-build-id": "IiqEQlTjW7o7efnIS"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/coderx~instagram-hashtag-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-coderx-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/coderx~instagram-hashtag-scraper/runs": {
            "post": {
                "operationId": "runs-sync-coderx-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/coderx~instagram-hashtag-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-coderx-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": [
                    "hashtag"
                ],
                "properties": {
                    "hashtag": {
                        "title": "Hashtag",
                        "type": "string",
                        "description": "Enter the Instagram hashtag to scrape (without #). Example: travel, fitness, reelsinstagram."
                    },
                    "scrape_type": {
                        "title": "Scrape Type",
                        "enum": [
                            "recent",
                            "top"
                        ],
                        "type": "string",
                        "description": "Select which feed to scrape: Recent (latest posts) or Top (high-performing posts).",
                        "default": "recent"
                    },
                    "max_items": {
                        "title": "Maximum Items",
                        "minimum": 24,
                        "type": "integer",
                        "description": "Maximum number of posts/reels to scrape. The scraper will stop once this limit is reached.",
                        "default": 24
                    },
                    "cursor": {
                        "title": "Resume Cursor (Optional)",
                        "type": "string",
                        "description": "Use a cursor from a previous run to continue scraping from where you left off. Leave empty to start from the beginning."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
