# Instagram Post Details (`spider_studio/instagram-post-detail-graphql`) Actor

Resolve public Instagram post details and downloadable media assets through the legacy GraphQL implementation.

- **URL**: https://apify.com/spider\_studio/instagram-post-detail-graphql.md
- **Developed by:** [NewLai](https://apify.com/spider_studio) (community)
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 instagram post details

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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

### What does Instagram Post Details GraphQL API do?

Instagram Post Details GraphQL API converts public Instagram post shortcodes into normalized post and media metadata from public post pages, with a persisted GraphQL query as a fallback. Each Dataset row describes one public post on [Instagram](https://www.instagram.com/) and includes its creator, caption, visible engagement, media flags, and an array of image or video asset URLs. Apify adds API access, schedules, integrations, proxy rotation, retries, storage, and monitoring around this focused **Instagram post details API alternative**.

This Actor exists separately from the newer page parser because the original project exposed both interfaces. It returns metadata only; use Instagram Media Downloader API for binary files.

### Why use the GraphQL post resolver?

- Normalize embedded post data and GraphQL responses into a stable Dataset schema.
- Resolve known shortcodes in bulk without crawling user feeds first.
- Retrieve a consistent asset list for downstream download or analysis.
- Compare results with the newer page parser during Instagram API transitions.

### How to get Instagram post details

1. Copy the shortcode from an Instagram `/p/` or `/reel/` URL.
2. Add one or more values to `postCodes` in the **Input** tab.
3. Keep raw output off for normal runs and use the configured proxy with moderate concurrency.
4. Click **Start**.
5. Open the Dataset or use the API endpoint shown in the run.

### Input

See the **Input** tab for all configuration options. Duplicate post codes are ignored while order is preserved. `includeRaw` attaches the original media object, and `maxConcurrency` limits simultaneous post lookups.

```json
{"postCodes":["C4MEygtSuiu","ABC123"],"includeRaw":false,"maxConcurrency":3}
```

#### Proxy environment variables

Operators can override the input proxy settings through the Actor's environment. The first nonblank setting wins:

1. `INSTAGRAM_PROXY_CONFIGURATION`: a JSON object in the same format as the input's `proxyConfiguration`.
2. `INSTAGRAM_PROXY_URL`: a single HTTP or HTTPS proxy URL, with optional username and password.
3. The input's `proxyConfiguration`, or the default GB residential proxy when omitted.

For one custom proxy:

```bash
export INSTAGRAM_PROXY_URL='http://username:password@proxy.example.com:8000'
```

For multiple custom proxies:

```bash
export INSTAGRAM_PROXY_CONFIGURATION='{"useApifyProxy":false,"proxyUrls":["http://username:password@proxy1.example.com:8000","http://username:password@proxy2.example.com:8000"]}'
```

The JSON setting can also select Apify Proxy, for example `{"useApifyProxy":true,"apifyProxyGroups":["RESIDENTIAL"],"apifyProxyCountry":"US"}`, or disable the Actor's proxy with `{"useApifyProxy":false}`.

Environment settings replace the input proxy configuration entirely. Blank values are ignored. Malformed JSON and invalid custom proxy URLs stop the run instead of falling back to the input. Custom proxies do not trigger the GB-to-DE country fallback; that fallback still applies when the effective configuration selects GB residential Apify Proxy.

For cloud deployment, add the chosen variable to `environmentVariables` in `.actor/actor.json`. A Secret reference such as `"INSTAGRAM_PROXY_URL": "@instagramProxyUrl"` keeps the proxy credentials out of source. For local development, set the variable in the environment or the Actor's `.env` file before running `apify run`.

### Output

You can download the Dataset in various formats such as JSON, HTML, CSV, or Excel.

```json
{"success":true,"postCode":"ABC123","postUrl":"https://www.instagram.com/p/ABC123/","username":"creator","caption":"Example","isVideo":true,"hasAudio":true,"assets":[{"position":1,"type":"video","url":"https://scontent.cdninstagram.com/video.mp4","width":1080,"height":1920}],"error":null}
```

### What Instagram post data is extracted?

| Field | Type | Description |
| --- | --- | --- |
| `postCode`, `postUrl`, `mediaId` | string | Public post identifiers. |
| `username`, `caption` | string | Creator and public caption. |
| `likeCount`, `commentCount` | integer | Visible engagement counts. |
| `isVideo`, `hasAudio` | boolean | Media properties. |
| `assets` | array | Best image/video URLs and dimensions. |
| `success`, `error` | boolean, string | Per-post diagnostics. |

### How much does Instagram post resolution cost?

The Actor uses pay-per-event pricing and charges only for successful post-detail rows. Error rows are free.

| Apify plan | Price per successful post |
| --- | ---: |
| Free | $0.0025 |
| Bronze | $0.0020 |
| Silver | $0.0020 |
| Gold | $0.0020 |
| Platinum | $0.0020 |
| Diamond | $0.0020 |

Each attempt first requests the public post page. If that page cannot provide the requested media, the Actor falls back to an anonymous session-bootstrap request and a GraphQL request; retries are bounded. Each run also has the standard $0.00005 Actor-start event at the default memory. Test a few codes first and keep concurrency moderate to reduce rate limits.

### Tips, limitations, and migration

Instagram can rotate persisted GraphQL document IDs. The Actor first parses the requested post from embedded page JSON, including newer shortcode and media-info shapes. When page extraction fails, it uses `PolarisPostRootQuery`, establishes an anonymous CSRF session, and keeps the bootstrap and GraphQL POST on the same proxy session with one consistent Chrome browser fingerprint. It supplies a CSRF cookie if the bootstrap response omits one. Complete JSON documents are accepted without waiting for the proxy to close the response; invalid, oversized, login-required, and rate-limited responses remain errors. HTML challenge pages, login-required JSON, and rate-limit responses are classified separately before the Actor rotates to a new proxy session. With the default proxy setting, the first attempt uses a GB residential exit; after a failure the run switches to DE and keeps DE active. Failures are limited to two retries (three total attempts). A user-selected non-GB country or custom proxy URL is respected and does not trigger the automatic fallback. Start with the default concurrency of 3; if every proxy session returns structurally valid JSON without media, check for another document-ID migration. Asset URLs can expire, so download authorized files promptly.

### Legal use, privacy, and support

Only public post data is processed. Respect Instagram's terms, copyright, privacy law, and rate limits. Do not collect personal data without a legitimate basis. Use the **Issues** tab for support and the **API** tab for generated code examples.

# Actor input Schema

## `postCodes` (type: `array`):

Shortcodes from /p/{code}/ or /reel/{code}/ URLs.

## `includeRaw` (type: `boolean`):

Attach the original GraphQL media object.

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

Maximum simultaneous Instagram requests.

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

Uses GB residential proxies by default and switches to DE after a failed attempt.

## Actor input object example

```json
{
  "postCodes": [
    "C4MEygtSuiu"
  ],
  "includeRaw": false,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "GB"
  }
}
```

# Actor output Schema

## `dataset` (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 = {
    "postCodes": [
        "C4MEygtSuiu"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("spider_studio/instagram-post-detail-graphql").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 = { "postCodes": ["C4MEygtSuiu"] }

# Run the Actor and wait for it to finish
run = client.actor("spider_studio/instagram-post-detail-graphql").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 '{
  "postCodes": [
    "C4MEygtSuiu"
  ]
}' |
apify call spider_studio/instagram-post-detail-graphql --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,spider_studio/instagram-post-detail-graphql"
        }
    }
}
```

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/rWaLpwPenwaT8IdNo/builds/CxUnRncIupnsiiCK8/openapi.json
