# Instagram Comments Scraper (`khadinakbar/instagram-comments-scraper`) Actor

Scrape public Instagram post and Reel comments from URLs. MCP optimized output with usernames, timestamps, likes, profile URLs, cursors, and provider fallback.

- **URL**: https://apify.com/khadinakbar/instagram-comments-scraper.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, Lead generation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 scraped instagram 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Comments Scraper

Scrape visible top-level comments from public Instagram posts and Reels. The actor returns structured comment text, timestamps, commenter usernames, profile URLs, verification status, like counts, source post URLs, pagination cursors, provider provenance, and run diagnostics.

It is built for social listening teams, creator analysts, brand monitoring workflows, lead researchers, and AI agents that need Instagram comment data in a clean dataset without fragile browser automation.

### What You Can Scrape

- Public Instagram post comments
- Public Instagram Reel comments
- Comment text and creation timestamps
- Commenter username, profile URL, user ID, profile picture URL, and verified status when returned
- Comment like counts when returned
- Pagination cursors for continuation runs

The actor uses provider-backed public-data APIs:

- ScrapeCreators first by default
- SociaVault as fallback
- No Instagram cookies required

### Inputs

- `postUrls` - Instagram post or Reel URLs like `https://www.instagram.com/reel/DOq6eV6iIgD/`
- `startUrls` - Apify request-list style URL input
- `maxComments` - maximum comments saved per post
- `maxPagesPerPost` - maximum provider pages requested per post
- `providerOrder` - ScrapeCreators first, SociaVault first, or single-provider debug modes
- `initialCursor` - optional cursor for continuing a previous single-post run
- `outputMode` and `includeRawData` - compact rows by default, detailed raw fragments for debugging

### Output

Each dataset row is one comment:

```json
{
  "record_type": "comment",
  "provider": "scrapecreators",
  "post_url": "https://www.instagram.com/reel/DOq6eV6iIgD/",
  "shortcode": "DOq6eV6iIgD",
  "comment_id": "18051843701642870",
  "text": "Great post",
  "created_at": "2025-09-16T17:03:04.000Z",
  "comment_like_count": 3,
  "commenter_username": "catherina_thijs",
  "commenter_profile_url": "https://www.instagram.com/catherina_thijs/",
  "position": 1,
  "page_number": 1,
  "scraped_at": "2026-06-11T10:00:00.000Z"
}
````

The key-value store includes:

- `OUTPUT` - dataset and summary pointers
- `RUN_SUMMARY` - stop reason, saved count, provider attempts, status codes, per-target summaries, next cursors, and warnings

### Reliability Notes

Instagram comments are volatile and provider endpoints return public visible top-level comments. Instagram's visible comment count can include replies, hidden comments, or restricted comments that public endpoints do not return.

This actor does not claim to return private comments, hidden replies, login-only fields, private account data, or full follower graphs.

### Pricing

The actor uses pay-per-event pricing:

- Actor start: tiny run-init event
- `scraped-comment`: one charge per saved Instagram comment

Use `maxComments`, `maxPagesPerPost`, and Apify's `maxTotalChargeUsd` run option to cap spend.

### Example Input

```json
{
  "postUrls": ["https://www.instagram.com/reel/DOq6eV6iIgD/"],
  "maxComments": 100,
  "maxPagesPerPost": 20,
  "providerOrder": "scrapecreators-first"
}
```

# Actor input Schema

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

Public Instagram posts or reels to scrape comments from. Accepts full URLs such as https://www.instagram.com/p/CODE/ or https://www.instagram.com/reel/CODE/. Not for profile URLs, hashtags, private posts, or login-only content.

## `startUrls` (type: `array`):

Alternative Apify request-list input for Instagram /p/, /reel/, or /tv/ URLs. Use this when another actor or agent passes request objects. Not for usernames, hashtag pages, or explore URLs.

## `maxComments` (type: `integer`):

Maximum visible top-level comments to save per post or reel. Defaults to 100. Range 1 to 50000. Use a lower value for quick MCP calls and a higher value for bulk exports.

## `maxPagesPerPost` (type: `integer`):

Maximum provider pagination pages to request per post. Defaults to 20. Each provider page usually returns around 15 comments. Not a comment limit, use maxComments for that.

## `providerOrder` (type: `string`):

Choose which managed public-data API is tried first. ScrapeCreators is the recommended primary and SociaVault is the fallback. Use single-provider modes only for debugging provider-specific behavior.

## `initialCursor` (type: `string`):

Optional provider cursor for continuing a previous single-post run. Use the nextCursor from RUN\_SUMMARY. Only applies when exactly one target URL is supplied.

## `outputMode` (type: `string`):

Compact returns clean comment rows for AI agents and spreadsheets. Detailed includes raw provider fragments when includeRawData is enabled or detailed mode is selected. Defaults to compact.

## `includeRawData` (type: `boolean`):

Attach the raw provider comment object to each dataset row for debugging custom fields. Defaults to false because raw payloads increase dataset size and token usage.

## Actor input object example

```json
{
  "postUrls": [
    "https://www.instagram.com/reel/DOq6eV6iIgD/"
  ],
  "startUrls": [
    {
      "url": "https://www.instagram.com/reel/DOq6eV6iIgD/"
    }
  ],
  "maxComments": 100,
  "maxPagesPerPost": 20,
  "providerOrder": "scrapecreators-first",
  "outputMode": "compact",
  "includeRawData": false
}
```

# Actor output Schema

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

Dataset API URL for saved Instagram comment rows.

## `runSummary` (type: `string`):

Per-target status summary and provider diagnostics.

# 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 = {
    "postUrls": [
        "https://www.instagram.com/reel/DOq6eV6iIgD/"
    ],
    "startUrls": [
        {
            "url": "https://www.instagram.com/reel/DOq6eV6iIgD/"
        }
    ],
    "maxComments": 100,
    "maxPagesPerPost": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/instagram-comments-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 = {
    "postUrls": ["https://www.instagram.com/reel/DOq6eV6iIgD/"],
    "startUrls": [{ "url": "https://www.instagram.com/reel/DOq6eV6iIgD/" }],
    "maxComments": 100,
    "maxPagesPerPost": 20,
}

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

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

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

```

## CLI example

```bash
echo '{
  "postUrls": [
    "https://www.instagram.com/reel/DOq6eV6iIgD/"
  ],
  "startUrls": [
    {
      "url": "https://www.instagram.com/reel/DOq6eV6iIgD/"
    }
  ],
  "maxComments": 100,
  "maxPagesPerPost": 20
}' |
apify call khadinakbar/instagram-comments-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=khadinakbar/instagram-comments-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Comments Scraper",
        "description": "Scrape public Instagram post and Reel comments from URLs. MCP optimized output with usernames, timestamps, likes, profile URLs, cursors, and provider fallback.",
        "version": "1.0",
        "x-build-id": "LfDkz8fdkw7Gj13kC"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/khadinakbar~instagram-comments-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-khadinakbar-instagram-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/khadinakbar~instagram-comments-scraper/runs": {
            "post": {
                "operationId": "runs-sync-khadinakbar-instagram-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/khadinakbar~instagram-comments-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-khadinakbar-instagram-comments-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "postUrls": {
                        "title": "Instagram Post or Reel URLs",
                        "type": "array",
                        "description": "Public Instagram posts or reels to scrape comments from. Accepts full URLs such as https://www.instagram.com/p/CODE/ or https://www.instagram.com/reel/CODE/. Not for profile URLs, hashtags, private posts, or login-only content.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "startUrls": {
                        "title": "Start URLs",
                        "type": "array",
                        "description": "Alternative Apify request-list input for Instagram /p/, /reel/, or /tv/ URLs. Use this when another actor or agent passes request objects. Not for usernames, hashtag pages, or explore URLs.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "maxComments": {
                        "title": "Max Comments Per Post",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Maximum visible top-level comments to save per post or reel. Defaults to 100. Range 1 to 50000. Use a lower value for quick MCP calls and a higher value for bulk exports.",
                        "default": 100
                    },
                    "maxPagesPerPost": {
                        "title": "Max Pages Per Post",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum provider pagination pages to request per post. Defaults to 20. Each provider page usually returns around 15 comments. Not a comment limit, use maxComments for that.",
                        "default": 20
                    },
                    "providerOrder": {
                        "title": "Provider Order",
                        "enum": [
                            "scrapecreators-first",
                            "sociavault-first",
                            "scrapecreators-only",
                            "sociavault-only"
                        ],
                        "type": "string",
                        "description": "Choose which managed public-data API is tried first. ScrapeCreators is the recommended primary and SociaVault is the fallback. Use single-provider modes only for debugging provider-specific behavior.",
                        "default": "scrapecreators-first"
                    },
                    "initialCursor": {
                        "title": "Initial Cursor",
                        "type": "string",
                        "description": "Optional provider cursor for continuing a previous single-post run. Use the nextCursor from RUN_SUMMARY. Only applies when exactly one target URL is supplied."
                    },
                    "outputMode": {
                        "title": "Output Mode",
                        "enum": [
                            "compact",
                            "detailed"
                        ],
                        "type": "string",
                        "description": "Compact returns clean comment rows for AI agents and spreadsheets. Detailed includes raw provider fragments when includeRawData is enabled or detailed mode is selected. Defaults to compact.",
                        "default": "compact"
                    },
                    "includeRawData": {
                        "title": "Include Raw Provider Data",
                        "type": "boolean",
                        "description": "Attach the raw provider comment object to each dataset row for debugging custom fields. Defaults to false because raw payloads increase dataset size and token usage.",
                        "default": false
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
