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

Scrape Instagram profiles, posts, reels, tagged posts, followers, comments and replies, hashtags, places and highlights. Real-time, no login, clean JSON, auto pagination. Pay only for results.

- **URL**: https://apify.com/scrapysocial/instagram-scraper.md
- **Developed by:** [Scrapy Social](https://apify.com/scrapysocial) (community)
- **Categories:** Social media, Lead generation, Automation
- **Features:** Limited permissions
- **Stats:** 19 total users, 13 monthly users, 98.6% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.30 / 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 Scraper: Profiles, Posts, Reels, Comments & Hashtags

Profiles, feeds, reels, comments, hashtags and places from Instagram as one consistent JSON shape, with automatic pagination and batch input.

**21 endpoints** · real-time data · no Instagram account or cookies needed · automatic pagination · batch input · pay only for results ($2.30 / 1,000 results, down to $1.30 on higher Apify plans).

### What can this scraper do?

- **Search**: Search Users, Search Posts
- **User**: User Info, User Posts, User Reels, User Tagged Posts, User Followers, User Followings, Similar Users, User Highlights, User Reposts
- **Post**: Post Detail, Post Comments, Comment Replies
- **Hashtag**: Hashtag Info, Hashtag Posts, Search Hashtags
- **Place**: Place Search, Place Info, Place Posts
- **Story**: Highlight Stories

### Use cases

- Influencer vetting: profile stats, recent posts and reels, tagged posts, similar accounts.
- Audience research: followers / followings lists and comment threads with replies.
- Hashtag and location monitoring: top posts for a hashtag or a place.
- Content analytics: post detail with likes, comments, plays and media URLs.

### Why this scraper

- **Clean, consistent JSON.** The same fields (`id`, `author`, `stats`, `createdAt` …) across endpoints, so you write your parser once.
- **Real-time.** Every run fetches live data; nothing is served from a stale database.
- **No login, no blocking headaches.** Sessions, proxies, signatures and retries are handled for you.
- **Pagination built in.** Set *Max results per query*; the actor follows cursors for you and de-duplicates.
- **Batch mode.** Many usernames / posts / keywords in one run.
- **Fair billing.** Not-found lookups and failed calls are never charged.

### How to use it

1. Pick **What to scrape** (for example *User Posts*).
2. Fill the fields that endpoint uses (each field lists the endpoints that use it). Leave the others empty.
3. Set **Max results per query**, then click **Start**.
4. Download the results as JSON, CSV, Excel or HTML, or read them through the Apify API.

#### Input examples

**A profile's latest posts**

```json
{
  "endpoint": "user-posts",
  "username": "natgeo",
  "maxItems": 100
}
```

**Comments on a post**

```json
{
  "endpoint": "post-comments",
  "postId": "Dfh0K8ypSPK",
  "maxItems": 200
}
```

**Top posts for a hashtag**

```json
{
  "endpoint": "hashtag-posts",
  "name": "balisunrise",
  "maxItems": 100
}
```

**Several profiles in one run (batch)**

```json
{
  "endpoint": "user-info",
  "batch": [
    {
      "username": "natgeo"
    },
    {
      "username": "nasa"
    },
    {
      "username": "jokowi"
    }
  ],
  "maxItems": 50
}
```

### Output

Each result is one dataset row. List endpoints produce one row per item; lookups produce one row. Every row has a `_meta` object (endpoint, query, page, scrapedAt). Trend lists and similar responses also carry the list's own fields under `_context`. Example row from **User Posts**:

```json
{
  "id": "3998377764121816666",
  "code": "Dd9F2RkTS5a",
  "mediaType": 2,
  "productType": "clips",
  "takenAt": 1790863832,
  "caption": "Pancasila adalah warisan sejarah dan kompas untuk terus membangun negeri dengan persatuan, keadilan, dan gotong royong. Kekuatan Bangsa Indonesia lahir dari ...",
  "likeCount": 21476,
  "commentCount": 935,
  "imageUrl": "https://instagram.fcgk18-2.fna.fbcdn.net/v/t51.71878-15/829473355_2195869401270929_1107985?…",
  "author": {
    "id": "2289707047",
    "pk": "2289707047",
    "username": "jokowi",
    "fullName": "Joko Widodo",
    "isVerified": true,
    "avatar": "https://instagram.fcgk18-2.fna.fbcdn.net/v/t51.2885-19/323796872_186095804235435_409923925?…",
    "isPrivate": false
  },
  "_meta": {
    "endpoint": "user-posts",
    "query": {
      "username": "jokowi"
    },
    "page": 1,
    "scrapedAt": "2026-11-11T08:00:00.000Z"
  }
}
```

A run summary (results, pages, not found, failed, stop reason) is saved to the key-value store as `OUTPUT`.

### Endpoints

| Group | Endpoint (`endpoint` value) | What you get | Paginated |
|---|---|---|---|
| Search | Search Users (`search-users`) | Search Instagram users by keyword. |  |
| Search | Search Posts (`search-posts`) | Search posts by keyword or #hashtag with cursor pagination. | yes |
| User | User Info (`user-info`) | Public Instagram profile and stats by username or userId. |  |
| User | User Posts (`user-posts`) | Latest posts of a user by username, with cursor pagination. | yes |
| User | User Reels (`user-reels`) | Reels published by a user, paginated. | yes |
| User | User Tagged Posts (`user-tagged`) | Posts where the user is tagged, paginated. | yes |
| User | User Followers (`user-followers`) | Followers of a user (paginated). | yes |
| User | User Followings (`user-followings`) | Accounts a user follows (paginated). | yes |
| User | Similar Users (`user-similar`) | Suggested / similar accounts for a profile. |  |
| User | User Highlights (`user-highlights`) | Story highlight tray of a user. |  |
| User | User Reposts (`user-reposts`) | Reposts tab of a user profile. |  |
| Post | Post Detail (`post-detail`) | Full media detail by post id or shortcode. |  |
| Post | Post Comments (`post-comments`) | Comments on a post/reel with cursor pagination. | yes |
| Post | Comment Replies (`post-comment-replies`) | Replies (child comments) under a parent comment. | yes |
| Hashtag | Hashtag Info (`hashtag-info`) | Resolve a hashtag name to its internal id. |  |
| Hashtag | Hashtag Posts (`hashtag-posts`) | Posts for a hashtag via keyword SERP, paginated. | yes |
| Hashtag | Search Hashtags (`search-hashtags`) | Search Instagram hashtags by keyword. |  |
| Place | Place Search (`place-search`) | Search Instagram locations / places by keyword. |  |
| Place | Place Info (`place-info`) | Location page details by locationId. |  |
| Place | Place Posts (`place-posts`) | Recent or top posts at a location, paginated. | yes |
| Story | Highlight Stories (`highlight-stories`) | Stories inside a highlight reel. | yes |

#### Endpoint reference

##### Search

###### Search Users · `search-users`

Returns ranked user suggestions for a keyword (typeahead / top search). Use a result `id` as `userId` on user endpoints. Empty list is a valid 200 when nothing matches.

| Field | Required | Description |
|---|---|---|
| `keyword` | yes | Search keyword or exact username. |

###### Search Posts · `search-posts`

Explore keyword / hashtag SERP (`#tag` works). Returns media grid items plus `cursor` / `hasMore`. Omit `cursor` on the first page; send the previous `cursor` for the next page. Empty hits are 200 with `posts: []` (never 404).

| Field | Required | Description |
|---|---|---|
| `keyword` | yes | Keyword or hashtag including # (e.g. `#balisunrise`). |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |
| `count` |  | Page size for subsequent pages. |

##### User

###### User Info · `user-info`

Returns profile fields, follower / following / post counts, bio and avatar. Send `username` (resolved via Search Users → first result id) or `userId`. Missing / unavailable targets return 404 NOT_FOUND. Note: web_profile_info is dead (404); this uses PolarisProfilePageContentQuery from HAR.

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. Send this or `userId`. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent. |

###### User Posts · `user-posts`

Profile grid / timeline posts for a public username. Pagination via `cursor` + `hasMore` from the previous page. Private or missing users return 404.

| Field | Required | Description |
|---|---|---|
| `username` | yes | Instagram username without @. |
| `count` |  | Page size. |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |

###### User Reels · `user-reels`

Clips tab of a profile. Send `username` or `userId`. Returns reels with play/like/comment counts plus `cursor` / `hasMore`.

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent (resolved via search). |
| `count` |  | Page size. |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |

###### User Tagged Posts · `user-tagged`

Tagged tab of a profile. Send `username` or `userId`. Pagination via `cursor` / `hasMore`.

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent (resolved via search). |
| `count` |  | Page size. |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |

###### User Followers · `user-followers`

Public follower list when Instagram exposes it for the target. Send `username` or `userId`. Use `cursor` (`max_id`) for the next page.

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent (resolved via search). |
| `count` |  | Page size. |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |

###### User Followings · `user-followings`

Following list when public. Optional `query` filters the list. Pagination via `cursor` (`max_id`).

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent (resolved via search). |
| `count` |  | Page size. |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |
| `query` |  | Optional filter inside the following list. |

###### Similar Users · `user-similar`

Discover chaining suggestions shown on a profile. Send `username` or `userId`.

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent (resolved via search). |

###### User Highlights · `user-highlights`

Highlight covers on a profile. Send `username` or `userId`. Use a highlight `id` with Highlight Stories. Empty tray is a valid 200.

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent (resolved via search). |

###### User Reposts · `user-reposts`

Posts the user has reposted. Send `username` or `userId`.

| Field | Required | Description |
|---|---|---|
| `username` |  | Instagram username without @. |
| `userId` |  | Numeric Instagram user id. Optional when `username` is sent (resolved via search). |

##### Post

###### Post Detail · `post-detail`

Returns caption, author, stats, image/video URLs for a post/reel. Send numeric media pk, the shortcode from `/p/{code}/` (e.g. `DdaVv2Nysh8`), or a full Instagram post/reel URL — shortcodes are decoded to pk automatically. Missing media → 404.

| Field | Required | Description |
|---|---|---|
| `postId` | yes | Media id: numeric pk, shortcode from /p/{code}/ (e.g. DdaVv2Nysh8), or full Instagram post/reel/tv URL. |

###### Post Comments · `post-comments`

Top-level comments for a media via Instagram web GraphQL. `postId` accepts numeric pk, shortcode, or post URL. Pagination: omit `cursor` on page 1; send previous `cursor` back unchanged. Cursor is a base64url token (safe in query strings) — do not URL-encode twice and do not JSON-parse it. `hasMore` follows `page_info.has_next_page`. Empty list is 200.

| Field | Required | Description |
|---|---|---|
| `postId` | yes | Media id: numeric pk, shortcode from /p/{code}/ (e.g. DdaVv2Nysh8), or full Instagram post/reel/tv URL. |
| `cursor` |  | Pagination cursor from the previous response (base64url). Send back unchanged. Omit on the first page. |
| `count` |  | Page size. |

###### Comment Replies · `post-comment-replies`

Threaded replies for one parent comment on a post. `postId` accepts pk/shortcode/URL. Pagination via `cursor` when `hasMore` is true (`has_more_tail_child_comments` / `has_more_head_child_comments`).

| Field | Required | Description |
|---|---|---|
| `postId` | yes | Media id: numeric pk, shortcode from /p/{code}/ (e.g. DdaVv2Nysh8), or full Instagram post/reel/tv URL. |
| `commentId` | yes | Parent comment id (`pk`). |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |

##### Hashtag

###### Hashtag Info · `hashtag-info`

Returns the Instagram tag id for a hashtag name (without #). Media for a hashtag: use Search Posts with `keyword=#tag`.

| Field | Required | Description |
|---|---|---|
| `name` | yes | Hashtag without #. |

###### Hashtag Posts · `hashtag-posts`

Convenience wrapper: searches `#name` through the explore keyword SERP. Same pagination model as Search Posts.

| Field | Required | Description |
|---|---|---|
| `name` | yes | Hashtag without #. |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |
| `count` |  | Page size. |

###### Search Hashtags · `search-hashtags`

Returns ranked hashtag suggestions (name, id, mediaCount) for a keyword. Use a result `name` with Hashtag Posts / Hashtag Info. Empty list is a valid 200.

| Field | Required | Description |
|---|---|---|
| `keyword` | yes | Hashtag keyword without #. |

##### Place

###### Place Search · `place-search`

Location typeahead used by Instagram create/search flows. Returns name, coordinates and Facebook page id. Note: this capture does not include `locationId` — get `locationId` from an Instagram location URL (`/explore/locations/{id}/…`) for Place Info / Posts.

| Field | Required | Description |
|---|---|---|
| `keyword` | yes | Place keyword. |

###### Place Info · `place-info`

Name, coordinates, media count and slug for an Instagram location id (from `/explore/locations/{id}/`). Missing location → 404.

| Field | Required | Description |
|---|---|---|
| `locationId` | yes | Instagram location id. |

###### Place Posts · `place-posts`

Location tab feed. `tab` = `recent` (default) or `ranked`/`top` when supported. Pagination via `cursor` / `hasMore`.

| Field | Required | Description |
|---|---|---|
| `locationId` | yes | Instagram location id. |
| `tab` |  | Location tab.Allowed: `recent`, `ranked`, `top`. |
| `count` |  | Page size. |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |

##### Story

###### Highlight Stories · `highlight-stories`

Loads highlight media for `highlightId` (form `highlight:…` or numeric id from User Highlights). Pagination via `cursor` when more highlight reels are chained.

| Field | Required | Description |
|---|---|---|
| `highlightId` | yes | Highlight id from User Highlights (`highlight:123…` or numeric). |
| `cursor` |  | Pagination cursor from the previous response. Omit on the first page. |

### Pagination, limits and batch

- **Max results per query** (`maxItems`) and **Max pages per query** (`maxPages`) bound each query; the actor stops at whichever comes first or when the source has no more pages.
- **Batch** (`batch`) runs the selected endpoint once per object, e.g. `[{"username":"a"},{"username":"b"}]`. Form fields act as defaults for every batch entry.
- **Parallel queries** (`concurrency`) controls how many batch entries run at once.
- To continue a previous run manually, pass the last `cursor` from the response (with *One row per result* off) as the `cursor` field.

### Pricing

This actor uses **pay per event** pricing: you pay for the results you get, not for compute time.

Higher Apify plans get an automatic Store discount:

| Apify plan | Per 1,000 results | Actor start |
|---|---|---|
| Free | $2.30 | $0.005 |
| Bronze | $1.90 | $0.004 |
| Silver | $1.60 | $0.003 |
| Gold | $1.30 | $0.0025 |
| Platinum | $1.30 | $0.0025 |
| Diamond | $1.30 | $0.0025 |

Example on the Free plan: 1,000 results in one run cost $2.305. Platform usage (compute, proxy, storage) is included; you pay only the events above. The start event is charged once per run at the default 512 MB memory.

Not-found lookups and failed calls are free. With *One row per result* off, a row holding a page of N items counts as N results.

Set **Maximum cost per run** in the run options to cap spending; the actor stops cleanly at that limit and keeps everything it already saved.

### Integrations and API

Run it from code with the Apify API or clients and get results as JSON:

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('<username>/instagram-scraper').call({"endpoint":"user-posts","username":"natgeo","maxItems":100});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

It also works with schedules, webhooks, Make, Zapier, n8n, Google Sheets and every other Apify integration.

### FAQ

**Do I need a Instagram account, cookies or an API key?** No. Just pick an endpoint and run.

**Is scraping Instagram legal?** This actor only returns publicly available data. You are responsible for how you use it: respect privacy laws (GDPR, CCPA), the platform's terms, and do not collect personal data without a legitimate reason.

**Why did a query return nothing?** The account, post or keyword may not exist, may be private, or may have no public results. Those queries are reported in the `OUTPUT` summary as *not found* and are not charged.

**Can I get more than the maximum?** Raise *Max results per query* and *Max pages per query*. Very large pulls are best split with *Batch*.

**How fresh is the data?** Real time: each run reads the platform at that moment.

### Changelog and support

See the **Changelog** tab. Found a bug or need a field or endpoint? Open an issue in the **Issues** tab; we usually reply within a day.

# Changelog

This Actor's version history is a separate document: https://apify.com/scrapysocial/instagram-scraper/changelog.md

# Actor input Schema

## `endpoint` (type: `string`):

Pick the Instagram data you want. Then fill only the fields that endpoint uses (each field says which endpoints use it). Full list with descriptions: see the README tab.

## `keyword` (type: `string`):

Keyword or hashtag including # (e.g. `#balisunrise`).<br><br><b>Used by:</b> Search Users, Search Posts, Search Hashtags, Place Search. <b>Required by:</b> Search Users, Search Posts, Search Hashtags, Place Search. <b>Example:</b> <code>jokowi</code>

## `cursor` (type: `string`):

Pagination cursor from the previous response (base64url). Send back unchanged. Omit on the first page.<br><br><b>Used by:</b> Search Posts, User Posts, User Reels, User Tagged Posts, User Followers, User Followings +5 more.

## `count` (type: `integer`):

Page size for subsequent pages.<br><br><b>Used by:</b> Search Posts, User Posts, User Reels, User Tagged Posts, User Followers, User Followings +3 more. <b>Example:</b> <code>12</code>

## `username` (type: `string`):

Instagram username without @. Send this or `userId`.<br><br><b>Used by:</b> User Info, User Posts, User Reels, User Tagged Posts, User Followers, User Followings +3 more. <b>Required by:</b> User Posts. <b>Example:</b> <code>jokowi</code>

## `userId` (type: `string`):

Numeric Instagram user id. Optional when `username` is sent (resolved via search).<br><br><b>Used by:</b> User Info, User Reels, User Tagged Posts, User Followers, User Followings, Similar Users +2 more.

## `query` (type: `string`):

Optional filter inside the following list.<br><br><b>Used by:</b> User Followings.

## `postId` (type: `string`):

Media id: numeric pk, shortcode from /p/{code}/ (e.g. DdaVv2Nysh8), or full Instagram post/reel/tv URL.<br><br><b>Used by:</b> Post Detail, Post Comments, Comment Replies. <b>Required by:</b> Post Detail, Post Comments, Comment Replies. <b>Example:</b> <code>DdaVv2Nysh8</code>

## `commentId` (type: `string`):

Parent comment id (`pk`).<br><br><b>Used by:</b> Comment Replies. <b>Required by:</b> Comment Replies. <b>Example:</b> <code>17952895659124454</code>

## `name` (type: `string`):

Hashtag without #.<br><br><b>Used by:</b> Hashtag Info, Hashtag Posts. <b>Required by:</b> Hashtag Info, Hashtag Posts. <b>Example:</b> <code>balisunrise</code>

## `locationId` (type: `string`):

Instagram location id.<br><br><b>Used by:</b> Place Info, Place Posts. <b>Required by:</b> Place Info, Place Posts. <b>Example:</b> <code>269539800619818</code>

## `tab` (type: `string`):

Location tab.<br><br><b>Used by:</b> Place Posts.

## `highlightId` (type: `string`):

Highlight id from User Highlights (`highlight:123…` or numeric).<br><br><b>Used by:</b> Highlight Stories. <b>Required by:</b> Highlight Stories. <b>Example:</b> <code>highlight:18146604370450952</code>

## `maxItems` (type: `integer`):

Stop paginating a query after this many results. Each saved result is one billable "result-item" event.

## `maxPages` (type: `integer`):

Upper bound on API pages fetched per query (a page is usually 10–50 results).

## `batch` (type: `array`):

Optional JSON array. Each object is one query for the selected endpoint; its keys override the form fields above. Example: <code>\[{"username":"natgeo"},{"username":"nasa"}]</code>

## `splitItems` (type: `boolean`):

On (recommended): every post/user/comment is its own dataset row. Off: one row per API page (the list stays nested). Billing is per result either way.

## `concurrency` (type: `integer`):

How many batch queries run at the same time.

## Actor input object example

```json
{
  "endpoint": "user-posts",
  "keyword": "jokowi",
  "username": "jokowi",
  "postId": "DdaVv2Nysh8",
  "commentId": "17952895659124454",
  "name": "balisunrise",
  "locationId": "269539800619818",
  "highlightId": "highlight:18146604370450952",
  "maxItems": 100,
  "maxPages": 10,
  "splitItems": true,
  "concurrency": 3
}
```

# Actor output Schema

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

Scraped Instagram items. One dataset row per result (post, user, comment, hotel …) with a `_meta` object.

## `overview` (type: `string`):

Summary of the run: results, pages, not found, failed queries and stop reason.

# 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 = {
    "keyword": "jokowi",
    "username": "jokowi",
    "postId": "DdaVv2Nysh8",
    "commentId": "17952895659124454",
    "name": "balisunrise",
    "locationId": "269539800619818",
    "highlightId": "highlight:18146604370450952"
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapysocial/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 = {
    "keyword": "jokowi",
    "username": "jokowi",
    "postId": "DdaVv2Nysh8",
    "commentId": "17952895659124454",
    "name": "balisunrise",
    "locationId": "269539800619818",
    "highlightId": "highlight:18146604370450952",
}

# Run the Actor and wait for it to finish
run = client.actor("scrapysocial/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 '{
  "keyword": "jokowi",
  "username": "jokowi",
  "postId": "DdaVv2Nysh8",
  "commentId": "17952895659124454",
  "name": "balisunrise",
  "locationId": "269539800619818",
  "highlightId": "highlight:18146604370450952"
}' |
apify call scrapysocial/instagram-scraper --silent --output-dataset

```

## MCP server setup

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