# Instagram Posts Scraper (`scraper_creator/instagram-posts-scraper`) Actor

Scrape public Instagram posts and profiles, including captions, likes, comments, Reel play counts, and exact follower counts. Supports profile pagination and direct post URLs.

- **URL**: https://apify.com/scraper_creator/instagram-posts-scraper.md
- **Developed by:** [Scraper Creator](https://apify.com/scraper_creator) (community)
- **Stats:** 1 total users, 1 monthly users, 46.2% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 instagram 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/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 Post and Profile Statistics

Collect public Instagram posts and exact profile follower counts. Get captions, publication dates, post URLs, likes, comment counts, and Reel play counts in a structured dataset. Collect a profile's timeline or refresh specific post URLs. The Actor uses an isolated browser without login cookies and does not download media.

### How to use

1. Under **Profile usernames/URLs OR post URLs**, add 1–1,000 public profile usernames or URLs. To refresh specific posts instead, enter their post or Reel URLs. Do not mix profiles and posts in one run.
2. For profiles, set **Maximum posts per profile** (`resultsLimit`). The default is 100; the allowed range is 1–10,000. Direct-post mode processes every supplied post URL regardless of this limit.
3. Review **Optional proxy** if needed. No proxy is selected automatically; proxy execution has not been validated.
4. Start the Actor. Reel processing may take longer because the Actor searches the author's Reels tab to obtain the play count.
5. Check that the run succeeded and inspect `RUN-SUMMARY`, then export the dataset or retrieve it through the Apify API.

For a first run, use one profile and a small result limit. The limit is a maximum, not a guaranteed result count or proof of complete profile coverage.

### Input

Run memory defaults are managed in Apify Console under Actor Settings. The source does not declare `defaultMemoryMbytes`; explicit run, task, or API memory settings can override the cloud default. Memory is a run option, not an input JSON field.

#### Example

```json
{
  "username": ["https://www.instagram.com/instagram/"],
  "resultsLimit": 100
}
```

#### Fields

| Field | Required | Description |
| --- | --- | --- |
| `username` | For posts | Array of 1–1,000 profile names/URLs, or direct-post URLs. Use one kind per run. |
| `usernames` | For followers only | JSON/API alternative to `username`; accepts profile names/URLs only. Never supply both keys. |
| `resultsLimit` | No | Maximum posts per profile, from 1 to 10,000; default 100. Does not limit explicit post URLs. |
| `proxyConfiguration` | No | Optional Apify proxy configuration. Direct connections are used when omitted. |

Use `instagram.com` or `www.instagram.com` HTTPS URLs without tracking query parameters or fragments. Bare profile names such as `instagram` are also accepted.

For direct-post refreshes, put post URLs in the same `username` array. `/p/`, `/reel/`, `/reels/` and `/tv/` aliases normalize to one shortcode. All requested posts are processed; `resultsLimit` only limits profile collection. Do not mix profile and post URLs in a request.

#### Followers-only input

For followers only, switch to JSON input and use the plural `usernames` key:

```json
{
  "usernames": ["https://www.instagram.com/instagram/"]
}
```

A profile with no posts produces no post rows to carry followers. Use the followers-only input when a standalone follower row is needed.

#### Direct-post input

Replace the illustrative shortcodes below with real post shortcodes. Keep the `username` key singular even when supplying multiple URLs:

```json
{
  "username": [
    "https://www.instagram.com/p/POST_SHORTCODE/",
    "https://www.instagram.com/reel/REEL_SHORTCODE/"
  ]
}
```

### Output

Each post is one row; a carousel remains one row. Profile collection includes pinned posts and excludes posts whose verified author differs from the requested profile. Direct-post mode returns the actual author.

#### Example

The following is a synthetic example, not live statistics:

```json
{
  "id": "123456789",
  "shortCode": "ExampleCode",
  "url": "https://www.instagram.com/p/ExampleCode/",
  "inputUrl": "https://www.instagram.com/example/",
  "ownerUsername": "example",
  "ownerId": "123",
  "followersCount": 500,
  "timestamp": "2024-01-01T00:00:00.000Z",
  "caption": "Example title\n\nExample body #example",
  "type": "Video",
  "productType": "clips",
  "likesCount": 0,
  "commentsCount": 2,
  "videoPlayCount": 1200,
  "videoViewCount": null,
  "hashtags": [
    "#example"
  ],
  "scrapedAt": "2024-01-02T00:00:00.000Z",
  "warnings": []
}
```

#### Fields

| Field | Description |
| --- | --- |
| `id`, `shortCode`, `url`, `inputUrl` | String post ID, shortcode, post URL, and requested source. |
| `ownerUsername`, `ownerId`, `followersCount` | Author and current exact follower count. |
| `timestamp`, `caption`, `hashtags` | Publication time, caption with source line breaks, and hashtags. |
| `type`, `productType` | Image, Sidecar (carousel), or Video; Reels use `productType: "clips"`. |
| `likesCount`, `commentsCount` | Public like and comment counts. Hidden likes stay `null`. |
| `videoPlayCount`, `videoViewCount` | Separate play and view metrics. Reel plays are not copied into views. |
| `scrapedAt`, `warnings` | Collection time and data notices. |

Followers-only rows contain `id`, `username`, `url`, `inputUrl`, `followersCount`, and `scrapedAt`.

#### Data accuracy

Unavailable optional metrics remain `null`; confirmed zero remains `0`. Missing or invalid followers or required Reel play counts fail the target. Counts are snapshots, not historical analytics.

### Viewing and exporting results

Open the run's dataset to inspect results. Each post is one row; a carousel is one row rather than one row per image. Export JSON to preserve arrays such as `hashtags`, or use a tabular export for spreadsheet analysis. API integrations can retrieve the run's default dataset items.

Open `RUN-SUMMARY` in the run's default key-value store and check every requested target. Import successful runs only: rows from earlier targets can remain even if a later target fails.

### Pricing

Check the Actor page for current prices. In pay-per-event runs, each returned result is billable. Proxy usage may add separate charges. Results delivered before a failure or budget stop may already be charged; a failed run does not mean no cost.

### Limits and failures

- Reaching the profile limit can succeed but does not mean all posts were collected. Check `limitReached` and `endOfFeed` in `RUN-SUMMARY`.
- Old Reels can take longer because their play counts require searching the author's Reels tab. A missing target, unavailable required play count, or failed lookup makes the target fail; not every old Reel can be refreshed successfully.
- One failed target fails the whole run, including multi-account batches. Valid rows already written remain available; import successful runs only.
- When the budget prevents completion, the run fails with `MAX_TOTAL_CHARGE_REACHED`, `stoppedEarly: true`, and `partial: true` in the summary.
- Use a fresh dataset for each run; nonempty datasets are rejected.
- Login, private content, comment bodies, Stories, media downloading, and transcription are not supported. Public access restrictions can prevent collection.

### Refreshing statistics

Start a new run with a fresh dataset. Reuse profile inputs to collect the current timeline up to your limit, or supply specific post URLs to refresh older posts outside that limit. For standalone follower rows, use the plural `usernames` input shown above.

For API compatibility and operator setup, see [DEVELOPMENT.md](DEVELOPMENT.md).

# Changelog

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

# Actor input Schema

## `username` (type: `array`):

Post mode. Do not combine with usernames.

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

Defaults to 100. Does not limit explicit post URLs.

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

Optional proxy configuration. Direct connections are used when omitted.

## Actor input object example

```json
{}
```

# Actor output Schema

## `posts` (type: `string`):

No description

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

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

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

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

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

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

```

## MCP server setup

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