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

Scrapes public Instagram profile posts into structured datasets with rich metadata including captions, engagement, media.
Supports multiple profiles, pagination, post-type filtering, date-based extraction.
clean, analysis-ready output for automation, analytics, and lead generation.

- **URL**: https://apify.com/easy_scraper/instagram-posts-scraper.md
- **Developed by:** [easy scraper](https://apify.com/easy_scraper) (community)
- **Categories:** Social media, Automation, Lead generation
- **Features:** Limited permissions
- **Stats:** 51 total users, 9 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 post addeds

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 Posts Scraper

Apify Actor that collects **public profile timeline posts** from Instagram . Each accepted post becomes one **dataset** row with URLs, caption, owner, engagement metrics, and carousel-friendly fields.

***

### 1. Features

- **Multiple profiles** per run (username, `@handle`, or full profile URL).
- **`maxPosts`** cap per profile (paginates until the limit or the feed ends).
- **`dateFilter`** — optional “newer than” using **absolute** date (`YYYY-MM-DD`) or **relative** text (`7 days`, `2 weeks`, …) via the Apify datepicker.
- **`skipPinnedPosts`** — omit pinned items from results (default: `true`).
- **`postTypeFilter`** — restrict to Instagram `product_type`: `all`, `feed`, `clips`, `carousel_container`.
- **Structured output** — Instagram URL, ISO timestamp, caption fields, owner block, image URLs, optional video URL, hashtags and mentions from caption, tagged users, coauthors, carousel child summary.
- **Pagination** stops early when the feed reaches posts **older than** the date filter (non-pinned, chronological path).

***

### 6. Output fields (dataset)

| Field                           | Type              | Description                                                                 |
| ------------------------------- | ----------------- | --------------------------------------------------------------------------- |
| `scraped_from`                  | string            | Username queued for this profile                                            |
| `instagram_url`                 | string            | Post URL `https://www.instagram.com/p/{shortcode}/`                        |
| `shortcode`                     | string            | Media `code` from Instagram                                               |
| `timestamp`                     | string (ISO 8601) | From `taken_at` / `taken_at_timestamp`                                     |
| `product_type`                  | string            | e.g. `feed`, `clips`, `carousel_container`                               |
| `is_video`                      | boolean           | From `media_type` / `video_versions`                                      |
| `caption_text`                  | string | null    | Caption body                                                               |
| `like_count`                    | number | null    | Likes                                                                       |
| `comment_count`                 | number | null    | Comments                                                                    |
| `view_count`                    | number | null    | Views when present                                                         |
| `play_count`                    | number | null    | Plays; may use `ig_play_count` when present                               |
| `owner_username`                | string | null    | `user.username`                                                            |
| `display_url`                   | string | null    | Primary image URL                                                          |
| `video_url`                     | string | null    | First `video_versions` URL                                                 |
| `video_duration`                | number | null    | Seconds; may be parsed from DASH manifest                                  |
| `id`                            | string | null    | Compound media id                                                          |
| `pk`                            | string | null    | Media pk                                                                   |
| `caption_created_at`            | string | null    | Caption `created_at` as ISO                                                |
| `is_caption_edited`             | boolean           | Caption edited flag                                                        |
| `accessibility_caption`         | string | null    | Alt text                                                                    |
| `is_comments_disabled`          | boolean           | `comments_disabled === true`                                              |
| `like_and_view_counts_disabled` | boolean           | Likes/views hidden                                                         |
| `owner_id`                      | string | null    | `owner.id` or `user.id` / `user.pk`                                       |
| `owner_full_name`               | string | null    | Full name                                                                  |
| `owner_is_verified`             | boolean           | Verified                                                                   |
| `owner_profile_pic_url`         | string | null    | Avatar URL                                                                 |
| `media_name`                    | string | null    | Title or Reels audio title when present                                    |
| `image_width`                   | number | null    | `original_width`                                                           |
| `image_height`                  | number | null    | `original_height`                                                          |
| `image_urls`                    | string\[]          | `image_versions2` candidate URLs                                          |
| `is_pinned_post`                | boolean           | Pinned (only appears when not skipped upstream)                           |
| `is_sponsored`                  | boolean           | `ad_id` present                                                            |
| `is_paid_partnership`           | boolean           | Paid partnership                                                           |
| `tagged_users`                  | string\[]          | From `usertags`                                                            |
| `hashtags`                      | string\[]          | Parsed from caption                                                        |
| `caption_mentions`              | string\[]          | `@mentions` in caption                                                     |
| `coauthors`                     | array             | `{ pk, username, full_name }` objects                                       |
| `child_post_count`              | number | null    | Carousel length                                                            |
| `child_posts`                   | array             | Per-slide `{ pk, media_type, shortcode, image_url }`                       |
| `first_comment_text`            | string | null    | Not filled by current query                                               |
| `latest_comment_text`           | string | null    | Not filled by current query                                               |

***

### 3. How to run (Apify Console)

Use this Actor in the **[Apify Console](https://console.apify.com/actors/OblG239Cju8aWtvFs)**

1. Open the **Input** tab.
2. Under **Target Profiles**, add every Instagram account you want (username, `@name`, or full profile URL). This field is required.
3. Set **Maximum Posts** if you want a limit other than 50 (count is **per profile**).
4. Set **Post Type Filter** if you only want one kind of post: all, normal photos/posts, Reels, or carousels.
5. Leave **Skip pinned posts** on to drop pinned items, or turn it off to include them.
6. Under **Extract posts that are newer than**, either leave it blank (no date limit) or pick **Absolute** (calendar date) / **Relative** (e.g. last 7 days).
7. Click **Start** (or **Save & Start**). Watch **Log** for progress.
8. When the run finishes, open **Output** or **Storage → Dataset** to view, filter, or download your post rows.

**Advanced:** switch the Input view to **JSON** if you want to paste an object by hand; use the same field names as in [§4. Input](#4-input).

***

### 4. Input

```json
{
    "profiles": ["therock", "https://www.instagram.com/nasa/"],
    "maxPosts": 50,
    "postTypeFilter": "all",
    "skipPinnedPosts": true,
    "dateFilter": "2026-01-15"
}
```

Relative date example:

```json
{
    "profiles": ["nasa"],
    "maxPosts": 100,
    "postTypeFilter": "clips",
    "skipPinnedPosts": true,
    "dateFilter": "30 days"
}
```

| `postTypeFilter`       | Meaning                          |
| ---------------------- | -------------------------------- |
| `all`                  | All types that pass other filters |
| `feed`                 | Standard feed / image posts      |
| `clips`                | Reels                            |
| `carousel_container`   | Carousels                        |

***

### 5. Output (example record)

One dataset object per stored post (shape matches `.actor/dataset_schema.json`):

```json
{
    "scraped_from": "therock",
    "id": "3844133065635875205_232192182",
    "pk": "3844133065635875205",
    "shortcode": "DVZGqf2j0mF",
    "instagram_url": "https://www.instagram.com/p/DVZGqf2j0mF/",
    "product_type": "clips",
    "timestamp": "2026-02-19T12:37:02.000Z",
    "is_video": true,
    "video_duration": 261.942871,
    "view_count": null,
    "play_count": null,
    "caption_text": "Example caption…",
    "caption_created_at": "2026-02-19T12:37:04.000Z",
    "is_caption_edited": false,
    "display_url": "https://instagram.fcai19-11.fna.fbcdn.net/…",
    "accessibility_caption": null,
    "like_count": 322961,
    "comment_count": 6675,
    "is_comments_disabled": false,
    "like_and_view_counts_disabled": false,
    "owner_id": "232192182",
    "owner_username": "therock",
    "owner_full_name": "Dwayne Johnson",
    "owner_is_verified": true,
    "owner_profile_pic_url": "https://instagram.fcai19-11.fna.fbcdn.net/…",
    "media_name": "Original audio",
    "image_width": 720,
    "image_height": 1280,
    "image_urls": ["https://…"],
    "video_url": "https://instagram.fcai19-11.fna.fbcdn.net/…",
    "is_pinned_post": false,
    "is_sponsored": false,
    "is_paid_partnership": false,
    "coauthors": [],
    "tagged_users": ["americanblackfilmfestival"],
    "hashtags": ["RememberYourWhyCollection"],
    "caption_mentions": ["projectrock"],
    "child_post_count": null,
    "child_posts": [],
    "first_comment_text": null,
    "latest_comment_text": null
}
```

***

# Actor input Schema

## `profiles` (type: `array`):

List of Instagram profiles to scrape. You can provide usernames (with or without @) or full profile URLs. On the Apify platform, free and trial accounts may use at most 2 profiles per run (extra entries are skipped); paid Apify users have no such cap from this Actor.

## `maxPosts` (type: `integer`):

Total number of posts to scrape per profile. On the Apify platform, free and trial accounts are capped at 20 posts per profile; paid Apify users may set any value allowed by this field.

## `postTypeFilter` (type: `string`):

Limit results to a single Instagram product_type. "All Posts" keeps every timeline item that passes other filters.

## `skipPinnedPosts` (type: `boolean`):

When enabled, pinned profile posts are omitted from results.

## `dateFilter` (type: `string`):

Optional. Use the Absolute tab for a calendar date (YYYY-MM-DD), or Relative for a number of days, weeks, months, or years. Leave empty to disable date filtering.

## Actor input object example

```json
{
  "profiles": [
    "therock",
    "@nasa",
    "https://www.instagram.com/leomessi/"
  ],
  "maxPosts": 50,
  "postTypeFilter": "all",
  "skipPinnedPosts": true
}
```

# 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 = {
    "profiles": [
        "therock",
        "@nasa",
        "https://www.instagram.com/leomessi/"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("easy_scraper/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 = { "profiles": [
        "therock",
        "@nasa",
        "https://www.instagram.com/leomessi/",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("easy_scraper/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 '{
  "profiles": [
    "therock",
    "@nasa",
    "https://www.instagram.com/leomessi/"
  ]
}' |
apify call easy_scraper/instagram-posts-scraper --silent --output-dataset

```

## MCP server setup

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