# Instagram Comments & Replies Scraper – Posts, Reels (`lance_api/instagram-comments-scraper-api`) Actor

Scrape Instagram comments and replies from public Posts and Reels. Collect Recent or Popular comments, expand reply threads, process up to 200 URLs per run, and export clean structured data for research, monitoring, AI, and automation.

- **URL**: https://apify.com/lance_api/instagram-comments-scraper-api.md
- **Developed by:** [LanceAPI](https://apify.com/lance_api) (community)
- **Features:** Limited permissions
- **Stats:** 31 total users, 17 monthly users, 97.8% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Comments Scraper API

**Scrape Instagram comments and replies from public posts and Reels into clean, structured data for research, monitoring, analysis, and automation.**

Choose **Recent** or **Popular** comments, optionally expand replies, and process up to **200 Posts or Reels per run**. Repeated media inputs and duplicate comment/reply IDs are automatically removed, keeping your Dataset clean and preventing you from paying twice for the same data.

- **Posts, Reels, comments, and replies** — paste a full Instagram URL or shortcode and optionally expand reply threads.
- **Recent or Popular sorting** — choose newer available comments first or the available ranked/popular order.
- **Built for volume** — up to **10,000 top-level comments per URL** and **200 URLs in one run**.
- **Duplicate-safe processing and billing** — repeated media is processed once per run, and the same comment or reply ID is delivered and billed only once.

### ✨ Key features

- **Comments + replies.** Returns top-level comments and can expand replies for the comments that report them. Every comment and reply is a separate row, so filtering, joining, and exporting stay simple.
- **Recent or Popular sorting.** Collect newer available comments first, or use the available ranked/popular order — whichever fits your research question.
- **Large comment collection.** Request up to 10,000 top-level comments for each URL.
- **Batch scraping that keeps moving.** Process up to 200 Instagram Post or Reel URLs or shortcodes in one run. If one URL fails, the rest continue, so one bad input does not waste the rest of a large batch.
- **Duplicate-safe processing.** Inputs are normalized by shortcode before work begins. If the same Post or Reel appears more than once — even in different supported URL forms — it is processed once, avoiding repeated work, duplicate output, and another media-processing charge.
- **Clean, ID-based result deduplication.** The same comment or reply ID is delivered only once during collection. This keeps exports clean and prevents duplicate result charges; separate comments with identical text remain separate results.
- **Controls that match your scope and budget.** Use `resultsLimit`, `includeReplies`, `maxRepliesPerComment`, and `maxTotalResults` to avoid collecting — or paying result fees for — more rows than you need.

### 🚀 Quick start

1. Open the Actor's **Input** tab.
2. Add one or more public Instagram Post or Reel URLs (or shortcodes).
3. Choose **Recent** or **Popular**, set **Comments per URL**, and turn on **Include replies** if you need them.
4. Click **Start**. When the run finishes, open the **Output → Comments** Dataset.

For a first run, start with `includeReplies: false` and a moderate `resultsLimit`. Turn on replies only when you need thread-level discussion, which keeps the Dataset smaller and avoids result fees for reply rows you do not need.

Minimal input:

```json
{
  "urls": ["https://www.instagram.com/p/CZs1QtRrXrW/"],
  "resultsLimit": 100,
  "sort": "recent",
  "includeReplies": false
}
```

The Actor returns as many publicly accessible comments as Instagram exposes, up to your requested limit. Reaching the natural end of pagination is a successful result, even when a post has fewer comments than you requested.

### Short output example

Each unique comment or reply is written as its own Dataset row. The example below is based on a **real run** against the public Post `CZs1QtRrXrW` collected on 2026-10-08. Comment-author identifiers are redacted, and unavailable full-name data is normalized to `null`.

Top-level comment:

```json
{
  "type": "comment",
  "commentId": "18154351267224180",
  "parentCommentId": null,
  "postUrl": "https://www.instagram.com/p/CZs1QtRrXrW/",
  "text": "👏👏👏👏👏👏",
  "timestamp": "2022-02-17T13:11:39.000Z",
  "likesCount": 1,
  "repliesCount": 1,
  "ownerUsername": "[live username]",
  "ownerIsVerified": true,
  "isLikedByMediaOwner": true
}
```

Reply to that comment with `includeReplies` enabled:

```json
{
  "type": "reply",
  "commentId": "17849601167722745",
  "parentCommentId": "18154351267224180",
  "text": "[@mention] 🥰🥰",
  "timestamp": "2022-02-17T15:00:51.000Z",
  "ownerUsername": "[live username]",
  "isLikedByMediaOwner": null
}
```

`isLikedByMediaOwner` is `true`, `false`, or `null` depending on whether that signal is available.

### Use cases

- **Brand and campaign monitoring.** Analyze how audiences respond to brand posts, campaigns, launches, and announcements.
- **Creator and influencer research.** Study recurring audience questions, audience reactions, feedback patterns, and creator–community interaction.
- **Customer feedback analysis.** Collect public comments and replies for downstream categorization, support research, product feedback, or qualitative analysis.
- **Content performance research.** Compare discussion volume, reply depth, and comment engagement across posts or Reels.
- **Social listening datasets.** Build structured comment datasets for broader public social media research.
- **AI and LLM workflows.** Use the returned comment text and metadata for downstream summarization, clustering, topic extraction, moderation research, or semantic search.
- **Automation and data pipelines.** Send structured comments and replies into databases, dashboards, spreadsheets, n8n, Make, Zapier, or scheduled workflows.

This Actor collects and structures comments. Sentiment analysis, summarization, clustering, and moderation decisions are not performed by the Actor — use the returned data for them in your own tools.

### How it works

1. Add Instagram Post or Reel URLs or shortcodes.
2. The Actor validates each input, normalizes supported URL forms to a shortcode, and removes repeated media before processing.
3. Choose Recent or Popular comments, set the comment limit, and optionally include replies.
4. The Actor collects the requested comments and optional replies for each unique valid media item.
5. Receive one structured Dataset row per unique comment or reply ID.
6. Export the results or send them into your analysis, database, AI, or automation workflow.

### Input

#### Accepted formats

- `https://www.instagram.com/p/SHORTCODE/`
- `https://www.instagram.com/reel/SHORTCODE/` and `https://www.instagram.com/reels/SHORTCODE/`
- Legacy `/tv/SHORTCODE/` URLs
- A shortcode by itself, such as `CZs1QtRrXrW`
- URLs that contain extra query parameters, such as `?igsh=...`

| Field | Type | Required | Default | Limits | Description |
|---|---|---|---|---|---|
| `urls` | `array[string]` | Yes | — | 1–200 items | Public Instagram Post or Reel URLs, or shortcodes. References that normalize to the same shortcode are processed once per run, so they do not create another media-processing charge or duplicate Dataset results. |
| `resultsLimit` | `integer` | No | `100` | 1–10,000 | Maximum top-level comments delivered **per unique media item**. Replies are additional rows and are not counted here. |
| `sort` | `enum` | No | `recent` | `recent`, `popular` | `recent` returns newer available comments first; `popular` returns the available ranked/popular order. |
| `includeReplies` | `boolean` | No | `false` | — | When `true`, expands replies for delivered comments that report them. Keep it off when top-level discussion is enough, so you do not pay result fees for reply rows you do not need. |
| `maxRepliesPerComment` | `integer` | No | `20` | 0–1,000 | Maximum replies delivered for each parent comment. Use it to control thread depth and reply-result volume. |
| `maxTotalResults` | `integer` or `null` | No | — (no cap) | ≥ 1 | Hard cap on all delivered comment and reply rows across the run. Use it to limit Dataset size and result-charge exposure; start and processing fees are separate. |

`maxTotalResults` is a **result-volume and output guardrail for the whole run**, not a per-URL setting. It counts comments **and** replies together and caps result-charge exposure, but it does not cap the separate run-start or media-processing fees. Top-level comments are written first for each media item, so a small value can leave no room for replies. For example, `resultsLimit: 10` with `maxTotalResults: 5` returns at most five comments and no replies.

Together, `resultsLimit`, `includeReplies`, `maxRepliesPerComment`, and `maxTotalResults` let you match the run to your research scope and avoid collecting — or paying result fees for — more data than you need.

### Input examples

Single post:

```json
{ "urls": ["https://www.instagram.com/p/CZs1QtRrXrW/"], "resultsLimit": 200 }
```

Batch of Reels with replies:

```json
{
  "urls": [
    "https://www.instagram.com/reel/Dd9RyBWBVih/",
    "https://www.instagram.com/reel/DBx1kLpvQaB/",
    "DBx1kLpvQaB"
  ],
  "resultsLimit": 500,
  "sort": "popular",
  "includeReplies": true,
  "maxRepliesPerComment": 50
}
```

Result-volume-guarded run:

```json
{
  "urls": ["https://www.instagram.com/p/CZs1QtRrXrW/"],
  "resultsLimit": 10000,
  "includeReplies": true,
  "maxTotalResults": 2000
}
```

### Output field reference

Every row contains the business fields below.

| Field | Type | Nullable | Meaning |
|---|---|---|---|
| `type` | string | No | `comment` for a top-level comment, `reply` for a reply. |
| `commentId` | string | No | Unique comment or reply ID, always returned as a string. |
| `parentCommentId` | string | Yes | `null` for a top-level comment; the parent comment's ID for a reply. |
| `postShortcode` | string | No | Instagram shortcode of the source post or Reel. |
| `postUrl` | string | No | Canonical URL of the source post or Reel. |
| `inputUrl` | string | No | The URL or shortcode you supplied as input. |
| `text` | string | No | Comment or reply text. |
| `timestamp` | string | Yes | Comment time as an ISO 8601 UTC string, or `null` when not exposed. |
| `timestampUnix` | number | Yes | The same time in **Unix seconds**, or `null`. |
| `likesCount` | number | Yes | Like count, or `null` when unavailable. Never guessed. |
| `repliesCount` | number | Yes | Replies reported for this comment. `0` for rows of type `reply`, `null` when unavailable. |
| `ownerUsername` | string | Yes | Comment author's username. |
| `ownerId` | string | Yes | Comment author's stable ID, returned as a string. |
| `ownerFullName` | string | Yes | Comment author's public full name when available; otherwise `null`. |
| `ownerIsVerified` | boolean | Yes | Whether the comment author is verified. |
| `ownerIsPrivate` | boolean | Yes | Whether the comment author's account is private. |
| `ownerProfilePicUrl` | string | Yes | Temporary profile image URL. It may expire — download it promptly if you need it long term. |
| `isReply` | boolean | No | `true` for replies. Equivalent to `type === "reply"`. |
| `isLikedByMediaOwner` | boolean | Yes | Whether the source Post or Reel owner liked this comment when that signal is available; otherwise `null`. |
| `scrapedAt` | string | No | ISO 8601 UTC timestamp of when the row was collected. |

Deduplication uses `commentId` together with the source media shortcode — never the comment text. If two people both write “Great!” but Instagram assigns different comment IDs, both are valid results and both are delivered.

### Replies

Set `includeReplies` to `true` to collect reply threads. Replies are written as their own rows with `type: "reply"`, `isReply: true`, and `parentCommentId` pointing at the parent comment. `maxRepliesPerComment` applies independently to every parent comment, helping you control thread depth and result-charge exposure. Replies use the same result pricing as top-level comments.

### Pagination and batch behavior

- Each unique valid media input is processed independently.
- Repeated references that normalize to the same shortcode are processed once per run, preventing duplicate processing charges and duplicate output.
- Pagination continues until the requested limit is reached or Instagram exposes no more comments.
- An unavailable or invalid URL does not stop the remaining inputs. If a shared service or billing problem prevents further processing, the batch stops instead of repeatedly attempting the remaining URLs.
- Already delivered comments are preserved if a later page fails.
- Duplicate comment and reply IDs are removed before delivery, keeping exports clean and preventing duplicate result charges.
- Collecting additional pages or recovering from temporary issues does not create another media-processing charge.

### Outcomes and status

Each evaluated input finishes with one outcome. Detailed per-input outcomes and the aggregate run summary are stored in the `RUN_SUMMARY` key-value record. If a batch stops early, some submitted inputs may remain unprocessed.

| Outcome | Meaning | Result charge |
|---|---|---|
| `PERFECT` | The requested limit was reached, or pagination ended normally. | Delivered rows only |
| `NO_COMMENTS` | The Post or Reel was reached and has no accessible comments. | None |
| `UNAVAILABLE` | Private, deleted, inaccessible, restricted, or comments disabled. | None |
| `PARTIAL` | Some rows were delivered before the run stopped. | Delivered rows only |
| `FAILED` | A technical failure produced no rows. | None |
| `INVALID` | The supplied URL or shortcode is not a supported Instagram Post, Reel, or TV URL. | None |

A media-processing fee may still apply when a unique valid Post or Reel entered processing, even if no comment or reply was delivered. Clearly invalid inputs and repeated media rejected before processing do not incur a media-processing fee.

For billing, processing begins only after a request for that media receives a response. A request that times out without a response does not create a media-processing charge. If a charge cannot be confirmed, collection stops; `billingStatus: "requires_review"` in `RUN_SUMMARY` means the displayed amounts include confirmed charges only. Contact support with the Run ID before trying again.

### 💰 Pricing

**Predictable pay-per-event pricing with duplicate protection.**

Each run has three simple cost components:

1. a small run-start fee;
2. one processing fee per unique valid media item;
3. a result fee for each unique comment or reply delivered.

| What you pay for | Price |
|---|---:|
| Run start | $0.0005 / run at the default 256 MB memory |
| Media processing | FREE $0.002; BRONZE $0.0012; SILVER $0.0011; GOLD and above $0.001 / unique valid Post or Reel |
| FREE result | $1.50 / 1,000 comments or replies |
| BRONZE result | $1.20 / 1,000 comments or replies |
| SILVER result | $1.00 / 1,000 comments or replies |
| GOLD result | $0.80 / 1,000 comments or replies |

**One unique comment or reply = one result.** Comments and replies use the same result pricing.

The run-start price is the same for every Apify plan. Media-processing and delivered-result prices vary by plan, as shown above.

Repeated Posts and Reels are normalized by shortcode and processed once per run. Duplicate comment/reply IDs are removed before delivery, helping prevent you from paying twice for the same media processing or the same delivered result. Identical text from different comment IDs is not a duplicate and remains separate data.

Clearly invalid inputs and repeated media rejected before processing do not create a media-processing charge. Once a unique valid media item enters processing, its single plan-specific processing fee applies even if it later returns no comments, is found to be unavailable, or encounters a technical failure. Collecting additional pages or recovering from temporary issues does not charge media processing again.

Result fees apply only to unique comments and replies successfully written to the Dataset. Failed, empty, invalid, normalization-dropped, and duplicate rows do not create result charges.

#### Cost example

A SILVER user processes 10 unique Posts and receives 2,000 unique comments and replies:

- Run start: $0.0005
- Media processing: 10 × $0.002 = $0.02
- Results: 2,000 × $0.001 = $2.00
- **Total Actor event charges: $2.0205**

If the same Post appears twice in the batch, it is processed once. If the same comment ID reappears during pagination or recovery, it is delivered and billed once. This duplicate protection keeps the Dataset clean and helps keep the budget focused on unique data.

### API usage

Replace `$APIFY_TOKEN` with your Apify API token. Use `lance_api/instagram-comments-scraper-api` with the JavaScript/Python SDKs and `lance_api~instagram-comments-scraper-api` in REST API URLs.

#### JavaScript

```js
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });

// Start the run and wait for it to finish.
const run = await client.actor('lance_api/instagram-comments-scraper-api').call({
  urls: ['https://www.instagram.com/p/CZs1QtRrXrW/'],
  resultsLimit: 100,
  sort: 'recent',
  includeReplies: true,
  maxRepliesPerComment: 20,
});

// Fetch the default Dataset.
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Python

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])

## Start the run and wait for it to finish.
run = client.actor("lance_api/instagram-comments-scraper-api").call(run_input={
    "urls": ["https://www.instagram.com/p/CZs1QtRrXrW/"],
    "resultsLimit": 100,
    "sort": "recent",
    "includeReplies": True,
    "maxRepliesPerComment": 20,
})

## Fetch the default Dataset.
items = client.dataset(run["defaultDatasetId"]).list_items().items
print(items)
```

#### cURL

```bash
## Start a run.
curl -X POST "https://api.apify.com/v2/acts/lance_api~instagram-comments-scraper-api/runs" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "urls": ["https://www.instagram.com/p/CZs1QtRrXrW/"],
        "resultsLimit": 50,
        "includeReplies": true
      }'
```

```bash
## Fetch the run's default Dataset (use the datasetId from the response above).
curl -H "Authorization: Bearer $APIFY_TOKEN" \
  "https://api.apify.com/v2/datasets/{datasetId}/items?format=json"
```

The same input works in n8n, Make, Zapier, scheduled Actor tasks, and other automation systems that can call the Apify API.

### FAQ

**Can I scrape comments from both Instagram Posts and Reels?**
Yes. The Actor accepts Post URLs, Reel URLs, legacy TV URLs, and bare shortcodes.

**Can I scrape Instagram comments and replies?**
Yes. Set `includeReplies` to `true`. Replies are returned as separate rows with `parentCommentId` pointing at their parent comment.

**Does `resultsLimit` include replies?**
No. `resultsLimit` controls top-level comments per unique media item. Replies are additional rows, so the final Dataset can contain more rows than `resultsLimit`.

**Can I sort by Recent or Popular?**
Yes. Set `sort` to `recent` for newer available comments first, or `popular` for the available ranked/popular order.

**How many URLs can I process in one run?**
Up to 200 Instagram Post or Reel URLs or shortcodes per run.

**Why did I receive fewer comments than requested?**
The post may simply have fewer publicly accessible comments, or Instagram may expose only part of the discussion. A normal end of pagination is a successful result, not an error.

**Are posts with no comments charged?**
A Post or Reel with no accessible comments does not generate any comment/reply result charges. If the valid media entered processing, the normal plan-specific media-processing fee still applies.

**Are duplicate comments charged?**
No. Duplicate comment or reply IDs are removed before delivery, so the same result is not billed twice. Deduplication is ID-based, not text-based: two separate comment IDs containing the same words are two valid results.

**What if I accidentally submit the same Post or Reel twice?**
The Actor normalizes supported URL forms to their shortcode and processes repeated media once per run. The duplicate input does not create another media-processing charge or duplicate Dataset results.

**What happens if one URL fails in a batch?**
An unavailable or invalid URL does not stop the remaining inputs. A shared service or billing problem may stop the batch. Evaluated inputs are reported in the run summary; inputs that never entered processing create no media-processing or result charge.

**Can I resume an interrupted run?**
An interrupted run is not automatically replayed because its previous work or charges may not have been fully confirmed. Contact support with the Run ID before starting it again. Starting a new run is a separate operation with its own normal charges.

**Can I scrape private posts?**
No. Only publicly accessible posts and Reels are supported. Private, deleted, and comments-disabled posts finish as `UNAVAILABLE`.

**Does the Actor require Instagram cookies or login?**
No. You do not need Instagram accounts, cookies, passwords, or sessions, and you should never provide them.

**How much does it cost?**
At the default memory, each run starts at $0.0005, plus the plan-specific media-processing fee for each unique valid Post or Reel entering processing (FREE: $0.002). Delivered comments and replies cost $1.50 / $1.20 / $1.00 / $0.80 per 1,000 for FREE / BRONZE / SILVER / GOLD users. Same-run duplicate media and duplicate result IDs are billed once.

**Does it return comment author information?**
Yes, when the source exposes it: `ownerUsername`, `ownerId`, `ownerFullName`, `ownerIsVerified`, `ownerIsPrivate`, and `ownerProfilePicUrl`. Fields that are not available are returned as `null`.

### Limitations

- Publicly accessible posts and Reels only.
- Instagram can change availability, comment ordering, and pagination at any time.
- Not every historical comment is guaranteed; you receive what Instagram exposes publicly, up to your limit.
- Reply availability depends on the data exposed for each parent comment.
- Profile image URLs are temporary and may expire.
- `resultsLimit` is a maximum, not a guaranteed minimum.

### Responsible use

- Use the Actor for public data only, and respect Instagram's terms and your local laws and regulations.
- Do not use collected comments for harassment, doxxing, discrimination, or mass unsolicited contact.
- Never submit private credentials, cookies, or tokens. The Actor does not need them, and results are written only to the run's Dataset.
- Treat comment data and author metadata as personal data and handle it accordingly.

### Support

Open an issue on the Actor's **Issues** page, or email **lanceapi2026@hotmail.com**.

To help us resolve a problem quickly, include:

- the run ID;
- a public, non-sensitive URL involved in the problem;
- your input settings;
- the expected result versus the actual result;
- the outcome or status shown in the run summary.

Please do **not** send Apify tokens, Instagram cookies, API keys, passwords, or session data.

# Actor input Schema

## `urls` (type: `array`):

Enter up to 200 public Instagram Post or Reel URLs, or shortcodes. References that normalize to the same shortcode are processed once per run, preventing duplicate media-processing charges and duplicate output.

## `resultsLimit` (type: `integer`):

Maximum top-level comments delivered per unique media item. Use a moderate limit when you need a smaller Dataset and lower result-charge exposure; replies are additional rows.

## `sort` (type: `string`):

Choose Recent for newer comments first or Popular for the available ranked/popular comment order. A dropdown avoids requiring API-specific values.

## `includeReplies` (type: `boolean`):

Expand replies only for delivered comments that report them. Keep this off when top-level discussion is enough, so you do not collect or pay result fees for reply rows you do not need.

## `maxRepliesPerComment` (type: `integer`):

Maximum replies delivered for each parent comment. This controls thread depth and result-charge exposure; replies do not count toward the top-level comment limit.

## `maxTotalResults` (type: `integer`):

Caps all delivered comment and reply rows across the run, limiting Dataset size and result-charge exposure. Top-level comments are written first for each URL, so a low limit may leave no room for replies. For example, if Comments per URL is 10 and this limit is 5, the Actor returns at most 5 comments and no replies. Run-start and media-processing fees are separate. Leave empty for no run-wide result cap.

## Actor input object example

```json
{
  "urls": [
    "https://www.instagram.com/p/CZs1QtRrXrW/"
  ],
  "resultsLimit": 100,
  "sort": "recent",
  "includeReplies": false,
  "maxRepliesPerComment": 20
}
```

# Actor output Schema

## `dataset` (type: `string`):

Unique top-level comments and replies delivered by this run.

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

Outcomes for evaluated inputs, confirmed charge totals, and billingStatus indicating whether any charges require review.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("lance_api/instagram-comments-scraper-api").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("lance_api/instagram-comments-scraper-api").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 '{}' |
apify call lance_api/instagram-comments-scraper-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lance_api/instagram-comments-scraper-api"
        }
    }
}
```

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/U8DzZi6ZQrrMv4bzM/builds/WsuUHuPwScOXOcgz4/openapi.json
