# Instagram User Posts Cheapest 0 20 1000 Results (`thescrappa/instagram-user-posts-cheapest-0-20-1000-results`) Actor

- **URL**: https://apify.com/thescrappa/instagram-user-posts-cheapest-0-20-1000-results.md
- **Developed by:** [Scrappa](https://apify.com/thescrappa) (community)
- **Categories:** Social media, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## 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 User Posts Scraper

Extract recent public Instagram posts and reels by username. This Actor is built for creator research, content analysis, competitor monitoring, brand tracking, and social media reporting workflows that need profile post collections rather than single post details.

No Instagram login, cookies, proxy setup, or browser session is required. Provide a username and the Actor returns available public posts to an Apify dataset. The Actor uses a Scrappa API key configured as the `SCRAPPA_API_KEY` environment variable; set this secret if you fork or self-deploy the Actor.

### What It Does

- Fetches recent public posts and reels from an Instagram user profile.
- Returns post fields such as shortcode, media type, caption, timestamp, likes, comments, plays, media URLs, location, author, and permalink when available.
- Supports pagination with `max_id`, using the previous response's `next_max_id` value.
- Saves the full upstream response as `OUTPUT` in the default key-value store for access to pagination metadata, including `more_available` and `next_max_id`, plus raw fields.

Private accounts can still return public metadata that is visible without logging in, but this Actor does not bypass privacy restrictions or access private posts.

### Input

Use one Instagram username per run.

#### Input Fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `username` | String | Yes | Instagram username to fetch posts for. Use a handle such as `natgeo`; an optional leading `@` is normalized automatically. |
| `max_id` | String | No | Pagination cursor from a previous response's `next_max_id` field. |

### Example Input

```json
{
  "username": "natgeo"
}
````

Next page:

```json
{
  "username": "natgeo",
  "max_id": "QVFDcF..."
}
```

### Output

Each run saves one dataset item per returned post. If Scrappa returns zero posts, the dataset remains empty and the full response is still available in the default key-value store as `OUTPUT`. The exact fields can vary depending on what Instagram returns, but common fields include:

| Field | Description |
| --- | --- |
| `request_username` | Username requested in the Actor input. |
| `id` | Instagram post ID. |
| `shortcode` | Instagram shortcode. |
| `media_type` | Post media type, such as image, video, carousel, or reel when returned. |
| `caption` | Caption text. |
| `taken_at` | Post timestamp. |
| `like_count` | Number of likes. |
| `comment_count` | Number of comments. |
| `play_count` | Number of video plays, when available. |
| `media` | Media objects such as thumbnails, images, or videos. |
| `location` | Location metadata, when available. |
| `author` | Author metadata. |
| `permalink` | Instagram post permalink. |

### Example Output

```json
{
  "request_username": "natgeo",
  "id": "3819535222330010870",
  "shortcode": "DUBtwxGEqz2",
  "media_type": "video",
  "caption": "Post caption text...",
  "taken_at": "2024-01-15T10:30:00+00:00",
  "like_count": 125000,
  "comment_count": 3500,
  "play_count": 5000000,
  "media": [
    {
      "type": "video",
      "thumbnail_url": "https://...",
      "video_url": "https://..."
    }
  ],
  "author": {
    "username": "natgeo"
  },
  "permalink": "https://www.instagram.com/natgeo/p/DUBtwxGEqz2/"
}
```

### Exporting Results

Results are stored in the Actor's default dataset. From Apify, you can export the dataset as JSON, CSV, Excel, XML, RSS, or HTML table. Use JSON for nested media fields, and CSV or Excel for spreadsheet-friendly post analysis.

### Authentication

This Actor does not require an Instagram account. It does not ask for Instagram credentials, session cookies, or two-factor authentication codes.

### Common Use Cases

- Collect recent posts from public creators, brands, publishers, or competitors.
- Build influencer content and engagement reports.
- Monitor reels and post performance over time.
- Export post collections for BI, CRM, or spreadsheet workflows.
- Feed downstream post-detail enrichment workflows with shortcodes or permalinks.

### Recommended Workflow

1. Run this Actor with a public Instagram username.
2. Export the dataset for the returned page of posts.
3. Open the `OUTPUT` key-value store record. If `more_available` is true, run again with `max_id` set to the returned `next_max_id`.
4. Use the exported post URLs or shortcodes with the Instagram Post Info Actor when you need deeper single-post details.

### Pricing

$0.20 per 1,000 results. No Instagram login required. Requires `SCRAPPA_API_KEY` in the Actor environment.

### Notes And Limits

- Run one username per Actor run.
- Usernames are normalized before lookup, so a leading `@` is removed automatically.
- Availability of fields depends on the public data returned by Instagram and Scrappa.
- This Actor does not access private posts or bypass account privacy settings.

# Actor input Schema

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

Instagram username without the @ symbol.

## `max_id` (type: `string`):

Optional pagination cursor from a previous response's next\_max\_id field.

## Actor input object example

```json
{
  "username": "natgeo"
}
```

# 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 = {
    "username": "natgeo",
    "max_id": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("thescrappa/instagram-user-posts-cheapest-0-20-1000-results").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 = {
    "username": "natgeo",
    "max_id": "",
}

# Run the Actor and wait for it to finish
run = client.actor("thescrappa/instagram-user-posts-cheapest-0-20-1000-results").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 '{
  "username": "natgeo",
  "max_id": ""
}' |
apify call thescrappa/instagram-user-posts-cheapest-0-20-1000-results --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=thescrappa/instagram-user-posts-cheapest-0-20-1000-results",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Instagram User Posts Cheapest 0 20 1000 Results",
        "version": "0.0",
        "x-build-id": "rsYWGEt2cbUOvFwKT"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/thescrappa~instagram-user-posts-cheapest-0-20-1000-results/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-thescrappa-instagram-user-posts-cheapest-0-20-1000-results",
                "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/thescrappa~instagram-user-posts-cheapest-0-20-1000-results/runs": {
            "post": {
                "operationId": "runs-sync-thescrappa-instagram-user-posts-cheapest-0-20-1000-results",
                "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/thescrappa~instagram-user-posts-cheapest-0-20-1000-results/run-sync": {
            "post": {
                "operationId": "run-sync-thescrappa-instagram-user-posts-cheapest-0-20-1000-results",
                "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": [
                    "username"
                ],
                "properties": {
                    "username": {
                        "title": "Instagram username",
                        "pattern": "^@?[a-zA-Z0-9._-]{1,30}$",
                        "type": "string",
                        "description": "Instagram username without the @ symbol."
                    },
                    "max_id": {
                        "title": "Pagination cursor",
                        "type": "string",
                        "description": "Optional pagination cursor from a previous response's next_max_id field."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
