# Instagram Post Scraper Ultra (`qaseemiqbal/instagram-post-scraper-ultra`) Actor

Scrape public Instagram posts, reels, carousels, captions, media URLs, engagement metrics, owner details, hashtags, mentions, and optional enrichment from profiles or direct URLs.

- **URL**: https://apify.com/qaseemiqbal/instagram-post-scraper-ultra.md
- **Developed by:** [Muhammad Qaseem Iqbal](https://apify.com/qaseemiqbal) (community)
- **Categories:** Social media, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 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.

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 Post Scraper Ultra 📸⚡

Extract useful public data from Instagram posts, reels, and profile feeds without needing to log in to Instagram.

Instagram Post Scraper Ultra is built for people who need clean, ready-to-use Instagram post data for research, monitoring, reporting, marketing, influencer discovery, content tracking, and data analysis. Add Instagram usernames, profile URLs, post URLs, or reel URLs, run the Actor, and get structured results in an Apify dataset. 🚀

> This Actor works with public Instagram content only. It does not access private accounts, stories, login-only pages, or anything behind an Instagram account login. 🔒

### What Does Instagram Post Scraper Ultra Do? 🤔

Instagram Post Scraper Ultra helps you collect public information from Instagram posts and reels, including captions, hashtags, mentions, media URLs, public engagement numbers, owner details, and scrape status.

You can use it to:

- 📸 Scrape public posts from Instagram profile pages
- 🎬 Scrape public reels from direct reel URLs or profile discovery
- 🖼️ Scrape carousel posts when they are publicly available
- 🔗 Scrape direct Instagram post URLs one by one
- 🧾 Extract captions, hashtags, mentions, and timestamps
- ❤️ Collect public likes, comments counts, views, plays, and video duration when visible
- 👤 Get public post owner information such as username, full name, profile URL, and verified status
- 🏷️ Include tagged users, coauthors, and music info when you turn those options on
- 📦 Save results to an Apify dataset for download, API use, or integrations

### Why Use This Instagram Post Scraper? 🌟

Instagram is full of public signals about brands, creators, trends, campaigns, products, and communities. This Actor turns public Instagram post pages into organized data you can filter, export, and analyze.

Popular use cases include:

- 📊 Track brand or competitor content performance
- 🧑‍🎨 Monitor creators, influencers, publishers, and public figures
- 🔍 Find hashtags, mentions, and content themes across posts
- 📅 Watch new posts from selected profiles
- 🎥 Collect reel and video metadata for content research
- 🧠 Build datasets for social listening, dashboards, BI tools, or AI workflows
- 🗂️ Archive public media URLs for reporting or review
- 🤝 Identify public collaborations, coauthors, and paid partnership markers when available

### What Instagram Data Can You Extract? 🧺

Each successful result can include:

| Data group | What you get |
|---|---|
| 🔗 Source | Original input, input type, profile URL, discovery method |
| 📝 Post details | Post ID, shortcode, URL, content type, timestamp, pinned/sponsored flags when visible |
| 👤 Owner | Username, full name, user ID, profile URL, profile picture, verified status |
| ❤️ Metrics | Likes, comments count, video views, plays, video duration, and availability notes |
| 💬 Caption | Caption text, hashtags, mentions, and language field |
| 🖼️ Media | Image URLs, video URLs, thumbnails, alt text, media position, availability |
| 🏷️ Extra public data | Tagged users, coauthors, and music/audio info when enabled and available |
| 🧭 Status | Whether the item succeeded, failed, or was skipped, plus the reason |

### How To Use It 🛠️

1. Add one or more Instagram usernames or URLs. ✍️
2. Choose how many posts you want from each profile. 🔢
3. Optional: filter by date, content type, or pinned posts. 📅
4. Optional: turn on extra fields like tagged users, coauthors, music info, or media downloads. ⚙️
5. Click **Start**. ▶️
6. Download your results from the Apify dataset as JSON, CSV, Excel, XML, or RSS. 📥

#### Supported Inputs ✅

You can mix these in one run:

- `natgeo`
- `@natgeo`
- `https://www.instagram.com/natgeo/`
- `https://www.instagram.com/p/DLNsnpUTdVS/`
- `https://www.instagram.com/reel/SHORTCODE/`

#### Not Supported 🚫

This Actor does not scrape:

- 🔐 Private Instagram accounts
- 🔑 Login-only content
- 📖 Instagram Stories
- #️⃣ Hashtag pages
- 📍 Place/location pages
- 👥 Followers or following lists
- 💬 Full deep comment threads

### Input Example 📥

Scrape a small public profile sample:

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

Scrape one direct post:

```json
{
  "startUrls": [
    { "url": "https://www.instagram.com/p/DLNsnpUTdVS/" }
  ],
  "maxTotalResults": 1,
  "commentsMode": "none",
  "downloadMedia": false
}
```

Monitor only newer posts:

```json
{
  "startUrls": [
    { "url": "https://www.instagram.com/natgeo/" }
  ],
  "resultsLimit": 25,
  "onlyPostsNewerThan": "1 day",
  "pinnedPostHandling": "date_filter"
}
```

Archive public image URLs and thumbnails:

```json
{
  "startUrls": [
    { "url": "https://www.instagram.com/natgeo/" }
  ],
  "resultsLimit": 5,
  "includeMediaUrls": true,
  "downloadMedia": true,
  "mediaDownloadTypes": ["image", "thumbnail"]
}
```

### Important Input Settings ⚙️

| Setting | Plain-English meaning |
|---|---|
| `startUrls` | Instagram usernames, profile URLs, post URLs, or reel URLs to scrape |
| `resultsLimit` | Maximum posts to discover from each profile input |
| `maxTotalResults` | Optional total result cap for the whole run |
| `onlyPostsNewerThan` | Keep only posts newer than a date or relative time, such as `1 day` |
| `onlyPostsOlderThan` | Keep only posts older than a date or relative time |
| `includePosts` | Include normal feed posts |
| `includeReels` | Include reels |
| `includeCarousels` | Include carousel posts |
| `commentsMode` | Keep as `none` for lowest cost; preview modes only collect limited public comment snippets when available |
| `includeTaggedUsers` | Include tagged users when Instagram exposes them publicly |
| `includeCoauthors` | Include public collaborator/coauthor data |
| `includeMusicInfo` | Include public music/audio data for reels when available |
| `downloadMedia` | Save selected media files to Apify key-value store |
| `proxyConfiguration` | Enable Apify Proxy only if you need extra reliability |

### Output Example 📤

The Actor stores results in the default Apify dataset. Each dataset item is one post, reel, carousel, or skipped/failed record if you choose to emit skipped records.

```json
{
  "schemaVersion": "1.0.0",
  "source": {
    "input": "https://www.instagram.com/p/DLNsnpUTdVS/",
    "inputUrl": "https://www.instagram.com/p/DLNsnpUTdVS/",
    "inputType": "postUrl",
    "profileUsername": "natgeo",
    "profileUrl": "https://www.instagram.com/natgeo/",
    "discoverySource": "direct"
  },
  "post": {
    "id": "POLARIS_3660778310592222546",
    "shortCode": "DLNsnpUTdVS",
    "url": "https://www.instagram.com/p/DLNsnpUTdVS/",
    "contentType": "image",
    "timestamp": "2025-06-22T19:00:10.000Z"
  },
  "owner": {
    "username": "natgeo",
    "fullName": "National Geographic",
    "profileUrl": "https://www.instagram.com/natgeo/",
    "isVerified": true
  },
  "metrics": {
    "likesCount": 72876,
    "commentsCount": null,
    "videoViewCount": null
  },
  "caption": {
    "text": "Example caption text...",
    "hashtags": [],
    "mentions": []
  },
  "media": [
    {
      "type": "image",
      "position": 0,
      "displayUrl": "https://...",
      "availability": "available"
    }
  ],
  "scrape": {
    "status": "success",
    "failureReason": null
  }
}
```

### Run Summary 📋

Every run also saves a simple summary to the key-value store under `RUN_SUMMARY` and `OUTPUT`.

This helps you quickly see:

- ✅ How many sources succeeded
- ⚠️ How many sources failed or were skipped
- 📦 How many items were saved
- 🎬 How many posts, reels, or carousels were found
- 💾 How many media files were downloaded
- 🧱 Whether a limit was reached

Example:

```json
{
  "status": "succeeded",
  "counts": {
    "sourcesTotal": 1,
    "sourcesSucceeded": 1,
    "sourcesFailed": 0,
    "itemsPushed": 1,
    "posts": 1,
    "reels": 0,
    "carousels": 0
  }
}
```

### How Many Results Can You Scrape? 🔢

It depends on what Instagram makes publicly visible at the time of your run.

For profile inputs, set `resultsLimit` to decide how many posts the Actor should try to collect from each profile. For direct post and reel URLs, the Actor fetches each URL individually.

Instagram pages can change, load differently by region, or sometimes show limited public data. A good practical approach is to start with a small test run, check the results, then scale up. 🧪

### Built For Low Cost 💸

This Actor is designed to run cheaply by default:

- ⚡ Uses lightweight HTTP requests instead of a full browser
- 🧠 Uses 512 MB memory by default
- 🧵 Keeps default concurrency conservative
- 🚫 Keeps media downloads off by default
- 💬 Keeps comments off by default
- 🔌 Keeps Apify Proxy off by default
- 📉 Keeps optional enrichment fields off unless you enable them

For the lowest cost, keep these settings:

```json
{
  "commentsMode": "none",
  "downloadMedia": false,
  "includeTaggedUsers": false,
  "includeCoauthors": false,
  "includeMusicInfo": false,
  "proxyConfiguration": { "useApifyProxy": false }
}
```

Turn on proxy, media downloads, comments preview, or extra enrichment only when you need them. Those options can increase runtime, storage, or platform usage. 💡

### Integrations 🔌

Because results are stored in Apify datasets and key-value stores, you can connect them to many tools:

- 📊 Google Sheets
- 📁 Google Drive
- 💬 Slack
- 🧩 Make
- ⚡ Zapier
- 🔄 n8n
- 🏗️ Airbyte
- 📈 BI dashboards
- 🧠 AI agents and RAG workflows
- 🧑‍💻 Your own app through the Apify API

### API Usage 👨‍💻

JavaScript:

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

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

const run = await client.actor('YOUR_USERNAME/instagram-post-scraper-ultra').call({
  startUrls: [{ url: 'https://www.instagram.com/natgeo/' }],
  resultsLimit: 10,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

Python:

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("YOUR_USERNAME/instagram-post-scraper-ultra").call(
    run_input={
        "startUrls": [{"url": "https://www.instagram.com/natgeo/"}],
        "resultsLimit": 10,
    }
)

items = client.dataset(run["defaultDatasetId"]).list_items().items
print(items)
```

### Tips For Best Results ✨

- 🧪 Start with a small test run before scraping many profiles
- 🔗 Use direct post or reel URLs when you only need specific posts
- 📅 Use `onlyPostsNewerThan` for monitoring fresh content
- 📌 Use `pinnedPostHandling: "date_filter"` when old pinned posts should not appear in new-post monitoring
- 💸 Keep comments, media downloads, proxy, and extra enrichment off unless needed
- 📥 Download results as CSV or Excel if you want to work in spreadsheets
- 🧭 Check `RUN_SUMMARY` when a source fails or returns fewer results than expected

### Limitations ⚠️

Instagram can limit or change what is visible publicly. This Actor is built to be transparent when that happens.

Things to know:

- 🔐 Private accounts are not supported
- 🔑 Instagram login is not supported
- 📖 Stories are not supported
- \#️⃣ Hashtag pages are not supported
- 📍 Location pages are not supported
- 💬 Full comment crawling is not the goal of this Actor
- ⏳ Media URLs from Instagram can expire
- ❤️ Some likes, comments, views, or other metrics may be hidden or unavailable
- 🧩 Instagram page structure can change, which may affect extraction

When data is unavailable, the Actor uses `null` values or clear scrape status fields instead of silently making up data. ✅

### FAQ 🙋

#### Can I scrape private Instagram accounts? 🔐

No. This Actor only works with public Instagram content.

#### Do I need an Instagram account? 🔑

No. The Actor is designed for public pages and does not ask for Instagram credentials.

#### Can it scrape reels? 🎬

Yes. Add reel URLs directly, or use profile inputs and keep `includeReels` enabled.

#### Can it scrape carousel posts? 🖼️

Yes. Carousel media is returned in the `media` array when Instagram exposes it publicly.

#### Can it scrape comments? 💬

It can include limited public comment preview data when available, but it is not a full comments crawler. For deep comment extraction, use a dedicated comments scraper.

#### Why are some fields empty or `null`? 🕳️

Instagram does not always show every metric or field publicly. Hidden or unavailable values are returned as `null` so you can clearly tell what was not available.

#### Can I download images or videos? 💾

Yes. Enable `downloadMedia` and choose `mediaDownloadTypes`. Keep it off if you want the cheapest and fastest runs.

#### Can I get only new posts? 📅

Yes. Use `onlyPostsNewerThan`, for example `1 day`, `12 hours`, or `2026-01-31`.

#### Why did I get fewer results than requested? 🧭

Possible reasons include date filters, duplicate posts, pinned post handling, unavailable public data, Instagram page changes, or profile content limits.

### Legal And Privacy Notice ⚖️

This Actor is intended for publicly available Instagram data only. Public web data can still include personal data, so you are responsible for using the results lawfully and ethically.

Do not use this Actor to bypass privacy controls, access private content, collect login-only data, or violate applicable laws, contracts, privacy rules, GDPR, or platform terms. If you are unsure whether your use case is allowed, consult a qualified legal professional. 🧑‍⚖️

### Support 🛟

If something does not work as expected, include these details when asking for help:

- 🆔 Run ID
- 🔗 Instagram URL or username used
- ⚙️ Input settings
- 📋 `RUN_SUMMARY`
- ⚠️ Failure reason from the dataset or summary
- 🌐 Whether proxy was enabled
- 💾 Whether media download was enabled
- 💬 Whether comments mode was enabled

Clear details make issues much faster to diagnose. ✅

# Actor input Schema

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

Add Instagram usernames, profile URLs, post URLs, or reel URLs. You can mix supported input types in one run.

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

Maximum number of posts/reels/carousels to extract from each profile input. Direct post or reel URLs are fetched individually.

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

Optional global limit across the whole run. Use 0 for no additional global limit.

## `onlyPostsNewerThan` (type: `string`):

Optional date filter. Accepts relative values like '1 day', '12 hours', '2 weeks', or absolute dates like '2026-01-31' or full ISO timestamps. Interpreted in UTC.

## `onlyPostsOlderThan` (type: `string`):

Optional upper date bound. Accepts the same relative or absolute date formats as the newer-than filter.

## `applyFiltersToDirectUrls` (type: `boolean`):

If enabled, date and content-type filters are applied to direct post and reel URLs. If disabled, direct URLs are always processed when public.

## `pinnedPostHandling` (type: `string`):

Choose how pinned posts are handled. Use date filtering when monitoring only new content.

## `includePosts` (type: `boolean`):

Include normal feed image/video posts.

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

Include Instagram reels when publicly available.

## `includeCarousels` (type: `boolean`):

Include sidecar/carousel posts with multiple media children.

## `deduplicate` (type: `boolean`):

Avoid emitting duplicate posts when the same post appears in multiple inputs.

## `commentsMode` (type: `string`):

Choose whether to collect no comments, a lightweight comments preview, a limited number of comments, or prepare handoff input for a dedicated comments scraper. Use 'none' for the lowest cost.

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

Maximum comments to include per post in preview or limited mode. Keep at 0 for the lowest cost.

## `includeCommentReplies` (type: `boolean`):

Include replies for preview/limited comments when available. This may increase runtime.

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

Maximum replies to include per comment when comment replies are enabled.

## `includeOwnerProfile` (type: `boolean`):

Include public owner fields available from the post payload.

## `includeTaggedUsers` (type: `boolean`):

Include users tagged in the post media when publicly available. Disabled by default to keep payloads smaller.

## `includeCoauthors` (type: `boolean`):

Include collaborators/coauthors when publicly available. Disabled by default to keep payloads smaller.

## `includeMusicInfo` (type: `boolean`):

Include public music/audio metadata for reels or videos when available. Disabled by default to keep payloads smaller.

## `includeMediaUrls` (type: `boolean`):

Include image, video, thumbnail, and display URLs when available.

## `downloadMedia` (type: `boolean`):

Download selected media files to Apify key-value store. This can increase runtime, storage, and data transfer costs.

## `mediaDownloadTypes` (type: `array`):

Media file types to download when media download is enabled.

## `mediaKeyValueStoreName` (type: `string`):

Optional named key-value store for downloaded media. Leave empty to use the run's default key-value store.

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

Choose normalized output for new integrations or compatibility mode for users migrating from older Instagram post scraper outputs.

## `flattenOutput` (type: `boolean`):

Flatten selected nested fields into CSV-friendly top-level fields.

## `emitSkippedRecords` (type: `boolean`):

If enabled, private, unavailable, or unsupported inputs are written to the dataset as records with scrape.status='skipped'. Otherwise they are only included in the run summary.

## `saveRunSummary` (type: `boolean`):

Save a structured run summary to the key-value store under OUTPUT and RUN\_SUMMARY.

## `includeDebugFields` (type: `boolean`):

Include hidden top-level #debug fields in dataset records.

## `saveRawResponses` (type: `boolean`):

Advanced debugging option. Saves selected raw public responses to key-value store. Disabled by default.

## `debugMode` (type: `boolean`):

Enable verbose logging and additional diagnostics.

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

Maximum number of concurrent HTTP crawling tasks. The low default keeps memory and CPU usage cheap.

## `requestHandlerTimeoutSecs` (type: `integer`):

Maximum time in seconds allowed for one request handler.

## `maxRequestRetries` (type: `integer`):

Maximum retry attempts for failed requests.

## `minDelayMillis` (type: `integer`):

Minimum randomized delay between related requests in milliseconds.

## `maxDelayMillis` (type: `integer`):

Maximum randomized delay between related requests in milliseconds.

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

Proxy settings. Disabled by default for the lowest possible platform cost. Enable Apify Proxy only when reliability or geolocation requires it.

## `callbackUrl` (type: `string`):

Optional advanced callback URL called when the run finishes. Prefer Apify webhooks for most integrations.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.instagram.com/natgeo/"
    },
    {
      "url": "https://www.instagram.com/reel/SHORTCODE/"
    },
    {
      "url": "https://www.instagram.com/p/SHORTCODE/"
    }
  ],
  "resultsLimit": 50,
  "maxTotalResults": 0,
  "onlyPostsNewerThan": "1 day",
  "onlyPostsOlderThan": "2026-01-31T00:00:00Z",
  "applyFiltersToDirectUrls": false,
  "pinnedPostHandling": "include",
  "includePosts": true,
  "includeReels": true,
  "includeCarousels": true,
  "deduplicate": true,
  "commentsMode": "none",
  "maxCommentsPerPost": 0,
  "includeCommentReplies": false,
  "maxRepliesPerComment": 0,
  "includeOwnerProfile": true,
  "includeTaggedUsers": false,
  "includeCoauthors": false,
  "includeMusicInfo": false,
  "includeMediaUrls": true,
  "downloadMedia": false,
  "mediaDownloadTypes": [
    "image"
  ],
  "mediaKeyValueStoreName": "",
  "outputMode": "normalized",
  "flattenOutput": false,
  "emitSkippedRecords": false,
  "saveRunSummary": true,
  "includeDebugFields": false,
  "saveRawResponses": false,
  "debugMode": false,
  "maxConcurrency": 2,
  "requestHandlerTimeoutSecs": 60,
  "maxRequestRetries": 2,
  "minDelayMillis": 0,
  "maxDelayMillis": 500,
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "callbackUrl": ""
}
```

# Actor output Schema

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

All scraped public Instagram post, reel, and carousel records shown in the Overview dataset view.

## `media` (type: `string`):

A media-focused dataset view with image and video URLs expanded into easy-to-scan rows.

## `diagnostics` (type: `string`):

Scrape status, skipped inputs, and failure reasons for troubleshooting a run.

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

Structured summary of totals, limits, failed sources, skipped sources, and storage IDs.

## `output` (type: `string`):

Compatibility summary stored under the OUTPUT key for tools that expect a single output record.

## `mediaFiles` (type: `string`):

Downloaded media files when media downloading is enabled.

# 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/"
        },
        {
            "url": "https://www.instagram.com/reel/SHORTCODE/"
        },
        {
            "url": "https://www.instagram.com/p/SHORTCODE/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("qaseemiqbal/instagram-post-scraper-ultra").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/" },
        { "url": "https://www.instagram.com/reel/SHORTCODE/" },
        { "url": "https://www.instagram.com/p/SHORTCODE/" },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("qaseemiqbal/instagram-post-scraper-ultra").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 '{
  "startUrls": [
    {
      "url": "https://www.instagram.com/natgeo/"
    },
    {
      "url": "https://www.instagram.com/reel/SHORTCODE/"
    },
    {
      "url": "https://www.instagram.com/p/SHORTCODE/"
    }
  ]
}' |
apify call qaseemiqbal/instagram-post-scraper-ultra --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Post Scraper Ultra",
        "description": "Scrape public Instagram posts, reels, carousels, captions, media URLs, engagement metrics, owner details, hashtags, mentions, and optional enrichment from profiles or direct URLs.",
        "version": "1.0",
        "x-build-id": "bZ53kqxQJ6oEalxRb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/qaseemiqbal~instagram-post-scraper-ultra/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-qaseemiqbal-instagram-post-scraper-ultra",
                "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/qaseemiqbal~instagram-post-scraper-ultra/runs": {
            "post": {
                "operationId": "runs-sync-qaseemiqbal-instagram-post-scraper-ultra",
                "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/qaseemiqbal~instagram-post-scraper-ultra/run-sync": {
            "post": {
                "operationId": "run-sync-qaseemiqbal-instagram-post-scraper-ultra",
                "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",
                "required": [
                    "startUrls"
                ],
                "properties": {
                    "startUrls": {
                        "title": "Instagram usernames, profiles, posts, or reels",
                        "type": "array",
                        "description": "Add Instagram usernames, profile URLs, post URLs, or reel URLs. You can mix supported input types in one run.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "resultsLimit": {
                        "title": "Max results per profile",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of posts/reels/carousels to extract from each profile input. Direct post or reel URLs are fetched individually.",
                        "default": 50
                    },
                    "maxTotalResults": {
                        "title": "Max total results",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Optional global limit across the whole run. Use 0 for no additional global limit.",
                        "default": 0
                    },
                    "onlyPostsNewerThan": {
                        "title": "Only posts newer than",
                        "type": "string",
                        "description": "Optional date filter. Accepts relative values like '1 day', '12 hours', '2 weeks', or absolute dates like '2026-01-31' or full ISO timestamps. Interpreted in UTC.",
                        "default": ""
                    },
                    "onlyPostsOlderThan": {
                        "title": "Only posts older than",
                        "type": "string",
                        "description": "Optional upper date bound. Accepts the same relative or absolute date formats as the newer-than filter.",
                        "default": ""
                    },
                    "applyFiltersToDirectUrls": {
                        "title": "Apply filters to direct post/reel URLs",
                        "type": "boolean",
                        "description": "If enabled, date and content-type filters are applied to direct post and reel URLs. If disabled, direct URLs are always processed when public.",
                        "default": false
                    },
                    "pinnedPostHandling": {
                        "title": "Pinned post handling",
                        "enum": [
                            "include",
                            "skip",
                            "date_filter",
                            "separate"
                        ],
                        "type": "string",
                        "description": "Choose how pinned posts are handled. Use date filtering when monitoring only new content.",
                        "default": "include"
                    },
                    "includePosts": {
                        "title": "Include feed posts",
                        "type": "boolean",
                        "description": "Include normal feed image/video posts.",
                        "default": true
                    },
                    "includeReels": {
                        "title": "Include reels",
                        "type": "boolean",
                        "description": "Include Instagram reels when publicly available.",
                        "default": true
                    },
                    "includeCarousels": {
                        "title": "Include carousel posts",
                        "type": "boolean",
                        "description": "Include sidecar/carousel posts with multiple media children.",
                        "default": true
                    },
                    "deduplicate": {
                        "title": "Deduplicate results",
                        "type": "boolean",
                        "description": "Avoid emitting duplicate posts when the same post appears in multiple inputs.",
                        "default": true
                    },
                    "commentsMode": {
                        "title": "Comments extraction mode",
                        "enum": [
                            "none",
                            "preview",
                            "limited",
                            "handoff"
                        ],
                        "type": "string",
                        "description": "Choose whether to collect no comments, a lightweight comments preview, a limited number of comments, or prepare handoff input for a dedicated comments scraper. Use 'none' for the lowest cost.",
                        "default": "none"
                    },
                    "maxCommentsPerPost": {
                        "title": "Max comments per post",
                        "minimum": 0,
                        "maximum": 100,
                        "type": "integer",
                        "description": "Maximum comments to include per post in preview or limited mode. Keep at 0 for the lowest cost.",
                        "default": 0
                    },
                    "includeCommentReplies": {
                        "title": "Include comment replies",
                        "type": "boolean",
                        "description": "Include replies for preview/limited comments when available. This may increase runtime.",
                        "default": false
                    },
                    "maxRepliesPerComment": {
                        "title": "Max replies per comment",
                        "minimum": 0,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Maximum replies to include per comment when comment replies are enabled.",
                        "default": 0
                    },
                    "includeOwnerProfile": {
                        "title": "Include post owner info",
                        "type": "boolean",
                        "description": "Include public owner fields available from the post payload.",
                        "default": true
                    },
                    "includeTaggedUsers": {
                        "title": "Include tagged users",
                        "type": "boolean",
                        "description": "Include users tagged in the post media when publicly available. Disabled by default to keep payloads smaller.",
                        "default": false
                    },
                    "includeCoauthors": {
                        "title": "Include coauthors",
                        "type": "boolean",
                        "description": "Include collaborators/coauthors when publicly available. Disabled by default to keep payloads smaller.",
                        "default": false
                    },
                    "includeMusicInfo": {
                        "title": "Include music/audio info",
                        "type": "boolean",
                        "description": "Include public music/audio metadata for reels or videos when available. Disabled by default to keep payloads smaller.",
                        "default": false
                    },
                    "includeMediaUrls": {
                        "title": "Include media URLs",
                        "type": "boolean",
                        "description": "Include image, video, thumbnail, and display URLs when available.",
                        "default": true
                    },
                    "downloadMedia": {
                        "title": "Download media to key-value store",
                        "type": "boolean",
                        "description": "Download selected media files to Apify key-value store. This can increase runtime, storage, and data transfer costs.",
                        "default": false
                    },
                    "mediaDownloadTypes": {
                        "title": "Media types to download",
                        "type": "array",
                        "description": "Media file types to download when media download is enabled.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "image",
                                "video",
                                "thumbnail"
                            ]
                        },
                        "default": [
                            "image"
                        ]
                    },
                    "mediaKeyValueStoreName": {
                        "title": "Media key-value store name",
                        "type": "string",
                        "description": "Optional named key-value store for downloaded media. Leave empty to use the run's default key-value store.",
                        "default": ""
                    },
                    "outputMode": {
                        "title": "Output mode",
                        "enum": [
                            "normalized",
                            "apifyInstagramPostScraperCompatible"
                        ],
                        "type": "string",
                        "description": "Choose normalized output for new integrations or compatibility mode for users migrating from older Instagram post scraper outputs.",
                        "default": "normalized"
                    },
                    "flattenOutput": {
                        "title": "Flatten output",
                        "type": "boolean",
                        "description": "Flatten selected nested fields into CSV-friendly top-level fields.",
                        "default": false
                    },
                    "emitSkippedRecords": {
                        "title": "Emit skipped records",
                        "type": "boolean",
                        "description": "If enabled, private, unavailable, or unsupported inputs are written to the dataset as records with scrape.status='skipped'. Otherwise they are only included in the run summary.",
                        "default": false
                    },
                    "saveRunSummary": {
                        "title": "Save run summary",
                        "type": "boolean",
                        "description": "Save a structured run summary to the key-value store under OUTPUT and RUN_SUMMARY.",
                        "default": true
                    },
                    "includeDebugFields": {
                        "title": "Include hidden debug fields",
                        "type": "boolean",
                        "description": "Include hidden top-level #debug fields in dataset records.",
                        "default": false
                    },
                    "saveRawResponses": {
                        "title": "Save raw responses",
                        "type": "boolean",
                        "description": "Advanced debugging option. Saves selected raw public responses to key-value store. Disabled by default.",
                        "default": false
                    },
                    "debugMode": {
                        "title": "Debug mode",
                        "type": "boolean",
                        "description": "Enable verbose logging and additional diagnostics.",
                        "default": false
                    },
                    "maxConcurrency": {
                        "title": "Max concurrency",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Maximum number of concurrent HTTP crawling tasks. The low default keeps memory and CPU usage cheap.",
                        "default": 2
                    },
                    "requestHandlerTimeoutSecs": {
                        "title": "Request handler timeout",
                        "minimum": 30,
                        "maximum": 600,
                        "type": "integer",
                        "description": "Maximum time in seconds allowed for one request handler.",
                        "default": 60
                    },
                    "maxRequestRetries": {
                        "title": "Max request retries",
                        "minimum": 0,
                        "maximum": 20,
                        "type": "integer",
                        "description": "Maximum retry attempts for failed requests.",
                        "default": 2
                    },
                    "minDelayMillis": {
                        "title": "Minimum delay",
                        "minimum": 0,
                        "maximum": 60000,
                        "type": "integer",
                        "description": "Minimum randomized delay between related requests in milliseconds.",
                        "default": 0
                    },
                    "maxDelayMillis": {
                        "title": "Maximum delay",
                        "minimum": 0,
                        "maximum": 120000,
                        "type": "integer",
                        "description": "Maximum randomized delay between related requests in milliseconds.",
                        "default": 500
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy settings. Disabled by default for the lowest possible platform cost. Enable Apify Proxy only when reliability or geolocation requires it.",
                        "default": {
                            "useApifyProxy": false
                        }
                    },
                    "callbackUrl": {
                        "title": "Completion callback URL",
                        "type": "string",
                        "description": "Optional advanced callback URL called when the run finishes. Prefer Apify webhooks for most integrations.",
                        "default": ""
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
