# Instagram Posts Scraper - Captions & Hashtags (`orkait/instagram-posts-scraper`) Actor

Scrape Instagram posts from any creator. Add usernames and extract captions, hashtags, mentions, tagged users, likes, comment counts, location, carousel images and timestamps. Filter posts by engagement or date and sort server-side. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/orkait/instagram-posts-scraper.md
- **Developed by:** [orkait](https://apify.com/orkait) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 1,000 posts

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 Posts Scraper

**A creator's feed is a strategy document. This turns it into rows.**

Scrape Instagram posts from any public creator. Just add Instagram usernames to get captions, hashtags, mentions, likes, comments, image URLs, location and timestamps. Export Instagram post data to JSON, CSV or Excel, or run it on a schedule.

### ✨ 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 Posts Scraper?

#### Audit a content strategy

Pull a year of posts, sort by likes, and the winning formats separate themselves.

```json
{
  "targets": ["creator_username"],
  "limit": 200,
  "sortBy": "like_count",
  "sortOrder": "desc"
}
```

#### Get the hashtags without writing a regex

Hashtags and mentions arrive already parsed out of every caption.

```json
{
  "targets": ["brand_account"],
  "filters": { "posted_after": "2026-01-01T00:00:00Z" }
}
```

#### Monitor a brand account

Run it on a schedule and diff the output to catch new posts, campaigns and partnerships.

```json
{
  "targets": ["brand_account"],
  "filters": { "paid_partnership_only": true }
}
```

### 🧾 What can Instagram Posts Scraper do?

- Scrape all Instagram posts from any public account
- Get likes, comments and view counts per post
- Extract captions with hashtags and mentions already parsed out
- Get image URLs, dimensions and carousel counts
- Filter Instagram posts by engagement, date or hashtag
- Sort posts by newest or most liked

### 📋 What data can I scrape from Instagram posts?

| Field | Description |
|---|---|
| `id` | Instagram media ID |
| `shortcode` | Post shortcode |
| `url` | Post permalink |
| `kind` | `post` or `reel` |
| `caption` | Post caption |
| `like_count` | Likes |
| `comment_count` | Comments |
| `view_count` | Views |
| `taken_at` | Publish time, UTC |
| `owner_username` | Creator username |
| `owner_id` | Creator Instagram ID |
| `hashtags` | Hashtags parsed from the caption |
| `mentions` | Mentions parsed from the caption |
| `image_urls` | Image URLs, including carousels |
| `thumbnail_url` | Cover image |
| `width` / `height` | Media dimensions |
| `location` | Tagged location |
| `is_paid_partnership` | Sponsored content flag |

### ▶️ How to scrape Instagram posts

1. Add your Instagram creator usernames 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 | Instagram creator usernames. |
| `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": [
    "natgeo"
  ],
  "limit": 50,
  "sortBy": "like_count",
  "sortOrder": "desc",
  "filters": {
    "posted_after": "2026-01-01T00:00:00Z"
  }
}
```

### 🎛️ How to filter and sort Instagram posts

| Filter | Effect |
|---|---|
| `kind` | `post` or `reel` |
| `min_like_count` / `min_comment_count` | Engagement floors |
| `posted_after` / `posted_before` | Date window |
| `caption_contains` | Substring match on the caption |
| `hashtags_any` | Keep posts 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 posts data sample

```json
{
  "id": "3957463127796339198",
  "shortcode": "Dbru79IAdH-",
  "url": "https://www.instagram.com/p/Dbru79IAdH-/",
  "kind": "post",
  "caption": "A new era begins... #wildlife",
  "like_count": 189113,
  "comment_count": 1241,
  "taken_at": "2026-08-06T14:04:20Z",
  "owner_username": "natgeo",
  "hashtags": [
    "wildlife"
  ],
  "mentions": [
    "natgeowild"
  ],
  "image_urls": [
    "https://..."
  ],
  "is_paid_partnership": false
}
```

### 🛡️ 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 many Instagram posts can I scrape?

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

#### Can I scrape Instagram posts by date?

Yes. `filters.posted_after` and `filters.posted_before` set a date window, and naive values are read as UTC.

#### Can I get hashtags from Instagram posts?

Hashtags and mentions are parsed out of every caption into arrays, so you never write the regex yourself.

#### Can I scrape both Instagram posts and reels?

Yes, both come back by default. Set `filters.kind` to `post` or `reel` to narrow it.

#### How do I get the most liked Instagram posts?

Set **Sort by** to Likes.

#### Can I scrape Instagram carousel posts?

Yes. `image_urls` returns every image in a carousel, not only the cover.

### 🔗 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 Search Scraper](https://apify.com/orkait/instagram-search-scraper)

# Actor input Schema

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

One or more Instagram creator usernames.

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

Maximum items returned per target, after filtering.

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

Which field to order results by. Leave empty for the default (Newest first).

## `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": [
    "natgeo"
  ],
  "limit": 15,
  "sortOrder": "desc",
  "filters": {}
}
```

# Actor output Schema

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

Every post returned 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": [
        "natgeo"
    ],
    "limit": 15
};

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

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

```

## MCP server setup

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