# Instagram Scraper: Posts, Reels, Comments & Profiles (`apisamurai/instagram-scraper`) Actor

Instagram scraper for public posts, reels, comments and profiles. By username, post link or reels keyword. No login needed, exact limits, real date and engagement filters, and you pay only for real, unique rows.

- **URL**: https://apify.com/apisamurai/instagram-scraper.md
- **Developed by:** [API Samurai](https://apify.com/apisamurai) (community)
- **Stats:** 2 total users, 1 monthly users, 88.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 post or reels

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 Scraper: Posts, Reels, Comments & Profiles

This Instagram scraper gets public posts and reels from any public profile, full details of posts you link to, reels found by keyword, the comments under them, and profile details. Every post comes with caption, hashtags, mentions, likes, comment count, views for reels, duration, photo and video links, carousel items, location and owner. You pay only for real, unique rows, and IDs are always text, so long Instagram IDs never get rounded.

### What you can use it for

- **Scrape an Instagram profile** to collect its posts, its reels, or both, for competitor and creator research.
- **Scrape Instagram reels** by keyword to find trending content and creators in a niche.
- **Scrape Instagram comments** to read audience reactions for sentiment analysis and community management.
- **Fetch single posts or reels** from links to fill in likes, views and captions for content you already track.
- **Get Instagram profile data** (bio, followers, following, category, website) for influencer lists.
- **Build AI and NLP datasets** of captions and comments with dates and engagement numbers.

### Fair billing

- Only real posts, comments and profiles are charged. No demo, mock or placeholder rows, ever. If the data source sends one, it is dropped and counted in the run summary.
- No start fee, no per-run fee, no per-query fee, no minimum charge.
- Same price on every Apify plan, free plan included.
- Free Apify plan: up to 100 results per run (10 posts fetched by link, 10 profiles), so you can try it. Paid plans have no limit.
- Date and engagement filters and limits are enforced by the Actor itself. Posts outside your dates or filters are skipped and not charged.
- `Max posts per input item` and `Max comments per post` are exact: you never get, or pay for, more than you asked.
- Duplicates are never charged. A reel found in a profile feed and in its Reels tab is saved once.
- Private or missing profiles and posts cost nothing.
- When you hit your spending limit, the run stops cleanly.

### How to use

1. Open the [Instagram Scraper](https://apify.com/apisamurai/instagram-scraper) page and click **Try for free** (you sign in to your Apify account).
2. Fill in at least one source: profiles, post or reel links, or reels search keywords.
3. Set **Max posts per input item**, and optionally comments, dates and filters.
4. Click **Start**. Rows appear in the **Output** tab while the run works.
5. Export the dataset as JSON, CSV or Excel, or check the `SUMMARY` record in the key-value store.

**API:** start a run and get the rows in one call with `POST https://api.apify.com/v2/acts/apisamurai~instagram-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>` and the input as JSON in the body.

### Input

| Field | What it does |
|---|---|
| Profiles | Usernames or links: `natgeo`, `@natgeo`, `https://www.instagram.com/natgeo/`. |
| What to get from profiles | `posts` (default, the profile feed), `reels` (the Reels tab) or `both`. |
| Add a profile row per username | Off by default. Adds one row with the profile's details. |
| Post or reel links | Full details of these posts or reels. Links or shortcodes. |
| Search reels by keyword | Public reels matching each keyword. |
| Get comments / Max comments per post | Off by default. Up to 50 comments per post unless you change it. |
| Max posts per input item | Per profile (and content type) or keyword. Default 50. |
| Max rows for the whole run | Optional hard cap on all rows, comments and profiles included. |
| Posted on or after / on or before | Inclusive, UTC. |
| Min likes, Min views | Skip posts below these numbers. |

```json
{
  "profiles": ["natgeo", "nasa"],
  "contentType": "both",
  "includeComments": true,
  "maxCommentsPerPost": 20,
  "maxItemsPerSource": 30,
  "postedAfter": "2026-01-01"
}
```

### Output

One row per post, reel, comment or profile; `type` tells them apart. Field names never change between runs. Example (shortened):

```json
{
  "type": "reel",
  "id": "3600545900919030401",
  "shortcode": "DH3tWudxIKB",
  "url": "https://www.instagram.com/reel/DH3tWudxIKB/",
  "caption": "Dana is neglecting a pretty important level of the food pyramid @danabeers @francisccellis",
  "hashtags": [],
  "mentions": ["danabeers", "francisccellis"],
  "postedAt": "2025-03-31T16:29:30.000Z",
  "likes": 387,
  "commentsCount": 12,
  "views": 35499,
  "durationSeconds": 76.717,
  "media": [{ "type": "video", "url": "https://instagram.fcps3-1.fna.fbcdn.net/v/...jpg", "videoUrl": "https://instagram.fcps3-1.fna.fbcdn.net/o1/...mp4" }],
  "isCarousel": false,
  "isPinned": false,
  "location": null,
  "owner": { "id": "260462810", "username": "barstoolsports", "fullName": "Barstool Sports", "verified": true },
  "source": "posts",
  "input": "barstoolsports",
  "scrapedAt": "2026-04-02T10:00:00.000Z"
}
```

Comment rows have `type: "comment"`, `id`, `postShortcode`, `postUrl`, `text`, `author`, `authorVerified`, `likes`, `repliesCount`, `postedAt`, `scrapedAt`. Profile rows have `type: "profile"`, `id`, `username`, `fullName`, `bio`, `followers`, `following`, `postsCount`, `verified`, `isBusiness`, `category`, `externalUrl`, `profilePicUrl`, `scrapedAt`. Missing values are `null`, never a fake 0. `views` is `null` for photos.

Each run also writes a `SUMMARY` record to the key-value store. For every input item it lists posts and comments delivered, rows skipped by dates or filters, duplicates, placeholder rows dropped, and why it stopped (`limit reached`, `no more results`, `private or not found`, `temporary error`, `spending limit`, `free plan limit` or `data source unavailable`).

### Pricing

$1.50 per 1,000 posts or reels; $6.50 per 1,000 posts fetched by link; $1 per 1,000 comments; $6.50 per 1,000 profiles

### Integrations

- **Apify API** to start runs and read datasets from any language.
- **Python and JavaScript clients** (`apify-client`) for scripts and backends.
- **Zapier, Make and n8n** to send new posts to Google Sheets, Slack, a CRM or a database.
- **MCP for AI agents:** connect the Apify MCP server to Claude, ChatGPT or another MCP client and the agent can run this Actor as a tool.
- **Schedules and webhooks** in Apify Console for daily or hourly runs.

### FAQ

**Do I need an Instagram account or login?**
No. You only need an Apify account. You never enter Instagram credentials, cookies or a session.

**How many posts can I get?**
Up to 100,000 posts per input item on paid plans, and up to 100 results per run on the free Apify plan. Reels search returns at most 11 result pages per keyword.

**Why did I get fewer results than I asked for?**
Open the `SUMMARY` record. It says for each input why it stopped: no more results, posts skipped by your dates or filters, duplicates, a private profile, the spending limit or the free plan limit. `Min views` skips rows without a view count, such as photos.

**Can it scrape private accounts?**
No. Only public data is collected. A private or missing profile is reported as `private or not found` and costs nothing. With **Add a profile row** on, a private profile can still return its public details (bio, follower counts).

**Can I schedule it?**
Yes. Create a schedule in Apify Console, for example a daily profile run with `Posted on or after` set, and connect an integration to get the new rows.

**Which export formats are there?**
JSON, CSV, Excel, XML, HTML and JSONL from the dataset, or the API.

**Is it legal to scrape Instagram?**
The Actor collects only public data. You are responsible for how you use it: follow Instagram's terms and the laws where you live, and take care with personal data (for example under GDPR). This is not legal advice.

### Tips

- Use `Posted on or after` for profiles: the run stops paging once the feed is past that date, so fewer requests are needed.
- Set `Max rows for the whole run` when you get comments for many posts and want a firm total.

# Actor input Schema

## `profiles` (type: `array`):

Get the posts or reels of these public accounts. Usernames or profile links: natgeo, @natgeo or https://www.instagram.com/natgeo/. One per line.

## `contentType` (type: `string`):

Posts gives the profile's feed (photos, carousels and the reels shown in the grid). Reels gives the Reels tab. Both gives both; a reel found in both is saved once.

## `includeProfile` (type: `boolean`):

On: also save one row with each profile's details (bio, followers, following, posts count, category).

## `postUrls` (type: `array`):

Fetch full details of these posts or reels, e.g. https://www.instagram.com/p/DH3tWudxIKB/ or just the shortcode DH3tWudxIKB. One per line.

## `searchReels` (type: `array`):

Find public reels matching these keywords, one per line. Up to 11 result pages per keyword.

## `includeComments` (type: `boolean`):

On: also save the comments of every post and reel in the results (one row per comment).

## `maxCommentsPerPost` (type: `integer`):

Maximum comments saved for each post or reel. Enforced exactly.

## `maxItemsPerSource` (type: `integer`):

Maximum posts or reels for each profile (and content type) or search keyword. Enforced exactly: the last page is trimmed.

## `maxTotalItems` (type: `integer`):

Optional hard cap on all rows (posts, reels, comments and profiles) across the run. Leave empty for no total cap.

## `postedAfter` (type: `string`):

Only posts and reels published on or after this day (UTC). Posts outside the range are skipped and not charged.

## `postedBefore` (type: `string`):

Only posts and reels published on or before this day (UTC, the whole day is included).

## `minLikes` (type: `integer`):

Skip posts and reels with fewer likes. Posts with hidden like counts are skipped when this is set.

## `minViews` (type: `integer`):

Skip posts and reels with fewer views. Rows without a view count, such as photos, are skipped when this is set.

## Actor input object example

```json
{
  "profiles": [
    "natgeo"
  ],
  "contentType": "posts",
  "includeProfile": false,
  "includeComments": false,
  "maxCommentsPerPost": 50,
  "maxItemsPerSource": 12
}
```

# Actor output Schema

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

No description

## `summary` (type: `string`):

No description

# 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 = {
    "profiles": [
        "natgeo"
    ],
    "maxItemsPerSource": 12
};

// Run the Actor and wait for it to finish
const run = await client.actor("apisamurai/instagram-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 = {
    "profiles": ["natgeo"],
    "maxItemsPerSource": 12,
}

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

```

## MCP server setup

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