# Xpoz - Instagram Scraper (`xpoz/xpoz-instagram-scraper`) Actor

Access Instagram data — users, posts, comments, followers, following, keyword search, and more.

- **URL**: https://apify.com/xpoz/xpoz-instagram-scraper.md
- **Developed by:** [Xpoz](https://apify.com/xpoz) (community)
- **Categories:** Social media, Agents, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 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

## Xpoz - Instagram Scraper

Access Instagram data through the Xpoz API on Apify. Retrieve user profiles, posts, comments, followers, following lists, and search by keywords — all without managing proxies, rate limits, or browser automation.

### Getting Started

1. **Try it now** — run the Actor without an API key to get a preview with limited results (max 5) and narrower data coverage
2. **Get an API key** at [xpoz.ai/get-token](https://xpoz.ai/get-token) for full access with unlimited results and optimal data coverage
3. Select an **Action** from the dropdown
4. Provide the required identifier(s) for your chosen action
5. Run the actor

### Actions

| Action                         | Description                                                | Required Fields                           |
| ------------------------------ | ---------------------------------------------------------- | ----------------------------------------- |
| **Get User**                   | Retrieve a single Instagram user profile by username or ID | `identifier`, `identifierType`            |
| **Search Users**               | Search for Instagram users by name or keyword              | `identifier`                              |
| **Get User Connections**       | Retrieve a user's followers or following list              | `identifier`, `connectionType`            |
| **Get Post Interacting Users** | Get users who liked or commented on a post                 | `identifier` (post ID), `interactionType` |
| **Get Users by Keywords**      | Find Instagram users matching keyword criteria             | `identifier` (keyword)                    |
| **Get Posts by IDs**           | Retrieve specific posts by their IDs                       | `identifiers` (list of post IDs)          |
| **Get Posts by User**          | Get all posts from a specific user                         | `identifier`, `identifierType`            |
| **Search Posts**               | Search Instagram posts by keyword                          | `identifier` (keyword)                    |
| **Get Comments**               | Retrieve comments on a specific post                       | `identifier` (post ID)                    |

### Input Parameters

| Parameter         | Type     | Description                                                |
| ----------------- | -------- | ---------------------------------------------------------- |
| `apiKey`          | String   | **(Required)** Your Xpoz API key                           |
| `action`          | Enum     | **(Required)** The Instagram action to perform             |
| `identifier`      | String   | Username, user ID, post ID, or keyword (depends on action) |
| `identifiers`     | String[] | List of identifiers (for batch actions like getPostsByIds) |
| `identifierType`  | Enum     | `username` (default) or `id`                               |
| `connectionType`  | Enum     | `followers` or `following` (for getUserConnections)        |
| `interactionType` | Enum     | `likes` or `comments` (for getPostInteractingUsers)        |
| `startDate`       | String   | Filter results from this date (YYYY-MM-DD)                 |
| `endDate`         | String   | Filter results up to this date (YYYY-MM-DD)                |
| `limit`           | Integer  | Maximum results per page (min: 1)                          |
| `fields`          | String[] | Specific fields to include in the response                 |
| `forceLatest`     | Boolean  | Force fresh data instead of cached (default: false)        |
| `fetchAllPages`   | Boolean  | Automatically fetch all pages (default: false)             |

### Example Use Cases

- **Analyze influencer posts** — Use `getPostsByUser` to pull all posts from an influencer and analyze engagement patterns.
- **Export followers** — Use `getUserConnections` with `connectionType: followers` and `fetchAllPages: true` to export a complete follower list.
- **Monitor brand mentions** — Use `searchPosts` with brand-related keywords and date filters to track mentions over time.
- **Track comments** — Use `getComments` on specific posts to monitor audience sentiment and engagement.

### Output

Results are pushed to the default Apify dataset. Each item in the dataset represents one record (user, post, or comment depending on the action).

For paginated actions, pagination metadata is stored in the key-value store under the `PAGINATION_INFO` key, containing:

- `totalRows` — total number of results available
- `totalPages` — total number of pages
- `pageNumber` — current page number
- `pageSize` — results per page
- `resultsInFirstPage` — number of results in the first page

### Pricing

**This Actor is free.** You only pay for Apify platform usage (compute time) and your Xpoz API plan. The Actor is usable without an API key, but results will be very limited (max 5 items per request) with narrower data coverage. Get your API key at [xpoz.ai/get-token](https://xpoz.ai/get-token) for unlimited results and optimal data coverage.

### Support

- Documentation: [https://xpoz.ai/docs](https://xpoz.ai/docs)
- Issues: [https://github.com/xpoz-ai](https://github.com/xpoz-ai)
- Email: support@xpoz.ai

# Actor input Schema

## `apiKey` (type: `string`):

Your Xpoz API key. Get one at https://xpoz.ai/get-token. If not provided, the Actor runs with limited public access (max 5 results).
## `action` (type: `string`):

The Instagram action to perform.
## `identifier` (type: `string`):

Username, user ID, post ID, or keyword depending on the action.
## `identifiers` (type: `array`):

List of identifiers (e.g., multiple post IDs for getPostsByIds).
## `identifierType` (type: `string`):

Whether the identifier is a username or numeric ID.
## `connectionType` (type: `string`):

Type of connection to retrieve (for getUserConnections).
## `interactionType` (type: `string`):

Type of interaction to retrieve (for getPostInteractingUsers).
## `startDate` (type: `string`):

Filter results from this date (YYYY-MM-DD format).
## `endDate` (type: `string`):

Filter results up to this date (YYYY-MM-DD format).
## `limit` (type: `integer`):

Maximum number of results to return per page.
## `fields` (type: `array`):

Specific fields to include in the response. Leave empty for all fields.
## `forceLatest` (type: `boolean`):

Force fetching the latest data instead of cached results.
## `fetchAllPages` (type: `boolean`):

Automatically fetch all pages of results. When disabled, only the first page is returned.

## Actor input object example

```json
{
  "action": "getUser",
  "identifier": "instagram",
  "identifierType": "username",
  "forceLatest": false,
  "fetchAllPages": 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 = {
    "action": "getUser",
    "identifier": "instagram"
};

// Run the Actor and wait for it to finish
const run = await client.actor("xpoz/xpoz-instagram-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 = {
    "action": "getUser",
    "identifier": "instagram",
}

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

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Xpoz - Instagram Scraper",
        "description": "Access Instagram data — users, posts, comments, followers, following, keyword search, and more.",
        "version": "1.0",
        "x-build-id": "CECvTFAqTkYuRIBKb"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/xpoz~xpoz-instagram-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-xpoz-xpoz-instagram-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/xpoz~xpoz-instagram-scraper/runs": {
            "post": {
                "operationId": "runs-sync-xpoz-xpoz-instagram-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/xpoz~xpoz-instagram-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-xpoz-xpoz-instagram-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": [
                    "action"
                ],
                "properties": {
                    "apiKey": {
                        "title": "API Key",
                        "type": "string",
                        "description": "Your Xpoz API key. Get one at https://xpoz.ai/get-token. If not provided, the Actor runs with limited public access (max 5 results)."
                    },
                    "action": {
                        "title": "Action",
                        "enum": [
                            "getUser",
                            "searchUsers",
                            "getUserConnections",
                            "getPostInteractingUsers",
                            "getUsersByKeywords",
                            "getPostsByIds",
                            "getPostsByUser",
                            "searchPosts",
                            "getComments"
                        ],
                        "type": "string",
                        "description": "The Instagram action to perform."
                    },
                    "identifier": {
                        "title": "Identifier",
                        "type": "string",
                        "description": "Username, user ID, post ID, or keyword depending on the action."
                    },
                    "identifiers": {
                        "title": "Identifiers",
                        "type": "array",
                        "description": "List of identifiers (e.g., multiple post IDs for getPostsByIds).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "identifierType": {
                        "title": "Identifier Type",
                        "enum": [
                            "username",
                            "id"
                        ],
                        "type": "string",
                        "description": "Whether the identifier is a username or numeric ID.",
                        "default": "username"
                    },
                    "connectionType": {
                        "title": "Connection Type",
                        "enum": [
                            "followers",
                            "following"
                        ],
                        "type": "string",
                        "description": "Type of connection to retrieve (for getUserConnections)."
                    },
                    "interactionType": {
                        "title": "Interaction Type",
                        "enum": [
                            "likes",
                            "comments"
                        ],
                        "type": "string",
                        "description": "Type of interaction to retrieve (for getPostInteractingUsers)."
                    },
                    "startDate": {
                        "title": "Start Date",
                        "type": "string",
                        "description": "Filter results from this date (YYYY-MM-DD format)."
                    },
                    "endDate": {
                        "title": "End Date",
                        "type": "string",
                        "description": "Filter results up to this date (YYYY-MM-DD format)."
                    },
                    "limit": {
                        "title": "Limit",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of results to return per page."
                    },
                    "fields": {
                        "title": "Fields",
                        "type": "array",
                        "description": "Specific fields to include in the response. Leave empty for all fields.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "forceLatest": {
                        "title": "Force Latest",
                        "type": "boolean",
                        "description": "Force fetching the latest data instead of cached results.",
                        "default": false
                    },
                    "fetchAllPages": {
                        "title": "Fetch All Pages",
                        "type": "boolean",
                        "description": "Automatically fetch all pages of results. When disabled, only the first page is returned.",
                        "default": 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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
