# Instagram Hashtag Media Scraper (`powerai/instagram-hashtag-media-scraper`) Actor

Extract Instagram posts for a specific hashtag with detailed media and metadata. Supports auto-pagination and custom result limits. No login required.

- **URL**: https://apify.com/powerai/instagram-hashtag-media-scraper.md
- **Developed by:** [PowerAI](https://apify.com/powerai) (community)
- **Categories:** Social media, Videos
- **Security:** Limited permissions
- **Stats:** 157 total users, 1 monthly users, 76.7% runs succeeded, 3 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

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

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

## How to integrate an Actor?

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

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

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

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

# README

## 📷 Instagram Hashtag Media Scraper

This actor allows you to extract posts from any public Instagram hashtag. It leverages the latest Instagram API endpoint and supports auto-pagination to collect up to your specified `maxResults` limit.

### Features

- Extract posts from any public Instagram hashtag.
- Get detailed media information including images, videos, captions, and metadata.
- Supports auto-pagination to fetch large result sets.
- No login or session required.
- Easy integration with Apify datasets.

### Input

| Field       | Type    | Description                                      | Required | Example      |
|-------------|---------|--------------------------------------------------|----------|--------------|
| query       | string  | The hashtag to fetch media from (without #)      | Yes      | fashion       |
| maxResults  | integer | Maximum number of posts to fetch (default: 12)   | No       | 30           |

### Output

The output is a list of Instagram post objects, each containing detailed media and metadata fields as returned by the latest API, such as:

- `id` - Unique identifier
- `__typename` - Type of media
- `display_url` - URL of the media
- `display_resources` - Array of different quality versions
- `is_video` - Whether the media is a video
- `media_preview` - Preview of the media
- `tracking_token` - Tracking token
- `accessibility_caption` - Accessibility caption
- ...and more

### Example Output

```json
[
  {
    "comments_disabled": false,
    "__typename": "GraphImage",
    "id": "3643789032636928167",
    "edge_media_to_caption": {
      "edges": [
        {
          "node": {
            "text": "Nails\n\n#Art\n\n#Artwork\n#ArtoftheDay\n#Illustration\n\n#Drawing\n#Sketch\n#love #fashion #instagood #style #photooftheday #beautiful #fitness #picoftheday #follow #beauty #like4like #art #ootd #model #cute #followme #repost #instadaily #happy #instagram #makeup #girl #photography #lifestyle"
          }
        }
      ]
    },
    "shortcode": "DKRVtHOydCn",
    "edge_media_to_comment": {
      "count": 0
    },
    "taken_at_timestamp": 1748593523,
    "dimensions": {
      "height": 1080,
      "width": 1080
    },
    "display_url": "https://scontent-mia3-2.cdninstagram.com/v/t51.2885-15/502141803_17904432705083235_163772018496534203_n.webp?stp=dst-jpg_e15_fr_s1080x1080_tt6&_nc_ht=scontent-mia3-2.cdninstagram.com&_nc_cat=103&_nc_oc=Q6cZ2QHIgaQiclxByKMRa5qXpH5OpOcMZEbtVpBQLuo3ILJNjssr3ONIXjWPrTPwG0ZioYCCkBatNynE7MuJRg3llOaj&_nc_ohc=6RDY-FxwTNsQ7kNvwEfcF5-&_nc_gid=8gqgXS4TLjsrWZfw_VxK0Q&edm=AA0rjkIBAAAA&ccb=7-5&ig_cache_key=MzY0Mzc4OTAzMjYzNjkyODE2Nw%3D%3D.3-ccb7-5&oh=00_AfJqtz5TcCYssJ4E1pp7vH2lJF8woclnOxRL-3YuM37C8Q&oe=683F510B&_nc_sid=49ed71",
    "edge_liked_by": {
      "count": 0
    },
    "edge_media_preview_like": {
      "count": 0
    },
    "owner": {
      "id": "62435171234"
    },
    "thumbnail_src": "https://scontent-mia3-2.cdninstagram.com/v/t51.2885-15/502141803_17904432705083235_163772018496534203_n.webp?stp=dst-jpg_e35_s640x640_sh0.08_tt6&_nc_ht=scontent-mia3-2.cdninstagram.com&_nc_cat=103&_nc_oc=Q6cZ2QHIgaQiclxByKMRa5qXpH5OpOcMZEbtVpBQLuo3ILJNjssr3ONIXjWPrTPwG0ZioYCCkBatNynE7MuJRg3llOaj&_nc_ohc=6RDY-FxwTNsQ7kNvwEfcF5-&_nc_gid=8gqgXS4TLjsrWZfw_VxK0Q&edm=AA0rjkIBAAAA&ccb=7-5&ig_cache_key=MzY0Mzc4OTAzMjYzNjkyODE2Nw%3D%3D.3-ccb7-5&oh=00_AfKKm1NmZgVTq9vnwvEro1x8jNcZUpaM0tjvFB0LS7yZhA&oe=683F510B&_nc_sid=49ed71",
    "thumbnail_resources": [
      {
        "src": "https://scontent-mia3-2.cdninstagram.com/v/t51.2885-15/502141803_17904432705083235_163772018496534203_n.webp?stp=dst-webp_s150x150&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xMDgweDEwODAuc2RyLmY3NTc2MS5kZWZhdWx0X2ltYWdlIn0&_nc_ht=scontent-mia3-2.cdninstagram.com&_nc_cat=103&_nc_oc=Q6cZ2QHIgaQiclxByKMRa5qXpH5OpOcMZEbtVpBQLuo3ILJNjssr3ONIXjWPrTPwG0ZioYCCkBatNynE7MuJRg3llOaj&_nc_ohc=6RDY-FxwTNsQ7kNvwEfcF5-&_nc_gid=8gqgXS4TLjsrWZfw_VxK0Q&edm=AA0rjkIBAAAA&ccb=7-5&oh=00_AfKrQogcCJyvn-F_5CCN1ajkQDdk4dG3tXUOVKGxNAhvCQ&oe=683F510B&_nc_sid=49ed71",
        "config_width": 150,
        "config_height": 150
      },
      {
        "src": "https://scontent-mia3-2.cdninstagram.com/v/t51.2885-15/502141803_17904432705083235_163772018496534203_n.webp?stp=dst-webp_s240x240&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xMDgweDEwODAuc2RyLmY3NTc2MS5kZWZhdWx0X2ltYWdlIn0&_nc_ht=scontent-mia3-2.cdninstagram.com&_nc_cat=103&_nc_oc=Q6cZ2QHIgaQiclxByKMRa5qXpH5OpOcMZEbtVpBQLuo3ILJNjssr3ONIXjWPrTPwG0ZioYCCkBatNynE7MuJRg3llOaj&_nc_ohc=6RDY-FxwTNsQ7kNvwEfcF5-&_nc_gid=8gqgXS4TLjsrWZfw_VxK0Q&edm=AA0rjkIBAAAA&ccb=7-5&oh=00_AfIJxMWiU9NOnldrVUqktwqibV1QsJ9CQ9r7J--fqBsgZQ&oe=683F510B&_nc_sid=49ed71",
        "config_width": 240,
        "config_height": 240
      },
      {
        "src": "https://scontent-mia3-2.cdninstagram.com/v/t51.2885-15/502141803_17904432705083235_163772018496534203_n.webp?stp=dst-webp_s320x320&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xMDgweDEwODAuc2RyLmY3NTc2MS5kZWZhdWx0X2ltYWdlIn0&_nc_ht=scontent-mia3-2.cdninstagram.com&_nc_cat=103&_nc_oc=Q6cZ2QHIgaQiclxByKMRa5qXpH5OpOcMZEbtVpBQLuo3ILJNjssr3ONIXjWPrTPwG0ZioYCCkBatNynE7MuJRg3llOaj&_nc_ohc=6RDY-FxwTNsQ7kNvwEfcF5-&_nc_gid=8gqgXS4TLjsrWZfw_VxK0Q&edm=AA0rjkIBAAAA&ccb=7-5&oh=00_AfLmjmqHVajLJe0F2RnuVDSnpf6Fegx8Jgmevq7SAkct8A&oe=683F510B&_nc_sid=49ed71",
        "config_width": 320,
        "config_height": 320
      },
      {
        "src": "https://scontent-mia3-2.cdninstagram.com/v/t51.2885-15/502141803_17904432705083235_163772018496534203_n.webp?stp=dst-webp_s480x480&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xMDgweDEwODAuc2RyLmY3NTc2MS5kZWZhdWx0X2ltYWdlIn0&_nc_ht=scontent-mia3-2.cdninstagram.com&_nc_cat=103&_nc_oc=Q6cZ2QHIgaQiclxByKMRa5qXpH5OpOcMZEbtVpBQLuo3ILJNjssr3ONIXjWPrTPwG0ZioYCCkBatNynE7MuJRg3llOaj&_nc_ohc=6RDY-FxwTNsQ7kNvwEfcF5-&_nc_gid=8gqgXS4TLjsrWZfw_VxK0Q&edm=AA0rjkIBAAAA&ccb=7-5&oh=00_AfLOOsdE2FMTgo6rzONzUTPbSB16QpMQgzjbTk0RDm8XRA&oe=683F510B&_nc_sid=49ed71",
        "config_width": 480,
        "config_height": 480
      },
      {
        "src": "https://scontent-mia3-2.cdninstagram.com/v/t51.2885-15/502141803_17904432705083235_163772018496534203_n.webp?stp=dst-webp_s640x640_sh0.08&efg=eyJ2ZW5jb2RlX3RhZyI6ImltYWdlX3VybGdlbi4xMDgweDEwODAuc2RyLmY3NTc2MS5kZWZhdWx0X2ltYWdlIn0&_nc_ht=scontent-mia3-2.cdninstagram.com&_nc_cat=103&_nc_oc=Q6cZ2QHIgaQiclxByKMRa5qXpH5OpOcMZEbtVpBQLuo3ILJNjssr3ONIXjWPrTPwG0ZioYCCkBatNynE7MuJRg3llOaj&_nc_ohc=6RDY-FxwTNsQ7kNvwEfcF5-&_nc_gid=8gqgXS4TLjsrWZfw_VxK0Q&edm=AA0rjkIBAAAA&ccb=7-5&oh=00_AfLURSELSUpNeGfnINqbfvlA27m2IEACvc51CIacnQ-ozQ&oe=683F510B&_nc_sid=49ed71",
        "config_width": 640,
        "config_height": 640
      }
    ],
    "is_video": false,
    "accessibility_caption": "Photo by caur nailart on May 30, 2025.",
    "scrapedAt": "2025-05-30T08:25:29.478Z"
  },
  ...
]
```

### Notes

- The actor will automatically paginate through results until the `maxResults` limit is reached or no more data is available.
- Each post includes a `scrapedAt` timestamp indicating when it was collected.

***

**Enjoy fast and reliable Instagram hashtag media scraping with this actor!**

# Actor input Schema

## `query` (type: `string`):

The hashtag to fetch media from (without #).

## `maxResults` (type: `integer`):

Maximum number of posts to fetch.

## Actor input object example

```json
{
  "query": "fashion",
  "maxResults": 30
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("powerai/instagram-hashtag-media-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 = {}

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

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

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

```

## CLI example

```bash
echo '{}' |
apify call powerai/instagram-hashtag-media-scraper --silent --output-dataset

```

## MCP server setup

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

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

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1Dub89OO2aSNJLugL/builds/GoDAsLSvyTX8pJFce/openapi.json
