# Insta Post Insight Fetcher (`barefoot_year/insta-post-insight-fetcher`) Actor

Scrape public Instagram post and reel metrics by username, usernames list, post URL, or reel URL. Get likes, comments, views, captions, timestamps, and media links in structured JSON.

- **URL**: https://apify.com/barefoot\_year/insta-post-insight-fetcher.md
- **Developed by:** [Ghost Rider](https://apify.com/barefoot_year) (community)
- **Categories:** Social media
- **Stats:** 4 total users, 3 monthly users, 78.1% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.10 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Insta-Post-Insight-Fetcher

Apify actor that scrapes publicly visible Instagram post and reel metrics by username, usernames list, or direct Instagram URLs.

### What it does

- Accepts an Instagram `username`, `@handle`, or full profile URL.
- Accepts bulk `usernames` input with up to `1000` usernames per run.
- Accepts direct Instagram `urls` for posts and reels.
- Scrapes recent public posts from a profile and/or direct media details from URLs.
- Returns public metrics such as likes, comments, views, caption, post URL, and timestamp.
- Uses `CheerioCrawler` with a request queue to process profile and pagination requests.
- Retries blocked requests with a fresh session, which is closer to how stable Apify marketplace actors behave.
- Uses cursor pagination to collect more than the default first page when Instagram allows it.

### Input

```json
{
  "username": "instagram",
  "usernames": [
    "instagram",
    "natgeo"
  ],
  "postCount": 12,
  "urls": [
    "https://www.instagram.com/p/ABC123XYZ/",
    "https://www.instagram.com/reel/XYZ123ABC/"
  ],
  "proxyConfig": {
    "useApifyProxy": true
  }
}
````

### Input fields

- `username` - optional Instagram username, `@handle`, or profile URL.
- `usernames` - optional list of up to `1000` usernames or profile URLs.
- `postCount` - optional number of recent posts to collect from the username profile, from `1` to `50`. Default is `12`.
- `urls` - optional list of direct Instagram post or reel URLs. The actor auto-detects the media type.
- `proxyConfig` - optional Apify proxy configuration for blocked or throttled requests.

### How it works

- The actor can start with one profile request, many profile requests, one or more direct media URL requests, or any combination of them.
- For usernames, it parses the first page of public posts from each profile response.
- If more profile posts are needed, it adds GraphQL pagination requests to the queue.
- For direct Instagram URLs, it extracts the shortcode and detects whether the URL is a post, reel, or TV media URL automatically.
- When Instagram blocks a request, the crawler retires that session and retries the request.
- After the queue is drained, the actor pushes the collected posts to the dataset.

### Output

Each dataset item contains one post or reel:

```json
{
  "sourceType": "profile_post",
  "inputUrl": null,
  "username": "instagram",
  "fullName": "Instagram",
  "userId": "25025320",
  "profileUrl": "https://www.instagram.com/instagram/",
  "postId": "1234567890",
  "shortcode": "ABC123XYZ",
  "postUrl": "https://www.instagram.com/p/ABC123XYZ/",
  "mediaType": "image",
  "isVideo": false,
  "caption": "Example caption",
  "hashtags": ["example"],
  "mentions": ["example_user"],
  "likeCount": 1000,
  "commentCount": 42,
  "firstComment": "",
  "latestComments": [],
  "viewCount": null,
  "playCount": null,
  "takenAt": "2026-05-25T10:00:00.000Z",
  "thumbnailUrl": "https://...",
  "dimensions": {
    "height": 1350,
    "width": 1080
  },
  "dimensionsHeight": 1350,
  "dimensionsWidth": 1080,
  "productType": "clips",
  "videoUrl": "https://...",
  "audioUrl": "https://...",
  "videoDuration": 58.266,
  "taggedUsers": [],
  "coauthorProducers": [],
  "isCommentsDisabled": false,
  "musicInfo": {
    "artist_name": "Example Artist",
    "song_name": "Example Song",
    "audio_id": "123456789"
  },
  "scrapedAt": "2026-05-25T11:00:00.000Z"
}
```

### Important notes

- This actor extracts **public web data only**.
- It does **not** return private creator insights such as reach, impressions, saves, or shares.
- Reel/video `viewCount` and `playCount` are best-effort public metrics and can differ from the live Instagram app UI.
- Instagram can throttle anonymous traffic. For better success, use `proxyConfig`.
- The actor is queue-based and session-aware, but Instagram can still change internal endpoints at any time.
- Direct URL scraping uses shortcode-based GraphQL lookup. If Instagram changes its `doc_id` or payload shape, that part may need maintenance.
- Pagination relies on Instagram's current web behavior, so long-range scraping may require maintenance if Instagram changes internal endpoints.
- The actor allows up to `1000` usernames per run, but large batches can still return partial results if Instagram blocks pagination.
- For large jobs, split profile scraping into smaller sequential batches such as `100` usernames per run for better reliability.

# Actor input Schema

## `username` (type: `string`):

Single Instagram username, @handle, or full profile URL. Optional if you provide usernames or URLs.

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

Optional list of up to 1000 Instagram usernames or profile URLs.

## `postCount` (type: `integer`):

How many recent posts or reels to collect from the username profile. Defaults to 12.

## `urls` (type: `array`):

Optional list of Instagram post or reel URLs to scrape. The actor detects the media type automatically.

## `proxyConfig` (type: `object`):

Optional Apify proxy configuration used when Instagram blocks direct requests.

## Actor input object example

```json
{
  "postCount": 12,
  "proxyConfig": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (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("barefoot_year/insta-post-insight-fetcher").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("barefoot_year/insta-post-insight-fetcher").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 '{}' |
apify call barefoot_year/insta-post-insight-fetcher --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=barefoot_year/insta-post-insight-fetcher",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Insta Post Insight Fetcher",
        "description": "Scrape public Instagram post and reel metrics by username, usernames list, post URL, or reel URL. Get likes, comments, views, captions, timestamps, and media links in structured JSON.",
        "version": "1.1",
        "x-build-id": "diGR1W4RmwpauMdUZ"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/barefoot_year~insta-post-insight-fetcher/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-barefoot_year-insta-post-insight-fetcher",
                "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/barefoot_year~insta-post-insight-fetcher/runs": {
            "post": {
                "operationId": "runs-sync-barefoot_year-insta-post-insight-fetcher",
                "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/barefoot_year~insta-post-insight-fetcher/run-sync": {
            "post": {
                "operationId": "run-sync-barefoot_year-insta-post-insight-fetcher",
                "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",
                "properties": {
                    "username": {
                        "title": "Instagram username",
                        "type": "string",
                        "description": "Single Instagram username, @handle, or full profile URL. Optional if you provide usernames or URLs."
                    },
                    "usernames": {
                        "title": "Instagram usernames",
                        "maxItems": 1000,
                        "type": "array",
                        "description": "Optional list of up to 1000 Instagram usernames or profile URLs.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "postCount": {
                        "title": "Posts to scrape",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "How many recent posts or reels to collect from the username profile. Defaults to 12.",
                        "default": 12
                    },
                    "urls": {
                        "title": "Instagram URLs",
                        "type": "array",
                        "description": "Optional list of Instagram post or reel URLs to scrape. The actor detects the media type automatically.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "proxyConfig": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optional Apify proxy configuration used when Instagram blocks direct requests.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
