# Instagram Comment Scraper (`datascrapers/instagram-comment-scraper`) Actor

Instagram comment dataset from post and reel URLs, including usernames, comment text, likes, timestamps, and profile links.

- **URL**: https://apify.com/datascrapers/instagram-comment-scraper.md
- **Developed by:** [Farhan Ali](https://apify.com/datascrapers) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 comments

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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 Comment Scraper** creates a structured dataset of comment records collected from [Instagram](https://www.instagram.com) posts and reels. Each dataset item represents one comment and can include the comment identifier, username, text, like count, timestamp, source post URL, and commenter profile fields (profile link, profile image URL, and a nested `user` object with username and verification status). Query the source with Instagram post or reel URLs in `post_urls`, control the per-post limit with `max_comments`, and retrieve records through the Apify Dataset API or export them as JSON, CSV, Excel, XML, or another supported format.

### Dataset at a glance

| Property | Value |
|---|---|
| Source | instagram.com (public posts and reels) |
| Record unit | One comment |
| Input methods | Instagram post or reel URLs (`post_urls`) |
| Main identifiers | `pk`, `post_url` |
| Delivery | Apify Dataset and API |
| Export formats | JSON, CSV, Excel, XML, HTML (Apify dataset exports) |
| Update model | Fresh records per Actor run |
| Pricing | $0.00005 start; $0.0015 per comment ($1.50 per 1,000 comments) |

### Coverage and available records

The Actor collects publicly visible comments from each Instagram post or reel URL supplied in `post_urls`.

Supported coverage:

- **Post URLs** such as `https://www.instagram.com/p/{shortcode}/`.
- **Reel URLs** in the same `post_urls` list.
- **Multiple URLs per run**, processed with `posts_concurrency` (default `2`).
- **Per-post comment cap** via `max_comments` (default `100`; `0` means unlimited). Each dataset item is one comment, not one post.

Observed field groups on each comment: comment identity (`pk`), comment body (`text`), engagement (`comment_like_count`), timestamp (`created_at`), source post (`post_url`), and commenter profile fields (`username`, `profile_link`, `profile_pic_url`, nested `user`).

Known exclusions: comments Instagram does not show publicly are not collected; Stories, DMs, hashtag search, and profile-level comment harvests are not supported; each run captures comments visible at run time (no historical snapshots).

### Data dictionary

Field names below match dataset record JSON properties exactly. `pk` is the best stable field for deduplication.

#### Comment-level fields

| Field | Type | Nullable | Description | Example |
|---|---|---:|---|---|
| `pk` | string | No | Instagram comment identifier; recommended deduplication key | `18121785391719030` |
| `username` | string | No | Commenter Instagram username | `mc_gang04` |
| `text` | string | No | Comment body as shown on the post | `😍` |
| `comment_like_count` | integer | Yes | Number of likes on the comment at collection time | `0` |
| `created_at` | string | Yes | Comment timestamp (`YYYY-MM-DDTHH:MM:SS`, no timezone offset) | `2026-04-13T16:50:18` |
| `post_url` | string | No | Source Instagram post or reel URL | `https://www.instagram.com/p/DWte0fylh5b/` |
| `profile_link` | string | Yes | Commenter profile URL | `https://www.instagram.com/mc_gang04/` |
| `profile_pic_url` | string | Yes | Commenter profile image URL (Instagram CDN) | Instagram CDN URL |
| `user` | object | Yes | Nested commenter object; see table below | See example record |

#### Nested `user` object

| Field | Type | Nullable | Description | Example |
|---|---|---:|---|---|
| `is_verified` | boolean | Yes | Whether Instagram marks the commenter verified | `false` |
| `username` | string | Yes | Commenter username (same handle as the top-level `username` when present) | `mc_gang04` |

Values such as `comment_like_count` and `created_at` are read from Instagram at run time. `post_url` is the input URL that produced the comment. Profile image URLs are source CDN links and can expire after collection.

### Example dataset record

Record from the schema prefill post URL with `max_comments` set to the schema prefill of `20`. `profile_pic_url` is omitted below; it is an Instagram CDN URL and signed query strings expire.

```json
{
  "pk": "18121785391719030",
  "username": "mc_gang04",
  "text": "😍",
  "comment_like_count": 0,
  "created_at": "2026-04-13T16:50:18",
  "post_url": "https://www.instagram.com/p/DWte0fylh5b/",
  "profile_link": "https://www.instagram.com/mc_gang04/",
  "user": {
    "is_verified": false,
    "username": "mc_gang04"
  }
}
```

The record above was produced with this input:

```json
{
  "post_urls": [
    "https://www.instagram.com/p/DWte0fylh5b/"
  ],
  "max_comments": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"],
    "apifyProxyCountry": "US"
  }
}
```

### Query and input reference

| Input | Type | Required | Default | Accepted values | Description |
|---|---|---:|---|---|---|
| `post_urls` | array of strings | Yes | Schema prefill: `https://www.instagram.com/p/DWte0fylh5b/` | Instagram post or reel URLs | Posts and reels whose publicly visible comments are collected |
| `posts_concurrency` | integer | No | `2` | Integer ≥ `1` | Number of posts processed at the same time |
| `sleep_min` | number | No | `5` | Number ≥ `0` | Minimum delay between comment-page requests, in seconds |
| `sleep_max` | number | No | `12` | Number ≥ `0` | Maximum delay between comment-page requests, in seconds |
| `request_timeout` | number | No | `120` | Number ≥ `1` | Timeout per request, in seconds |
| `request_retries` | integer | No | `1` | Integer ≥ `0` | Retries after transient request failures |
| `rate_limit_cooldown` | number | No | `100` | Number ≥ `0` | Wait after a rate limit, in seconds |
| `rate_limit_max_waits` | integer | No | `3` | Integer ≥ `0` | Maximum rate-limit waits before stopping collection for a post |
| `max_comments` | integer | No | `100` (prefill `20`) | `0` or any positive integer | Maximum comments per post; `0` = unlimited |
| `proxyConfiguration` | object | No | Apify proxy, `RESIDENTIAL` group, country `US` | Apify proxy groups or custom proxies | Residential US proxies are recommended |

Minimal request:

```json
{
  "post_urls": [
    "https://www.instagram.com/p/DWte0fylh5b/"
  ]
}
```

Advanced request (comment cap, concurrency, delays, and residential US proxy):

```json
{
  "post_urls": [
    "https://www.instagram.com/p/DWte0fylh5b/"
  ],
  "max_comments": 20,
  "posts_concurrency": 2,
  "sleep_min": 5,
  "sleep_max": 12,
  "request_timeout": 120,
  "request_retries": 1,
  "rate_limit_cooldown": 100,
  "rate_limit_max_waits": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"],
    "apifyProxyCountry": "US"
  }
}
```

### Retrieve the data through the API

Records are retrieved through the Apify Actor and Dataset APIs (not an official Instagram API).

1. Start the Actor with a JSON input.
2. Wait for the run to finish, or use a synchronous endpoint if you want the response inline.
3. Retrieve items from the run's default dataset.
4. Paginate or export the dataset.

Python example:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR-APIFY-TOKEN")

run_input = {
    "post_urls": ["https://www.instagram.com/p/DWte0fylh5b/"],
    "max_comments": 20,
}

run = client.actor("datascrapers/instagram-comment-scraper").call(run_input=run_input)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["pk"], item["username"], item["text"])
```

Apify generates ready-to-run Python, JavaScript, and cURL examples on the Actor's [API tab](https://apify.com/datascrapers/instagram-comment-scraper/api). Do not put a real API token in shared code or URLs.

### Data quality and record handling

- **Completeness**: `profile_link`, `profile_pic_url`, and `user` can be missing when Instagram does not render them. Unreadable fields are returned as null, not fabricated.
- **Source changes**: comment availability, like counts, and timestamps reflect collection time and can change between runs.
- **Deduplication**: each run writes a fresh dataset. Use `pk` as the stable key across runs.
- **Retry behavior**: transient failures use `request_retries`. After a rate limit, the run waits `rate_limit_cooldown` seconds, up to `rate_limit_max_waits` times per post, then stops that post.
- **Normalization**: `pk` is a string; `comment_like_count` is an integer; `created_at` is ISO-8601 without a timezone offset; `post_url` is the input URL.
- **Raw versus derived**: text, likes, timestamps, and profile fields are source values. `post_url` is attached by the Actor so comments from several posts stay joinable.

### Export and pipeline examples

| Destination | Recommended method | Typical use |
|---|---|---|
| PostgreSQL / Supabase | Dataset API poll or webhook consumer | Store comments for sentiment or moderation pipelines |
| Google Sheets | Apify Google Sheets integration | Review a bounded comment sample with a team |
| S3 / cloud storage | Scheduled export via Apify scheduler + integration | Periodic snapshots of publicly visible comments |
| Warehouse / BI tool | Dataset API pagination | Join comments to post-level records on `post_url` |

### Pricing and cost examples

The Actor uses pay-per-event pricing with two chargeable events:

| Event | Trigger | Rate |
|---|---|---|
| Actor start | Each run | $0.00005 |
| Comment (`apify-default-dataset-item`) | Each comment record written to the default dataset | $0.0015 ($1.50 per 1,000 comments) |

Example costs (start fee plus comment events):

| Comments | Estimated base cost |
|---:|---:|
| 1,000 | $1.50 |
| 10,000 | $15.00 |

The $0.00005 start event does not change the rounded per-1,000 figures. Compute and proxy usage follow your Apify plan. Estimates depend on the verified pricing model and selected options.

### Limitations and responsible data use

- The Actor collects publicly visible comments from Instagram post and reel pages only.
- Field availability depends on what Instagram renders at run time; some values can be null or missing, and site changes can alter fields.
- `comment_like_count` and `created_at` are point-in-time values; they are not a live feed after the run ends.
- The Actor does not provide historical snapshots unless you store datasets yourself.
- Residential US proxies are recommended; coverage can degrade under rate limits if proxies are omitted or misconfigured.
- You are responsible for compliance with Instagram's terms, applicable privacy law, and any contractual obligations before using the data.

### Dataset questions

#### What does one dataset item represent?

One Instagram comment from a supplied post or reel URL. A post with 50 collected comments produces 50 dataset items, each with the same `post_url`.

#### Which field should I use as a unique identifier?

`pk` is the Instagram comment identifier and the recommended deduplication key. `post_url` identifies the source post but is not unique per comment.

#### Are fields nullable or conditional?

Yes. `comment_like_count`, `created_at`, `profile_link`, `profile_pic_url`, and nested `user` fields can be null when Instagram does not render them. `pk`, `username`, `text`, and `post_url` are present on collected records.

#### Can I retrieve the records as CSV or JSON?

Yes. The dataset can be exported as JSON, CSV, Excel, XML, or HTML from the Apify Console, and queried through the Dataset API.

#### How do I limit or paginate large comment datasets?

Set `max_comments` per post (`20` is the schema prefill; `0` collects without a cap). For datasets already written, use Dataset API pagination. Delay and rate-limit inputs (`sleep_min`, `sleep_max`, `rate_limit_cooldown`, `rate_limit_max_waits`) control request pacing, not the export page size.

#### Does the Actor return historical data?

No. Each run captures comments visible at run time. To track changes, schedule repeated runs and store outputs yourself, deduplicating on `pk`.

#### What counts as a billable result?

Each run incurs a $0.00005 start event. Each comment record written to the default dataset is one billable comment event at $0.0015 ($1.50 per 1,000 comments).

### Related datasets from Data Scrapers

- **[Instagram Post Scraper](https://apify.com/datascrapers/instagram-post-scraper)** — Post-level records that join to this comment dataset on `post_url`.
- **[TikTok Comment Scraper](https://apify.com/datascrapers/tiktok-comment-scraper)** — Comment records from TikTok videos for cross-platform sentiment work.
- **[YouTube Comment Scraper](https://apify.com/datascrapers/youtube-comment-scraper)** — Comment records from YouTube videos and playlists in the same analysis workflow.
- **[Reddit Community Scraper](https://apify.com/datascrapers/reddit-scraper)** — Public Reddit posts for comparing conversation around the same topics or brands.
- **[Twitter X Profile Scraper](https://apify.com/datascrapers/twitter-x-profile-scraper)** — Public X (Twitter) profile records for commenter or brand research alongside Instagram comments.

### Data Scrapers support

Need an additional field, record type, or export workflow? Contact Data Scrapers at stardustspotlight@gmail.com. Include a sample source URL, required fields, expected record volume, and preferred delivery format.

# Actor input Schema

## `post_urls` (type: `array`):

List of Instagram post or reel URLs to scrape comments from.

## `posts_concurrency` (type: `integer`):

Number of posts to scrape concurrently. Adjust based on expected post volume and rate limits.

## `sleep_min` (type: `number`):

Minimum random delay between pagination requests.

## `sleep_max` (type: `number`):

Maximum random delay between pagination requests.

## `request_timeout` (type: `number`):

Timeout for each GraphQL request.

## `request_retries` (type: `integer`):

Number of retries for transient request failures.

## `rate_limit_cooldown` (type: `number`):

How long to wait after hitting a rate limit before retrying.

## `rate_limit_max_waits` (type: `integer`):

Maximum number of rate limit cooldowns before stopping scrape for a post.

## `max_comments` (type: `integer`):

Maximum number of comments to scrape per post. Set to 0 for unlimited.

## `proxyConfiguration` (type: `object`):

Select proxy groups or use your custom proxies

## Actor input object example

```json
{
  "post_urls": [
    "https://www.instagram.com/p/DWte0fylh5b/"
  ],
  "posts_concurrency": 2,
  "sleep_min": 5,
  "sleep_max": 12,
  "request_timeout": 120,
  "request_retries": 1,
  "rate_limit_cooldown": 100,
  "rate_limit_max_waits": 3,
  "max_comments": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

## `results` (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 = {
    "post_urls": [
        "https://www.instagram.com/p/DWte0fylh5b/"
    ],
    "max_comments": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("datascrapers/instagram-comment-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 = {
    "post_urls": ["https://www.instagram.com/p/DWte0fylh5b/"],
    "max_comments": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("datascrapers/instagram-comment-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 '{
  "post_urls": [
    "https://www.instagram.com/p/DWte0fylh5b/"
  ],
  "max_comments": 20
}' |
apify call datascrapers/instagram-comment-scraper --silent --output-dataset

```

## MCP server setup

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