# Instagram Stories Scraper - Live Stories, Own Cookie (`dami_studio/instagram-stories-scraper`) Actor

Capture public Instagram stories before they vanish: media URLs, type, timestamp, expiry and poster. Stories are login-gated by Instagram, so bring your own authorized session cookie; the actor never asks for a password. $0.40 per 1,000 stories plus a $0.001 start fee. No-cookie runs are free.

- **URL**: https://apify.com/dami\_studio/instagram-stories-scraper.md
- **Developed by:** [Dami's Studio](https://apify.com/dami_studio) (community)
- **Categories:** Social media, Automation
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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/platform/actors/running/actors-in-store#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

## Instagram Stories Scraper

Extract the **currently available** stories from public Instagram accounts. The actor uses the authenticated Instagram web endpoints with dedicated-account sessions, one sticky datacenter proxy session per account/IP attempt, and bounded account/IP rotation when Instagram classifies a block.

It returns story metadata and direct media URLs. It does not download media binaries, scrape private accounts, or attempt to access expired stories or viewer lists.

### Authentication and privacy

Instagram requires a logged-in session for current stories. For genuine data, provide one or more authorized dedicated-account `sessionid` values through the secret `sessionCookies` input, or configure the private actor environment variable `INSTAGRAM_SESSION_COOKIES`.

The environment fallback accepts a JSON array or newline-delimited values. Input cookies take precedence. Credentials, proxy URLs, and request headers are never logged, written to the dataset, stored in this repository, or included in diagnostic rows.

Use accounts you own and are authorized to automate. Session cookies are equivalent to an active login: keep them in Apify secrets or actor environment configuration, rotate/revoke them through your normal account process, and never paste them into source files, task names, or support messages.

### Input

| Field | Purpose |
| --- | --- |
| `profiles` | Up to five public usernames, `@handles`, or Instagram profile URLs. |
| `maxStoriesPerProfile` | 1-50 current story rows for each profile; default 25. |
| `sessionCookies` | Secret array of authorized dedicated-account `sessionid` cookies. |
| `proxyConfiguration` | Proxy configuration; the default is Apify datacenter (`BUYPROXIES94952`). Metered groups (`RESIDENTIAL`, `GOOGLE_SERP`) are not offered and are replaced with datacenter addresses. Your own `proxyUrls` are used verbatim. |
| `maxAttempts` | 1-12 bounded account/IP attempts; default 6. |
| `requestTimeoutSeconds` | 5-30 seconds for each Instagram request; default 15. |
| `maxRunSeconds` | 20-180 seconds hard run deadline; default 120. |

With empty input, or with profile input but no usable secure account session, the actor returns **exactly one** clearly labeled `_sample` row. The sample makes no Instagram request, no proxy connection, no credential use, and no billing event.

### Method and reliability

For each requested public account, the actor resolves the profile through Instagram's authenticated web profile endpoint and reads its current story tray through the authenticated `feed/reels_media` endpoint. One account is paired with one sticky datacenter IP. A `401`, `403`, `429`, server error, or network failure rotates to the next configured account and a fresh sticky proxy session, up to the configured bound. If Instagram challenges datacenter addresses for your account, supply your own residential endpoints in `proxyUrls` — they are honoured exactly as given.

Successful story rows are written to the dataset before the `story` billing event is charged. Samples, private-profile records, empty story trays, blocks, and all other diagnostics are never charged.

### Output

Each genuine row contains:

- `storyId`, `sourceUsername`, `sourceProfileId`, and `ownerUsername`
- `mediaType`, `imageUrl`, `videoUrl`, `durationSeconds`, and dimensions
- `takenAt`, `expiresAt`, caption, paid-partnership flag, and location when present
- A canonical `storyUrl`

Stories are ephemeral. `NO_CURRENT_STORIES` means the authorized request completed but the public account had no currently available stories at that time.

### Pricing

**$0.40 per 1,000 stories** ($0.0004 each), plus $0.001 each time a run starts. Flat rate — no volume tiers, no plan gates — and you are charged only for stories actually returned.

The `story` event fires once per genuine story row, and only after that row has been written to the dataset. Samples, private-profile records, empty story trays, blocks, and every other diagnostic are never charged — a run that returns no stories costs only the $0.001 start fee.

# Actor input Schema

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

Up to five public Instagram usernames, @handles, or profile URLs. Empty input or no configured account session returns exactly one labeled, uncharged sample row.

## `maxStoriesPerProfile` (type: `integer`):

Maximum currently available story rows returned for each profile. Stories are limited by Instagram's current-story window.

## `sessionCookies` (type: `array`):

Secret array of authorized dedicated-account sessionid cookies. Input values override the secure INSTAGRAM\_SESSION\_COOKIES environment fallback. Values are never logged.

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

Egress for the authenticated Instagram requests. Each account is paired with a sticky datacenter IP until a classified block rotates it. Metered Apify groups (RESIDENTIAL, GOOGLE\_SERP) are not offered and are replaced with rotating datacenter addresses; supply your own proxyUrls if you need residential exits and they are used verbatim.

## `maxAttempts` (type: `integer`):

Bounded retries across rotating configured accounts and sticky proxy sessions.

## `requestTimeoutSeconds` (type: `integer`):

Timeout for each authenticated Instagram request.

## `maxRunSeconds` (type: `integer`):

Hard wall-clock bound for profile resolution and story retrieval.

## Actor input object example

```json
{
  "profiles": [
    "nasa",
    "natgeo"
  ],
  "maxStoriesPerProfile": 25,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "BUYPROXIES94952"
    ]
  },
  "maxAttempts": 6,
  "requestTimeoutSeconds": 15,
  "maxRunSeconds": 120
}
```

# Actor output Schema

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

One row per current authenticated story. Samples and diagnostics are never charged.

# 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("dami_studio/instagram-stories-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("dami_studio/instagram-stories-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 '{}' |
apify call dami_studio/instagram-stories-scraper --silent --output-dataset

```

## MCP server setup

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