# Instagram Search Scraper - Keyword & Hashtag (`orkait/instagram-search-scraper`) Actor

Search Instagram by keyword or hashtag and scrape every matching post and reel. Add a search phrase to get captions, hashtags, engagement counts and creator details, ranked by Instagram relevance. Narrow results to reels only and export to JSON, CSV or Excel.

- **URL**: https://apify.com/orkait/instagram-search-scraper.md
- **Developed by:** [orkait](https://apify.com/orkait) (community)
- **Categories:** Social media, SEO tools
- **Stats:** 3 total users, 2 monthly users, 25.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$0.75 / 1,000 search 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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Search Scraper

**You do not always know whose account to look at. Search finds it anyway.**

Search Instagram by keyword and scrape the matching posts and reels. Just add a search phrase to get captions, hashtags, mentions, likes, comments, play counts and creator details, ranked by Instagram's own relevance.

### ✨ What makes this Instagram scraper different

| | Most Instagram scrapers | This one |
|---|---|---|
| **Filtering** | Returns everything, you filter afterwards | Filters **before** counting, so you pay for matches |
| **Sorting** | Whatever order the platform gave | Enforced with a stable tiebreaker, identical every run |
| **Missing data** | A silent `0` you cannot distinguish from a real zero | Named in `meta.fields_unavailable` |
| **Bad input** | Burns a run, then fails | Rejected before the request is made |

### 🎯 What can I do with Instagram Search Scraper?

#### Find creators you have never heard of

Search your category and read `owner_username` off the results. That is a discovery list built from what Instagram itself ranks highest.

```json
{
  "targets": ["sustainable skincare"],
  "limit": 50
}
```

#### Turn it into a reels search

One filter narrows the whole thing to short-form video.

```json
{
  "targets": ["home workout"],
  "filters": { "kind": "reel", "min_play_count": 50000 }
}
```

#### Track a phrase you do not own

Campaign hashtags spread to accounts you have never seen. Search catches them; a username list cannot.

```json
{
  "targets": ["your campaign phrase"],
  "filters": { "posted_after": "2026-08-01T00:00:00Z" }
}
```

### 🧾 What can Instagram Search Scraper do?

- Search Instagram by any keyword or phrase
- Scrape the posts and reels that match your search
- Discover Instagram creators talking about your product or category
- Narrow an Instagram search to reels only
- Filter search results by engagement, date or hashtag
- Keep Instagram's relevance ranking, or sort by performance instead

### 📋 What data can I scrape from Instagram search results?

| Field | Description |
|---|---|
| `id` | Instagram media ID |
| `shortcode` | Shortcode |
| `url` | Permalink |
| `kind` | `post` or `reel` |
| `caption` | Caption |
| `like_count` | Likes |
| `comment_count` | Comments |
| `play_count` | Plays, for reels |
| `taken_at` | Publish time, UTC |
| `owner_username` | Creator username |
| `hashtags` | Hashtags parsed from the caption |
| `mentions` | Mentions parsed from the caption |
| `thumbnail_url` | Cover image |
| `video_url` | Direct video URL, for reels |

### ▶️ How to scrape Instagram search results

1. Add your a single keyword or phrase to **targets**
2. Set `limit`, and optionally **Sort by** and `filters`
3. Click **Start**
4. Download the dataset as JSON, CSV, Excel or XML, or pull it from the API

### ⬇️ Input

| Field | Required | Description |
|---|:--:|---|
| `targets` | yes | A single keyword or phrase. |
| `limit` | no | Max items per target, applied after filtering. Default 15, max 5000. |
| `sortBy` | no | Pick a field to order by. Leave empty for the default order. |
| `sortOrder` | no | Highest first or lowest first. Defaults to highest first. |
| `filters` | no | Applied before sorting and before the limit. |

```json
{
  "targets": [
    "hammerhead shark"
  ],
  "limit": 30,
  "filters": {
    "kind": "reel",
    "min_play_count": 50000
  }
}
```

### 🎛️ How to filter and sort Instagram search results

| Filter | Effect |
|---|---|
| `kind` | **`reel` turns this into an Instagram reels search** |
| `min_play_count` / `min_like_count` | Performance floors |
| `posted_after` / `posted_before` | Date window |
| `caption_contains` | Substring match on the caption |
| `hashtags_any` | Keep results using any of these hashtags |
| `paid_partnership_only` | Only sponsored content |

Filters run before the row count, so a narrow filter costs less than a broad one.
Sorting is applied with a stable tiebreaker, so two identical runs return
identical order, and the sort you pick is applied server-side, not left to the platform.

### ⬆️ Output

One row per item, exportable as JSON, CSV, Excel or XML, or straight from the API.

#### 🔍 Extracted Instagram search results data sample

```json
{
  "id": "3963946321739534979",
  "shortcode": "DcCxC2AAFKD",
  "url": "https://www.instagram.com/p/DcCxC2AAFKD/",
  "kind": "reel",
  "caption": "Hammerhead sharks up close...",
  "play_count": 580358,
  "like_count": 3312,
  "owner_username": "natgeo",
  "hashtags": [
    "hammerheadsharksupclose"
  ]
}
```

### 🛡️ Why results stay reliable when Instagram changes

Instagram changes what it returns. When a field stops being available it does not
vanish from the schema: it comes back empty and `meta.fields_unavailable` names
it. You branch on that instead of guessing why a number is zero.

### ❓ FAQ

#### How do I search Instagram by keyword?

Put your phrase in `targets` and run it. Results come back ranked by Instagram's own relevance unless you choose a **Sort by** field.

#### Can I search Instagram for reels only?

Yes. Set `filters.kind` to `reel` and only reels are returned.

#### Can I find Instagram creators by topic?

Yes. Search the topic and read `owner_username` from the results, then enrich those accounts with the Instagram Profile Scraper.

#### Does this Instagram search scraper keep relevance order?

By default yes. Leaving **Sort by** empty preserves Instagram's ranking, which is usually what you want for discovery.

#### How many Instagram search results can I get?

Up to 5000 per run via `limit`, applied after filtering.

#### Why would I use search instead of a username list?

Because a username list only finds accounts you already know. Search finds the ones you do not.

### 🔗 Scrape more from Instagram

- 💬 [Instagram Comments Scraper](https://apify.com/orkait/instagram-comments-scraper)
- 👤 [Instagram Profile Scraper](https://apify.com/orkait/instagram-profile-scraper)
- 🎬 [Instagram Reels Scraper](https://apify.com/orkait/instagram-reels-scraper)
- 📸 [Instagram Posts Scraper](https://apify.com/orkait/instagram-posts-scraper)

# Actor input Schema

## `targets` (type: `array`):

A single keyword or phrase to search Instagram for.

## `limit` (type: `integer`):

Maximum items returned per target, after filtering.

## `sortBy` (type: `string`):

Which field to order results by. Leave empty for the default (Instagram's own relevance ranking).

## `sortOrder` (type: `string`):

Highest first, or lowest first.

## `filters` (type: `object`):

Applied before sorting and before the limit. Accepts: kind, min\_like\_count, min\_comment\_count, min\_play\_count, posted\_after, posted\_before, caption\_contains, hashtags\_any, paid\_partnership\_only.

## Actor input object example

```json
{
  "targets": [
    "hammerhead shark"
  ],
  "limit": 15,
  "sortOrder": "desc",
  "filters": {}
}
```

# Actor output Schema

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

Every result matched by this run, one row each.

# 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 = {
    "targets": [
        "hammerhead shark"
    ],
    "limit": 15
};

// Run the Actor and wait for it to finish
const run = await client.actor("orkait/instagram-search-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 = {
    "targets": ["hammerhead shark"],
    "limit": 15,
}

# Run the Actor and wait for it to finish
run = client.actor("orkait/instagram-search-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 '{
  "targets": [
    "hammerhead shark"
  ],
  "limit": 15
}' |
apify call orkait/instagram-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,orkait/instagram-search-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/ZfKUV7HxVv3FcNwRE/builds/0qKkbECOjbec9th5z/openapi.json
