# Instagram Hashtag Scraper - Posts, Reels & Media (`dami_studio/instagram-hashtag-scraper`) Actor

Scrape any Instagram hashtag for top & recent posts and reels: captions, likes, comments, media URLs, owner & timestamp. Bulk hashtags, clean flat records, pay per post (failed runs free), export JSON/CSV/Excel or deliver to Notion.

- **URL**: https://apify.com/dami\_studio/instagram-hashtag-scraper.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.40 / 1,000 post returneds

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 — Posts by Hashtag

**Pull top & recent posts under any Instagram hashtag and get back clean, flat records** — caption, like & comment counts, media URLs, owner, hashtags, mentions and timestamp. Feed it a list of hashtags (or `/explore/tags/` URLs), set a cap, and export to **JSON, CSV or Excel**, hit it from the **API**, or have results delivered straight to **Notion**. **Just $0.40 per 1,000 posts** — billed only for posts actually returned.

> Instagram gates hashtag feeds behind a login. This actor handles that the same way every paid IG service does — you supply one or more throwaway-account `sessionid` cookies and it **rotates the account pool + residential IPs** for you. No app, no bearer token, no business API approval.

### Why this scraper wins

- 🍪 **Account-pool rotation** — add several throwaway `sessionid` cookies and the actor cycles accounts *and* fresh residential IPs every few hops, so one flagged session never sinks the run.
- 🏠 **Residential by default** — Instagram hard-blocks datacenter IPs, so the actor forces Apify **RESIDENTIAL** proxy out of the box. Leave it as-is and it just works.
- 💸 **Cheaper, pay-per-result** — **$0.40 / 1,000 posts**, charged per post returned. Empty or blocked runs cost nothing.
- 🧹 **Clean, flat output** — one tidy record per post, ready for spreadsheets, dashboards or LLM pipelines. No raw nested soup.
- 🔁 **Auto-dedupe** — the same post is never returned (or charged) twice in a run.
- 📬 **Built-in delivery** — optionally push every run straight into **Notion** via Apify connectors, zero extra code.
- 🚦 **Honest errors** — if Instagram blocks or returns nothing, you get a clear `errorCode` diagnostic row (`RATE_LIMITED`, `BLOCKED`, `NO_RESULTS`) instead of silent emptiness.

### What you can scrape

| Mode | Input | Notes |
|---|---|---|
| **Hashtag feed** | `hashtags` (with or without `#`) | Top **and** recent posts under each tag |
| **Hashtag URLs** | `startUrls` (`/explore/tags/<tag>/`) | Same as above, paste-friendly |

### Input

- **`hashtags`** — list of hashtags to scrape, e.g. `nature`, `travel` (the `#` is optional).
- **`startUrls`** — or paste `https://www.instagram.com/explore/tags/<tag>/` URLs instead.
- **`resultsLimit`** — max posts **per hashtag** (default `50`, up to `2000`). You pay per post.
- **`sessionCookies`** *(required)* — one or more logged-in `sessionid` cookies from throwaway accounts; the actor rotates them. From a logged-in `instagram.com`: **F12 → Application → Cookies → copy the `sessionid` value**. Paste one per line.
- **`proxyConfiguration`** — Residential is preconfigured and required; leave the default.
- **`notionConnector`** / **`notionParentId`** — optional, deliver results to a Notion data source.

### Output (one record per post)

```json
{
  "ok": true,
  "type": "image",
  "shortCode": "C1aBcDeFgHi",
  "url": "https://www.instagram.com/p/C1aBcDeFgHi/",
  "caption": "Golden hour over the fjord 🏔️ #nature #travel",
  "hashtags": ["nature", "travel"],
  "mentions": [],
  "likesCount": 18423,
  "commentsCount": 204,
  "videoViewCount": null,
  "displayUrl": "https://instagram.fxxx.fna.fbcdn.net/v/....jpg",
  "videoUrl": null,
  "images": ["https://instagram.fxxx.fna.fbcdn.net/v/....jpg"],
  "isVideo": false,
  "dimensions": { "height": 1080, "width": 1080 },
  "ownerUsername": "wanderlust",
  "ownerId": "1789456123",
  "timestamp": "2026-06-21T07:14:02.000Z",
  "hashtag": "nature"
}
````

### Pricing

**$0.40 per 1,000 posts** (`$0.0004` per post, pay-per-event). You are charged only for posts actually returned — failed, blocked or empty runs cost nothing.

### FAQ

**Why do I need `sessionid` cookies?** Instagram's hashtag feed is login-gated — there is no keyless path. This is exactly how every paid IG hashtag service works. Use throwaway accounts and add several for resilience.

**How many cookies should I add?** More is better. The actor rotates accounts every few IP hops, so 3–5 throwaway sessions keep success rates high on sustained runs.

**Why is residential proxy required?** Instagram hard-blocks datacenter IP ranges. Residential is preconfigured so runs actually return data — leave the default.

**It returned an `errorCode` row — why?** That's the actor telling you exactly what happened (`RATE_LIMITED`, `BLOCKED`, `NO_RESULTS`) instead of failing silently. Add more sessions, lower volume, or retry.

**Can I deliver to Notion?** Yes — set `notionConnector` and `notionParentId` and every run lands in your Notion data source automatically.

# Actor input Schema

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

Hashtags (with or without #) to scrape top & recent posts from.

## `startUrls` (type: `array`):

Or paste /explore/tags/ URLs.

## `resultsLimit` (type: `integer`):

Max posts per hashtag. Charged per post.

## `proxyConfiguration` (type: `object`):

Instagram blocks datacenter IPs — Residential proxy is REQUIRED. Leave the default.

## `notionConnector` (type: `string`):

Optional Notion delivery.

## `notionParentId` (type: `string`):

Optional Notion data-source id.

## `sessionCookies` (type: `array`):

IG hashtag data is login-gated — no keyless path (this is how every paid service does it). Add one or more throwaway-account sessionid cookies; the actor rotates them. From a logged-in instagram.com: F12 → Application → Cookies → copy the sessionid value. Paste one per line.

## Actor input object example

```json
{
  "hashtags": [
    "nature",
    "travel"
  ],
  "startUrls": [
    "https://www.instagram.com/explore/tags/nature/"
  ],
  "resultsLimit": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "sessionCookies": [
    "sessionid=12345%3AAbCd...%3A12%3A..."
  ]
}
```

# Actor output Schema

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

Posts in the default 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 = {
    "hashtags": [
        "nature"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("dami_studio/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": ["nature"] }

# Run the Actor and wait for it to finish
run = client.actor("dami_studio/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": [
    "nature"
  ]
}' |
apify call dami_studio/instagram-hashtag-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Hashtag Scraper - Posts, Reels & Media",
        "description": "Scrape any Instagram hashtag for top & recent posts and reels: captions, likes, comments, media URLs, owner & timestamp. Bulk hashtags, clean flat records, pay per post (failed runs free), export JSON/CSV/Excel or deliver to Notion.",
        "version": "0.1",
        "x-build-id": "RgzIeUK78LOWprHNb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/dami_studio~instagram-hashtag-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-dami_studio-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/dami_studio~instagram-hashtag-scraper/runs": {
            "post": {
                "operationId": "runs-sync-dami_studio-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/dami_studio~instagram-hashtag-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-dami_studio-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",
                "properties": {
                    "hashtags": {
                        "title": "Hashtags",
                        "type": "array",
                        "description": "Hashtags (with or without #) to scrape top & recent posts from.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "startUrls": {
                        "title": "Hashtag URLs",
                        "type": "array",
                        "description": "Or paste /explore/tags/ URLs.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "resultsLimit": {
                        "title": "Max posts",
                        "minimum": 1,
                        "maximum": 2000,
                        "type": "integer",
                        "description": "Max posts per hashtag. Charged per post.",
                        "default": 50
                    },
                    "proxyConfiguration": {
                        "title": "Proxy",
                        "type": "object",
                        "description": "Instagram blocks datacenter IPs — Residential proxy is REQUIRED. Leave the default.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    },
                    "notionConnector": {
                        "title": "Notion connector ID (optional)",
                        "type": "string",
                        "description": "Optional Notion delivery."
                    },
                    "notionParentId": {
                        "title": "Notion data-source ID (optional)",
                        "type": "string",
                        "description": "Optional Notion data-source id."
                    },
                    "sessionCookies": {
                        "title": "Instagram session cookies (REQUIRED)",
                        "type": "array",
                        "description": "IG hashtag data is login-gated — no keyless path (this is how every paid service does it). Add one or more throwaway-account sessionid cookies; the actor rotates them. From a logged-in instagram.com: F12 → Application → Cookies → copy the sessionid value. Paste one per line.",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
