# Instagram Profile Posts Scraper — Posts & Reels (`thenetaji/instagram-profile-posts-scraper`) Actor

Export the posts or reels of public Instagram profiles. Each row carries the post code, like and comment counts, publish date, media type and the profile it came from.

- **URL**: https://apify.com/thenetaji/instagram-profile-posts-scraper.md
- **Developed by:** [The Netaji](https://apify.com/thenetaji) (community)
- **Categories:** Social media, For creators, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.25 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Instagram Profile Posts Scraper

The Actor exports the feed posts or the reels of one or more public Instagram accounts as one row per item. Each row identifies the post by its shortcode and carries its like and comment counts, publish time and media type, together with the account it was collected from.

### Accepted input

- `profiles`: Instagram usernames, one per line, without the `@`. Only public accounts return content.
- `scraperType`: `profilePosts` for feed posts or `profileReels` for reels. The default is `profilePosts`.
- `limit`: the number of items saved for each account, applied to every account separately. The default is `100`; a value of `0` collects everything the account has published.

```json
{
  "profiles": ["nasa", "natgeo"],
  "scraperType": "profileReels",
  "limit": 50
}
```

### Response fields

- `code`: the shortcode used in the post URL, as in `instagram.com/p/<code>`.
- `pk`: the numeric media ID.
- `like_count` and `comment_count`: the counts at the moment of collection.
- `taken_at`: the publish time as a Unix timestamp in seconds.
- `media_type`: `1` for a photo, `2` for a video and `8` for a carousel.
- `source_username`: the account the row was collected from, which keeps rows from several accounts separable in one dataset.

```json
{
  "pk": "4034722052525930893",
  "code": "Df-NlR0PjmN",
  "like_count": 661405,
  "comment_count": 1988,
  "taken_at": 1795198274,
  "media_type": 1,
  "source_username": "nasa"
}
```

### Behaviour on partial results

Pages are read in order until the `limit` is reached or Instagram reports that the account has no further items. An account that returns no items, such as a private account or a username that does not exist, contributes no rows; the run continues with the next account and finishes successfully. A run that stops part way through resumes after the last saved row rather than starting the account again.

### Frequently asked questions

**Does the Actor return the caption, the image or the video file?**
No. Each row describes the post through its shortcode, counts, time and type. The shortcode can be passed to the [Instagram Post Details Scraper](https://apify.com/thenetaji/instagram-post-details-scraper) to look a post up again later, or to the [Instagram Comments Scraper](https://apify.com/thenetaji/instagram-media-comments-scraper) to collect its comments.

**Why does `limit` return more rows than its value?**
The bound applies to each account. Three accounts with a `limit` of `50` can produce up to 150 rows.

**How are tagged posts collected?**
Posts in which an account is tagged are a separate list, exported by the [Instagram Tagged Post Scraper](https://apify.com/thenetaji/instagram-user-tagged-posts-scraper).

# Actor input Schema

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

Usernames of public accounts, one per line, without the @.

## `scraperType` (type: `string`):

Feed posts or reels.

## `limit` (type: `integer`):

How many items to return for each profile. 0 returns everything the profile has.

## Actor input object example

```json
{
  "profiles": [
    "cristiano"
  ],
  "scraperType": "profilePosts",
  "limit": 100
}
```

# Actor output Schema

## `dataset` (type: `string`):

All records scraped by this run

# 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": [
        "cristiano"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("thenetaji/instagram-profile-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": ["cristiano"] }

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

```

## MCP server setup

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