# Instagram Hashtag Scraper - Top Posts by Hashtag or Keyword (`aolmo/instagram-hashtag`) Actor

Top Instagram posts for any hashtag or keyword without login: up to 12 featured posts per hashtag with caption, author, image, video and plays, exactly as Instagram shows them to visitors. New-post detection on scheduled runs. $0.002 per hashtag with results.

- **URL**: https://apify.com/aolmo/instagram-hashtag.md
- **Developed by:** [Antonio del Olmo Tena](https://apify.com/aolmo) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 hashtag scrapeds

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

Scrape the top Instagram posts of any hashtag or keyword without logging in, without API keys and without cookies. Paste hashtags, keywords or hashtag URLs and get one row per featured post with caption, author, image, video, plays and the post URL, exactly as Instagram shows them to visitors. Schedule it and the Actor flags the posts that are new since the previous run: trend monitoring, content research, influencer discovery and campaign tracking at $0.002 per hashtag.

The Actor reads what Instagram shows to a logged-out visitor on the hashtag page (the "popular" view), through residential connections that Instagram does not block.

### What you get

One row per featured post, up to 12 per hashtag:

- `hashtag`, `hashtagUrl`, `postsFound` (featured posts returned for the hashtag), `position`.
- `code`, `url`, `type` (`image`, `video` or `carousel`), `productType` (`feed`, `clips` for reels, `carousel_container`).
- `caption`, `postedOn` (date from Instagram's accessibility text when available), `accessibilityCaption`.
- `image`, `videoUrl`, `plays` (video plays when Instagram publishes them).
- `username` of the author.
- `isNew`: true when the post was not among the featured posts of the previous run (null on the first run).

Instagram publishes a logged-out "popular" page only for part of its hashtags (broad topics such as `travel`, `space`, `nature`); hashtags without a public page (for example `food` or `coffee`, which require an account) return a row with an `error` field and are not charged, and hashtags whose public page has no posts return a single row with `postsFound: 0`, also free.

### How to use it

1. Open the **Input** tab.
2. Add **Hashtags or keywords**: `travel`, `#foodie` or `https://www.instagram.com/explore/tags/nasa/`, one per line (up to 500 per run).
3. Click **Start** and export the rows as JSON, CSV or Excel.
4. Schedule the Actor (for example daily) to catch new featured posts and the creators behind them.

### Input

```json
{
  "hashtags": ["travel", "space"]
}
```

| Field | Description |
|-------|-------------|
| `hashtags` | Hashtags (with or without `#`), keywords or hashtag URLs. Up to 500 per run. |

### Output example

```json
{
  "hashtag": "travel",
  "hashtagUrl": "https://www.instagram.com/explore/tags/travel/",
  "postsFound": 12,
  "position": 1,
  "code": "DTfS7SMEk8B",
  "url": "https://www.instagram.com/p/DTfS7SMEk8B/",
  "type": "video",
  "productType": null,
  "caption": "Switzerland all the year 🇨🇭 Which one is your preferred month? #switzerland #travel",
  "postedOn": null,
  "image": "https://scontent.cdninstagram.com/v/...",
  "videoUrl": "https://instagram.famm10-2.fna.fbcdn.net/o1/v/...",
  "plays": 30216709,
  "username": "life_samour_style",
  "isNew": true
}
```

### Pricing

Pay per event, no subscription:

- **Hashtag scraped**: $0.002 per hashtag or keyword with results (all its featured posts included).
- **New post**: $0.0005 per post that was not featured in the previous run (scheduled runs only).

Hashtags without public posts are free. 500 hashtags cost $1.

### Tips

- Feed the `url` column into the **Instagram Post Scraper** for likes, comments, tagged users and full media of each post.
- Feed the `username` column into the **Instagram Profile Scraper** to vet the creators behind a trend.
- Keywords work too: Instagram treats the input as a search term, so `coffee shop` returns the featured posts for that topic.

### Limitations

- Instagram shows logged-out visitors the featured posts only (up to 12); the full post count of the hashtag, the "recent" tab and pagination are not available without an account.
- Only hashtags with a public page work; Instagram asks for a login on the rest (the row carries the error and is free). Try broad topics first.
- Likes and comments live on each post page (use the Instagram Post Scraper).
- The Actor respects Instagram's pace: expect roughly one hashtag per second.

# Actor input Schema

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

One per line: travel, #foodie or https://www.instagram.com/explore/tags/nasa/. Up to 500 per run.

## `product` (type: `string`):

Internal. Leave as is.

## Actor input object example

```json
{
  "hashtags": [
    "travel",
    "space"
  ],
  "product": "instagram-hashtag"
}
```

# Actor output Schema

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

Dataset items: url, changed, events, data, timestamp and error (when the target failed).

# 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",
        "space"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("aolmo/instagram-hashtag").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",
        "space",
    ] }

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

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

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

```

## CLI example

```bash
echo '{
  "hashtags": [
    "travel",
    "space"
  ]
}' |
apify call aolmo/instagram-hashtag --silent --output-dataset

```

## MCP server setup

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

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/qZlzyGw4qxJYDETsS/builds/58UsHXfQfdGFSxZwC/openapi.json
