# Instagram Scraper — Profiles, Posts, Reels, Comments · No Login (`autofacts/instagram-scraper`) Actor

Scrape public Instagram profiles, posts and Reels by username or URL, no login: captions, hashtags, mentions, topic tags, tagged users, co-authors, engagement counts, video and audio-only URLs, and optional comments. A 24-post profile in about a minute. Pay per result, no Instagram API needed.

- **URL**: https://apify.com/autofacts/instagram-scraper.md
- **Developed by:** [Richard Feng](https://apify.com/autofacts) (community)
- **Categories:** Social media, Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 post or reels

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
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 · No Login

**This Instagram scraper reads any public account by username or URL — no Instagram account, no login, no browser.**

Posts, Reels and carousels with captions, hashtags, mentions, **the audio-only track of every video that has one**,
Instagram's own topic tags, tagged users, co-authors, engagement numbers and comments.

|  |  |
|---|---|
| 🔓 **No login, no account** | 🎙️ **Audio-only track** wherever a video has one |
| 🏷️ Hashtags · Mentions · **Topics** | 👥 Tagged users & co-authors |
| 🖼️ Posts · Reels · Carousels | 💬 Comments, optional |
| ⚡ A 24-post profile in about a minute | 🌍 Any public account |

***

### 📑 Table of contents

- [What can this Actor do?](#-what-can-this-actor-do)
- [What data can I extract?](#-what-data-can-i-extract)
- [Quick start](#-quick-start)
- [Input reference](#-input-reference)
- [Output reference](#-output-reference)
- [Output example](#-output-example)
- [Why choose this Actor?](#-why-choose-this-actor)
- [How much does it cost?](#-how-much-does-it-cost)
- [Recipe: Reels → transcripts](#-recipe-reels--transcripts)
- [Automation & AI agents](#-automation--ai-agents)
- [FAQ](#-faq)
- [Notes and limitations](#-notes-and-limitations)
- [Other Actors by autofacts](#-other-actors-by-autofacts)

***

### ✨ What can this Actor do?

| 🧲 Collect | ⚙️ Built in |
|---|---|
| 👤 **Profiles** — bio, full name, followers, following, verified, private, bio links, avatar | 📅 Read a profile's latest posts and its Reels tab |
| 🖼️ **Posts & carousels** — caption, hashtags, mentions, likes, comment count, and **every carousel child's** image and video links | 🎯 Per-account caps, so a run's size is predictable |
| 🎞️ **Reels** — everything above plus **play counts** and duration | 💬 Optional comments with author, text, likes and replies |
| 🎬 **Media** — the still image, the video, and the **audio-only track** | 🚦 Hard request cap and concurrency control |
| 💬 **Comments** — author, text, likes, reply count, timestamp | 🔗 Canonical public URLs for joining and filtering |
| 🏷️ **Context** — topic tags, tagged users, co-authors, location | 🌐 Apify Proxy residential by default |

Point it at a **profile**, a **post** or a **Reel**. That's the whole interface.

***

### 🔎 What data can I extract?

#### 👤 Profiles

Who is behind the account: `username`, `fullName`, `biography`, `followerCount`, `followingCount`,
`isVerified`, `isPrivate`, `bioLinks`, `externalUrl`, `profilePicUrl`, `hasReels`, `mediaCount`.

#### 🖼️ Posts, Reels and carousels

Everything around one piece of content, in one record:

- **Content** — `caption`, `hashtags[]`, `mentions[]`, `audioTitle`, `accessibilityCaption`
- **Identity** — `id`, `shortcode`, `kind` (`post` / `reel` / `igtv`), `takenAt`, `productType`, `format`
- **Engagement** — `likeCount`, `commentCount`, `playCount`, `viewCount`
- **Media** — `medias[]`: the image, the video, and the video's **`audioUrl`**
- **Context** — `topics[]` (Instagram's own topic tags), `taggedUsers[]`, `coauthors[]`, `location`
- **Comments** *(optional)* — `comments[]` with author, text, likes, replies, timestamp

#### 🏷️ Hashtags and mentions

Instagram does not return hashtags or mentions as fields — they live inside the caption. This Actor
parses them out for you into clean arrays, so `#PerpetualPlanet` and `@Rolex` arrive as data, not as text
you have to regex. 💡

#### 🎯 Topic tags — and why they matter

Instagram files every post under **topic pills** (`black rain frog`, `apollo mission`, `astronomy`).
This Actor returns them in `topics[]`. They are a ready-made, platform-assigned category for grouping,
clustering, search and trend work — no keyword guessing.

#### 🎙️ The audio-only track

Every video and Reel record carries `medias[].audioUrl`: the **audio-only rendition**, roughly **0.4 MB**
where the video is several megabytes. It is the small, correct input for speech-to-text — see the
[transcript recipe](#-recipe-reels--transcripts).

***

### 🚀 Quick start

1. **Create a free Apify account** 🙋
2. Open this Actor and **paste a link** — a profile, a post or a Reel 👇
3. *(Optional)* turn on **Include comments** 💬
4. **Save & Start**, then download the dataset as JSON, CSV or Excel 📦

```json
{
    "startUrls": [{ "url": "https://www.instagram.com/natgeo/" }],
    "maxPostsPerProfile": 12
}
```

#### 🔗 What links can I paste?

| Paste this | And you get |
|---|---|
| `instagram.com/natgeo/` | The profile plus its latest posts and Reels |
| `instagram.com/p/DAbc123XyZ/` | That one post, in full |
| `instagram.com/reel/DeeUUHNAqQj/` | That one Reel, in full |
| `@natgeo` or `natgeo` | Same as the profile link |

💡 Post and Reel links need **no extra step** — the link itself carries the post id.
💡 Mix and match: profiles in **Start URLs**, extra accounts in **Usernames**.

***

### ⬇️ Input reference

| Field | Type | Default | Description |
|---|---|---|---|
| **Start URLs** | array | — | Profile, post or Reel addresses to read. |
| **Usernames** | array | — | Extra accounts, with or without `@`. Equivalent to profile URLs. |
| **Max media per profile** | integer | `24` | How many posts **and** how many Reels to read in full per profile. The posts list and the Reels tab are counted separately, so a profile yields at most this many of each. Lower it to control cost. |
| **Include the Reels tab** | boolean | `true` | Also read the Reels tab. It is the only read that returns **play counts**, and it is where Reel-only content is found. |
| **Include comments** | boolean | `false` | Read each media's comments, up to the cap below. |
| **Max comments per post** | integer | `24` | Upper bound on comments stored with each post or Reel (0–500). |
| **Media per page** | integer | `12` | How many posts one page asks for (1–50). |
| **Max concurrency** | integer | `3` | How many requests run at once. |
| **Max requests per run** | integer | *(API only)* | Hard stop after this many requests. Not shown in the form; set it through the JSON input or the API. |
| **Proxy configuration** | object | Residential | Apify Proxy's RESIDENTIAL group, selected in the form and used when the field is left out: Instagram answers logged-out readers far more readily from residential addresses. |

***

### ⬆️ Output reference

One record per profile and one per post or Reel, in the same dataset.

#### 👤 Profile record

| Field | Type | Notes |
|---|---|---|
| `type` | string | `profile` |
| `source` | object | `{id, canonicalUrl, crawlUrl?, username}` |
| `id` | string | Instagram's numeric id |
| `username` | string | |
| `fullName` | string | |
| `biography` | string | |
| `isPrivate` / `isVerified` | boolean | |
| `followerCount` / `followingCount` / `mediaCount` | integer | Absent rather than `0` when Instagram does not return it |
| `profilePicUrl` | string | |
| `bioLinks` | array | `externalUrl` is the first one |
| `hasReels` | boolean | |
| `scrapedAt` | string | ISO 8601 |

#### 🖼️ Post / Reel record

| Field | Type | Notes |
|---|---|---|
| `type` | string | `post` |
| `source` | object | `{id, canonicalUrl, crawlUrl?, username}` — `canonicalUrl` is the public page |
| `kind` | string | `post` · `reel` · `igtv` |
| `id` / `shortcode` | string | |
| `owner` | object | `{id, username, fullName, isVerified}` |
| `takenAt` | string | ISO 8601 |
| `caption` | string | |
| `hashtags` / `mentions` | array | Parsed from the caption, without `#` / `@` |
| `format` | string | `image` · `video` · `carousel` |
| `productType` | string | Instagram's own value (`clips`, `feed`, …) |
| `isVideo` / `isReel` | boolean | |
| `durationSeconds` | number | From the Reels tab, or from a carousel child |
| `width` / `height` | integer | |
| `carouselCount` | integer | Child count when it's a carousel. Each child's image, video and audio track is in `medias[]` |
| `likeCount` / `commentCount` | integer | |
| `playCount` | integer | Reels tab only |
| `hasAudio` | boolean | Whether any asset of the post carries an audio track |
| `viewCount` | integer | |
| `medias` | array | `{type: "Image", url, width, height}` and/or `{type: "Video", videoUrl, audioUrl, width, height}` |
| `hasAudio` / `audioTitle` | boolean / string | |
| `accessibilityCaption` | string | Instagram's own description of the media |
| `taggedUsers` | array | `{username, id, fullName?, x?, y?}` — `x`/`y` place the tag on a photo, as fractions of its width and height; a video's tags have none |
| `coauthors` | array | `{username, id, fullName?}` — the other accounts a collab is credited to |
| `topics` | array | Instagram's topic tags |
| `location` | object | `{id?, name}` |
| `commentsRead` | integer | How many comments this record holds |
| `comments` | array | `{id, authorUsername, authorId, authorIsVerified, text, likeCount, replyCount, parentCommentId, createdAt}` |
| `scrapedAt` | string | ISO 8601 |

***

### 📦 Output example

```json
{
    "type": "post",
    "source": {
        "id": "instagram",
        "canonicalUrl": "https://www.instagram.com/reel/DeckcQnA23l/",
        "crawlUrl": "https://www.instagram.com/natgeo/",
        "username": "natgeo"
    },
    "kind": "reel",
    "id": "4007238040107052517",
    "shortcode": "DeckcQnA23l",
    "owner": { "id": "787132", "username": "natgeo", "fullName": "National Geographic", "isVerified": true },
    "takenAt": "2026-10-13T19:35:03.000Z",
    "caption": "Presented by @Rolex. Black rain frogs spend most of their lives…",
    "hashtags": ["Rolex", "PerpetualPlanet", "AfricaEarthsWildHome"],
    "mentions": ["Rolex", "DisneyPlus", "hulu"],
    "format": "video",
    "isVideo": true,
    "isReel": true,
    "likeCount": 17427,
    "commentCount": 76,
    "medias": [
        { "type": "Image", "url": "https://…jpg", "width": 1080, "height": 1920 },
        { "type": "Video", "videoUrl": "https://…mp4", "audioUrl": "https://…m4a", "width": 1080, "height": 1920 }
    ],
    "hasAudio": true,
    "audioTitle": "Original audio",
    "taggedUsers": [],
    "coauthors": [],
    "topics": ["black rain frog", "south africa wildlife", "fossorial animals", "nature documentary"],
    "commentsRead": 0,
    "comments": [],
    "scrapedAt": "2026-10-14T14:45:20.949Z"
}
```

> 🔗 **`crawlUrl`** tells you *where the record was found* — here natgeo's profile page — when that
> differs from the canonical URL.

***

### ⭐ Why choose this Actor?

|  |  |
|---|---|
| 🎙️ **Audio-only track, not just a video URL** | The single most useful field for anyone building transcripts: ~0.4 MB instead of a multi-megabyte video, ~10× less to move and transcribe. |
| 🏷️ **Topic tags** | Instagram's own categorization of the post, returned as `topics[]`. A ready-made grouping key. |
| 🔖 **Hashtags and mentions, parsed** | Clean arrays out of the box — no caption regex in your pipeline. |
| 👥 **Co-authors and tagged users** | The collaboration graph that most Instagram tools drop. |
| 🔓 **No login, no account, no session to rotate** | Public data only. Nothing to leak, nothing that can get an account banned. |
| 🔗 **Canonical public URLs** | Every record points at the page a human would open, so joins and audits are trivial. |
| 🎯 **Predictable run size** | Per-profile caps and a hard request cap — you decide how big a run gets. |
| 📅 **Live data** | Read at run time, never a stale cache. |

***

### 💰 How much does it cost?

**You pay per result written to the dataset** — pay-per-event. No subscription, no minimum, and nothing
is charged for a record the Actor could not read.

| Event | Free | Starter | Scale | Business and up |
| :--- | ---: | ---: | ---: | ---: |
| 📄 **Post / Reel**, per 1,000 stored | $2.00 | $1.80 | $1.60 | $1.50 |
| 👤 **Profile**, per 1,000 stored | $2.00 | $1.80 | $1.60 | $1.50 |
| 💬 **Comment**, per 1,000 stored with a post | $0.50 | $0.40 | $0.30 | $0.30 |
| ▶️ **Actor start**, per run | $0.00005 | $0.00005 | $0.00005 | $0.00005 |

For comparison, the official Instagram Scraper charges **$2.70 per 1,000 results** on the Free plan,
falling to $1.50 on **Gold**, $0.90 on **Platinum** and **$0.50 on Diamond**, and the official comment
scraper **$2.60 per 1,000 comments** on Free. Every one of our tiers is below the official Free price.

💡 **A worked example.** A profile with 24 posts, **Reels tab off**, comments off, on the Free plan: **1
profile + 24 posts** ≈ `$0.002 + 24 × $0.002 + $0.00005` ≈ **$0.05**. The Reels tab is **on by default and
counted separately**, so leaving it on can add up to another 24 records (≈ +$0.048; a Reel that is also in the
posts list is stored and charged once). Turning comments on adds one charge per comment stored: with the
default 24 per post, 24 posts' 576 comments ≈ +$0.29.

**Cost levers:** ⬇️ lower **Max media per profile**, ⬜ leave **comments** off or lower **Max comments per post**, 🎞️ turn off **the Reels
tab**, 🚦 set **Max requests per run** (and Apify's own **maximum cost per run** — the Actor stops starting
new work when it is reached; a request already in flight finishes).

The event price **includes the platform usage this Actor generates** — compute and proxy. Apify bills usage on top only if the publisher has switched to "pay per event + usage"; the Actor's page shows which applies.

***

### 🎙️ Recipe: Reels → transcripts

The whole reason `audioUrl` exists:

```
1. Run this Actor on the profiles you care about   →  dataset of Reels
2. Take medias[].audioUrl where type == "Video"    →  ~0.4 MB audio file
3. Send it to Whisper / Deepgram / Groq / any STT  →  transcript
4. Join on source.canonicalUrl                     →  transcript + engagement in one table
```

Feeding a speech-to-text model the full video instead costs roughly 10× the bandwidth for the same words. 🎯

***

### 🤖 Automation & AI agents

- 🔌 **Apify API** — start a run and read the dataset from any language
- 🧩 **No-code** — Make, n8n, Zapier and the Apify integrations
- 🤖 **MCP / LLM agents** — the Actor is callable as an MCP tool from Claude, ChatGPT or any agent that
  speaks MCP; every field is plain JSON with stable names
- 📤 **Exports** — JSON, CSV, Excel and XML straight from the dataset

**Connect over MCP**

```
https://mcp.apify.com?tools=autofacts/instagram-scraper
```

In a client that reads an `mcpServers` configuration block:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=autofacts/instagram-scraper",
      "headers": { "Authorization": "Bearer YOUR_APIFY_TOKEN" }
    }
  }
}
```

The agent reads this Actor's parameters and their descriptions straight from the input schema, and the
hosted server infers the result field types from the dataset schema — so a model knows what to send and
what comes back before it ever calls anything.

**Or call the API directly**

```bash
curl -X POST "https://api.apify.com/v2/acts/autofacts~instagram-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"usernames": ["natgeo"], "maxPostsPerProfile": 12, "includeReels": false}'
```

The response body is the dataset records described above: one profile, then its posts.

***

### ❓ FAQ

**Do I need an Instagram account?** 🙅 No. Nothing is logged in; no account cookies exist to send. Requests carry only the anonymous cookies Instagram sets on a logged-out visit, as any visitor's browser does.

**Is it legal to scrape Instagram?** ⚖️ This Actor reads only what Instagram shows any logged-out visitor,
and it never logs in. In *Meta v. Bright Data* (2024) a US court found that collecting public Instagram
data while logged out did not breach Meta's terms. Whether *your* use is lawful still depends on what you
collect and what you do with it — profiles and comments can be personal data under laws such as the GDPR —
so check with your own counsel.

**Is this an alternative to the Instagram API?** 🔌 For reading public data, yes. Instagram's official
API is built for managing your own professional account: it needs a Meta app, a business or creator
account and app review, and it reaches other accounts only through a limited business-discovery
endpoint. This Actor reads any public profile, post or Reel without any of that, and you call it through
the Apify API.

**Can I use it from Claude, ChatGPT, n8n or Make?** 🤖 Yes. It is an MCP tool for AI agents and an
ordinary API call for automation tools; see **Automation & AI agents** above.

**Can I export Instagram comments to Excel or CSV?** 📤 Yes. Turn **Include comments** on and each post
carries its comments in `comments[]`. Download JSON to keep them nested under their post; CSV and Excel
spread them across columns (`comments/0/text`, `comments/1/text`, …).

**Can it read Stories or followers?** ❌ No. Instagram only serves those to logged-in users, and this
Actor deliberately stays logged out.

**Can it search hashtags or keywords?** ❌ No — same reason. It reads the accounts you point it at.
`topics[]` and `hashtags[]` are there so you can group and filter what you collect.

**Why is `playCount` missing on some posts?** 🎞️ Play counts only come from the Reels tab. Leave
**Include the Reels tab** on (it's on by default) and Reels will carry them.

**Why do some records have no `audioUrl`?** 🖼️ Only videos carry audio. An image has none, and a carousel has one wherever a child is a video — every child's assets are in `medias[]`.

**How fresh is the data?** ⏱️ Read live, at the moment you run.

**How do I keep runs small?** 🎯 Lower **Max media per profile**, keep comments off, and set **Max requests
per run**.

**A run returned 0 items — why?** 🤔 Usually the account is private, the link is wrong, or the profile has
no posts. The run log says which. If *every* request fails, the Actor's own start-up check stops the run
with a clear message instead of returning empty results.

**Which Instagram URL forms work?** ✅ In **Start URLs**: `https://www.instagram.com/<user>/`,
`…/p/<code>/`, `…/reel/<code>/`, `…/reels/<code>/` and `…/tv/<code>/` (also with the account in front, as in
`…/<user>/p/<code>/`, and on `m.instagram.com` or `instagr.am`). Start URLs must be full addresses: Apify
refuses the whole input when one has no `https://`. In **Usernames**: `natgeo`, `@natgeo` or
`instagram.com/natgeo`. A share link (`instagram.com/share/…` or `instagram.com/s/…`) carries a code that is
not the post's own: open it and paste the address it leads to. The run log names every link it could not
use, and why.

***

### ⚠️ Notes and limitations

- 📖 Reads **publicly visible** Instagram data only, without logging in.
- 🚫 Not available without a login, and therefore not implemented: Stories, highlights, followers,
  following, hashtag pages, keyword search, business contact details.
- 🎞️ `playCount` and `durationSeconds` come from the Reels tab node, so posts read from the timeline
  don't carry them.
- ⏳ Instagram changes its surface from time to time. The Actor runs a start-up check and fails loudly
  rather than returning empty results; if that happens it needs an update from the maintainer.
- 🖼️ Media URLs (`videoUrl`, `audioUrl`, image `url`) are signed links that expire — download or
  transcribe them soon after the run.
- 📅 Records are a snapshot of the moment you ran it; run again for fresh numbers.

***

### 🧰 Other Actors by autofacts

Apify only auto-recommends Actors in the same category, so here are the ones that actually pair with this scraper:

| Actor | What it's for |
| :--- | :--- |
| [Instagram Transcript Scraper](https://apify.com/autofacts/instagram-transcript-scraper) | The spoken words of the Reels this Actor finds, as text with timestamps — same accounts, same input |
| [Shopify Store Leads](https://apify.com/autofacts/shopify-store-leads) | Shopify brands that link an Instagram account, with their store size and apps — the accounts to read here |
| [Bluesky Scraper](https://apify.com/autofacts/bluesky-scraper) | Posts, profiles, feeds and interactions |
| [TikTok Subtitle & Transcript Scraper](https://apify.com/autofacts/tiktok-subtitle-transcript-scraper) | TikTok captions and transcripts, for the same creators on another platform |

All of them: [apify.com/autofacts](https://apify.com/autofacts)

***

### 💬 Feedback and support

Found a bug, or a field you need that isn't here? Open an issue on the Actor's page — it's read, and it's
what decides what gets built next.

# Actor input Schema

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

Profile addresses (https://www.instagram.com/natgeo/) or post and Reel addresses (https://www.instagram.com/reel/…). A post address needs no extra request: its code carries its id.

## `usernames` (type: `array`):

Profile names, with or without the @.

## `maxPostsPerProfile` (type: `integer`):

How many posts and Reels to read in full for each profile. The posts list and the Reels tab are counted separately, so a profile yields at most this many of each.

## `includeReels` (type: `boolean`):

Also read each profile's Reels tab (its first page). The tab is the only read that carries play counts.

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

Read each media's comments, up to the cap below. The first page rides along with the media read. Each comment stored is charged once.

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

Upper bound on comments stored with each post or Reel (0–500).

## `postsPerPage` (type: `integer`):

How many posts one page asks for.

## `maxConcurrency` (type: `integer`):

How many requests run at once.

## `maxRequestsPerCrawl` (type: `integer`):

Stop after this many requests. Empty means no limit.

## `proxy` (type: `object`):

Instagram answers a logged-out reader far more readily from a residential address, so Apify Proxy's RESIDENTIAL group is selected here and is also what a run gets when the field is left out. Set "useApifyProxy" to false to go out from this container's own address.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.instagram.com/natgeo/"
    }
  ],
  "maxPostsPerProfile": 24,
  "includeReels": true,
  "includeComments": false,
  "maxCommentsPerPost": 24,
  "postsPerPage": 12,
  "maxConcurrency": 3,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One row per profile (type "profile"): bio, full name, follower and following counts, verified and private flags, bio links, avatar. One row per post, Reel or carousel (type "post"): caption, hashtags, mentions, Instagram's topic tags, tagged users, co-authors, location, engagement, every image and video link with the audio-only track, and its comments when they were asked for.

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

How the run went: how many profiles, posts and comments were stored, how many requests were handled, failed or left pending, and whether it stopped at the maximum charge you set.

# 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 = {
    "startUrls": [
        {
            "url": "https://www.instagram.com/natgeo/"
        }
    ],
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("autofacts/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 = {
    "startUrls": [{ "url": "https://www.instagram.com/natgeo/" }],
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("autofacts/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 '{
  "startUrls": [
    {
      "url": "https://www.instagram.com/natgeo/"
    }
  ],
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call autofacts/instagram-scraper --silent --output-dataset

```

## MCP server setup

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