# Instagram Story Scraper 📸 (`api-empire/instagram-story-scraper`) Actor

📸 Instagram Story Scraper helps you efficiently collect Instagram Story data for insights, marketing & competitor research. 🔎 Save time, streamline workflows, and boost decision-making. 🚀✨ Perfect for analysts & creators.

- **URL**: https://apify.com/api-empire/instagram-story-scraper.md
- **Developed by:** [API Empire](https://apify.com/api-empire) (community)
- **Categories:** Social media, Lead generation, Automation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 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

## 📸 Instagram Story Scraper

Pull **live (24-hour) Instagram stories** for any public profile and get back the **full, structured story payload** — video & image versions, music, stickers, links, mentions, engagement flags, and optional **on-image caption text (OCR)**. Feed it bare usernames, `@handles`, or full profile URLs in bulk and watch results stream into your dataset in real time.

---

### ✨ Why Choose This Actor?

- 🧱 **Complete data** — nothing stripped. Every field Instagram returns for a story is preserved, in a clean canonical order.
- 👤 **Any input format** — `natgeo`, `@kyliejenner`, `instagram.com/taylorswift`, or `https://www.instagram.com/therock/`. Mix and match, in bulk.
- 🛡️ **Self-healing proxy ladder** — starts direct, auto-escalates to datacenter, then a **sticky residential** proxy only when needed. Clear logs at every step.
- 📝 **OCR captions** — optionally reads text burned into the story frame (titles, stickers, mentions) into `extractedCaption`.
- 💾 **Live saving** — each story is pushed the moment it's ready, so a partial run never loses data.
- 🗂️ **Six ready-made table views** — slice results by Media, Images, Music, Stickers, Engagement, or a quick Overview.

---

### 🔑 Key Features

| Feature | Description |
|--------|-------------|
| 📋 Bulk input | Scrape many profiles in one run |
| 🎬 Full media | `video_versions`, `video_dash_manifest`, codecs, qualities, dimensions |
| 🖼️ Image versions | Every cover-frame candidate resolution |
| 🎵 Music | `music_metadata` enriched from story music stickers |
| 🔗 Stickers & links | Link stickers, feed-media stickers, mentions, reshares |
| ⏱️ CDN expiry enrichment | Fills `url_expiration_timestamp_us` from CDN `oe=` when missing |
| 📝 OCR caption | Optional `extractedCaption` per story |

---

### 📥 Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `usernames` | array | ✅ | Usernames or profile URLs (bulk). |
| `sessionId` | string | ✅ | Your Instagram `sessionid` cookie (stories are login-gated). |
| `extractCaptionText` | boolean | ➖ | Enable OCR caption extraction. Default `false`. |
| `proxyConfiguration` | object | ➖ | Proxy settings. Default: direct with auto-fallback. |

#### Example

```json
{
  "usernames": ["therock", "@kyliejenner", "https://www.instagram.com/natgeo/"],
  "sessionId": "REDACTED_SESSIONID_COOKIE",
  "extractCaptionText": false,
  "proxyConfiguration": { "useApifyProxy": false }
}
````

> 🍪 **Where to get `sessionId`:** Log into Instagram in your browser → DevTools → **Application → Cookies → instagram.com → `sessionid`**. Treat it like a password.

***

### 📤 Output

Each dataset item is one story with the full Instagram payload. Abridged example:

```json
{
  "scraped_username": "therock",
  "id": "3920998746292350747_232192182",
  "pk": "3920998746292350747",
  "code": "DZqL5Xdge8b",
  "taken_at": 1781637893,
  "expiring_at": 1781724293,
  "media_type": 2,
  "product_type": "story",
  "video_duration": 60.04,
  "has_audio": true,
  "video_versions": [{ "width": 720, "height": 1280, "url": "https://…" }],
  "image_versions2": { "candidates": [{ "width": 1080, "height": 1920, "url": "https://…" }] },
  "music_metadata": { "music_asset_info": { "audio_asset_id": "18121840837670133" } },
  "story_link_stickers": [{ "story_link": { "url": "https://…" } }],
  "extractedCaption": ""
}
```

#### 🗂️ Dataset views

| View | Shows |
|------|-------|
| 🗂️ Overview | IDs, type, timestamps, duration, OCR caption |
| 🎬 Media & Video | Codecs, qualities, dimensions, video versions |
| 🖼️ Image Versions | All cover-frame candidates |
| 🎵 Music | Music metadata & music stickers |
| 🔗 Stickers, Links & Mentions | Link stickers, feed media, mentions, reshares |
| 💬 Engagement & Flags | Like/reply/reshare/save flags, paid partnership |

***

### 🚀 How to Use (Apify Console)

1. Log in at <https://console.apify.com> → **Actors**.
2. Open **Instagram Story Scraper**.
3. Paste usernames / URLs, add your `sessionId`, choose proxy & OCR options.
4. Click **Start**.
5. Watch the logs stream live story collection.
6. Open the **Output** tab and switch between the six section views.
7. Export to JSON / CSV / XLSX.

***

### 🤖 Use via API

```bash
curl -X POST "https://api.apify.com/v2/acts/<ACTOR_ID>/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "usernames": ["therock", "@kyliejenner"],
        "sessionId": "YOUR_SESSIONID",
        "extractCaptionText": false
      }'
```

***

### 🎯 Best Use Cases

- 📈 Monitor competitor / influencer story activity
- 🗞️ Archive brand & creator stories before they expire
- 🔗 Track link stickers, promos, and product drops
- 🎵 Analyze trending audio usage in stories

***

### 💸 Pricing

This actor uses **pay-per-event**: you're charged per story successfully delivered to your dataset (`story-result`). Profiles with no live stories cost nothing beyond the run start. The optional OCR step runs on Apify compute and is included in the run usage.

***

### ❓ FAQ

**Do I need a session cookie?** Yes — stories are only visible to logged-in viewers, so a valid `sessionid` is required.

**What if a profile has no active stories?** You'll see a friendly "no live stories" log line and no items for that profile — no charge.

**Will I get blocked?** The actor starts direct and only escalates to datacenter then sticky residential proxies when Instagram pushes back, with backoff retries. For heavy use, enable Apify Proxy.

**Why is `pk` sometimes huge?** It's Instagram's numeric primary key, returned as-is.

***

### ⚖️ Legal & Compliance

- Data is collected only from **publicly available** profiles you have the right to view.
- Do not scrape private accounts or content you aren't authorized to access.
- You are responsible for compliance with GDPR, CCPA, Instagram's ToS, and local laws.

***

### 🛟 Support & Feedback

Found a bug or want a new field exposed? Open an issue on the actor's **Issues** tab — real answers, fast.

# Actor input Schema

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

📋 One or more Instagram usernames or profile URLs to pull stories from. Any format works — bare handle (natgeo), @handle (@kyliejenner), or full URL (https://www.instagram.com/therock/). Supports bulk input.

## `sessionId` (type: `string`):

🍪 Your Instagram `sessionid` cookie value. Stories are private to logged-in viewers, so a valid session is required. Get it from your browser DevTools → Application → Cookies → instagram.com → `sessionid`. Keep it secret — treat it like a password.

## `extractCaptionText` (type: `boolean`):

🤖 When enabled, reads visible text burned into each story frame (titles, stickers, mentions) into the `extractedCaption` field using OCR. Adds a little extra processing per story.

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

🌐 Proxy settings. By default the actor runs direct (no proxy) and only falls back to a datacenter — then a sticky residential — proxy if Instagram pushes back. Leave off for the smart auto-ladder, or pin a specific group here.

## Actor input object example

```json
{
  "usernames": [
    "therock",
    "@kyliejenner"
  ],
  "extractCaptionText": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# 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 = {
    "usernames": [
        "zuck",
        "https://www.instagram.com/therock/",
        "instagram.com/taylorswift",
        "@kyliejenner",
        "http://instagram.com/natgeo"
    ],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("api-empire/instagram-story-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 = {
    "usernames": [
        "zuck",
        "https://www.instagram.com/therock/",
        "instagram.com/taylorswift",
        "@kyliejenner",
        "http://instagram.com/natgeo",
    ],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("api-empire/instagram-story-scraper").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 '{
  "usernames": [
    "zuck",
    "https://www.instagram.com/therock/",
    "instagram.com/taylorswift",
    "@kyliejenner",
    "http://instagram.com/natgeo"
  ],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call api-empire/instagram-story-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=api-empire/instagram-story-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram Story Scraper 📸",
        "description": "📸 Instagram Story Scraper helps you efficiently collect Instagram Story data for insights, marketing & competitor research. 🔎 Save time, streamline workflows, and boost decision-making. 🚀✨ Perfect for analysts & creators.",
        "version": "0.1",
        "x-build-id": "KvRYPifCu8BJvl3dN"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/api-empire~instagram-story-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-api-empire-instagram-story-scraper",
                "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/api-empire~instagram-story-scraper/runs": {
            "post": {
                "operationId": "runs-sync-api-empire-instagram-story-scraper",
                "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/api-empire~instagram-story-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-api-empire-instagram-story-scraper",
                "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",
                "required": [
                    "usernames",
                    "sessionId"
                ],
                "properties": {
                    "usernames": {
                        "title": "👤 Usernames or Profile URLs",
                        "minItems": 1,
                        "type": "array",
                        "description": "📋 One or more Instagram usernames or profile URLs to pull stories from. Any format works — bare handle (natgeo), @handle (@kyliejenner), or full URL (https://www.instagram.com/therock/). Supports bulk input.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "sessionId": {
                        "title": "🔑 Instagram Session ID",
                        "type": "string",
                        "description": "🍪 Your Instagram `sessionid` cookie value. Stories are private to logged-in viewers, so a valid session is required. Get it from your browser DevTools → Application → Cookies → instagram.com → `sessionid`. Keep it secret — treat it like a password."
                    },
                    "extractCaptionText": {
                        "title": "📝 Extract On-Image Caption Text (OCR)",
                        "type": "boolean",
                        "description": "🤖 When enabled, reads visible text burned into each story frame (titles, stickers, mentions) into the `extractedCaption` field using OCR. Adds a little extra processing per story.",
                        "default": false
                    },
                    "proxyConfiguration": {
                        "title": "🛡️ Proxy Configuration",
                        "type": "object",
                        "description": "🌐 Proxy settings. By default the actor runs direct (no proxy) and only falls back to a datacenter — then a sticky residential — proxy if Instagram pushes back. Leave off for the smart auto-ladder, or pin a specific group here.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
