# Instagram Followers and Following Scraper (`automation-lab/instagram-followers-following-scraper`) Actor

Export paginated Instagram follower and following profile rows for creator audience research, spreadsheets, and recurring data workflows.

- **URL**: https://apify.com/automation-lab/instagram-followers-following-scraper.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 80.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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Followers and Following Scraper

Export paginated **Instagram followers and following** profile rows from public accounts.
Use the results for creator audience research, spreadsheet analysis, CRM enrichment, and scheduled comparison workflows.

The Actor accepts usernames or profile URLs, resolves each public account, and returns normalized audience profiles in the default Apify dataset.
Users do not need to provide Instagram cookies or log in.

### What this Instagram audience scraper does

- Exports followers of public Instagram profiles.
- Exports profiles followed by public Instagram accounts.
- Supports followers, following, or both lists in one run.
- Accepts usernames, `@usernames`, and full profile URLs.
- Follows Instagram pagination cursors automatically.
- Deduplicates profiles within each requested list.
- Stops at a clear per-profile, per-list limit.
- Returns integration-ready JSON, CSV, Excel, XML, or RSS through Apify.

### Who is it for

**Creator research teams** compare the visible audiences around creators and publishers.

**Social media analysts** export account lists for segmentation and further analysis.

**Agencies** collect consistent follower or following fields across client research projects.

**Data engineers** schedule audience exports and send dataset rows to a warehouse or automation pipeline.

**Growth teams** inspect public account relationships before outreach or partnership research.

### Why use this Actor

Instagram's normal profile page does not provide a convenient downloadable audience table.
This Actor turns paginated relationship lists into typed dataset records.

The backend manages the source session itself, so each user does not need to find or paste a private browser cookie.
Inputs remain focused on the research job: targets, relationship direction, and result limits.

Each row identifies both the requested target and the returned audience profile.
That makes multi-target exports easier to filter after a run.

### Getting started

1. Open the Actor in Apify Console.
2. Add one or more Instagram usernames or profile URLs.
3. Choose **Followers**, **Following**, or **Followers and following**.
4. Set the maximum profiles saved for each selected list.
5. Click **Start**.
6. Open the **Dataset** tab when the run finishes.
7. Download JSON, CSV, Excel, XML, or another supported format.

A small first run is best when testing a new workflow.
Increase `maxItemsPerList` after checking that the selected public account exposes the expected list.

### Input parameters

| Field | Type | Default | Description |
|---|---|---:|---|
| `usernames` | string array | `['natgeo']` | Instagram usernames, with or without `@`. |
| `profileUrls` | string array | `[]` | Full public Instagram profile URLs. |
| `relationshipType` | string | `both` | `followers`, `following`, or `both`. |
| `maxItemsPerList` | integer | `100` | Maximum rows per target and selected list, from 1 to 10,000. |

You can combine `usernames` and `profileUrls`.
Duplicate targets are processed once.
A run accepts up to 20 unique public profiles.

#### Example: export followers

```json
{
  "usernames": ["natgeo"],
  "relationshipType": "followers",
  "maxItemsPerList": 100
}
```

#### Example: export following by URL

```json
{
  "profileUrls": ["https://www.instagram.com/nasa/"],
  "relationshipType": "following",
  "maxItemsPerList": 250
}
```

#### Example: compare both relationship lists

```json
{
  "usernames": ["natgeo", "nasa"],
  "relationshipType": "both",
  "maxItemsPerList": 500
}
```

With two targets and `both`, the maximum possible output is 2 × 2 × 500 = 2,000 rows.
The actual count can be lower when Instagram ends a list or limits what the managed session can view.

### Output fields

| Field | Meaning |
|---|---|
| `targetUsername` | Requested Instagram account. |
| `targetUserId` | Numeric Instagram ID of the requested account. |
| `relationship` | `follower` or `following`. |
| `userId` | Numeric Instagram ID of the returned profile. |
| `username` | Username of the returned profile. |
| `fullName` | Published display name. |
| `isPrivate` | Whether the returned profile is private. |
| `isVerified` | Whether Instagram marks the profile as verified. |
| `profilePicUrl` | Profile image URL when returned by Instagram. |
| `followsViewer` | Viewer-relative flag when available; otherwise `null`. |
| `followedByViewer` | Viewer-relative flag when available; otherwise `null`. |
| `sourceUrl` | Canonical profile link for the returned account. |
| `scrapedAt` | ISO timestamp for collection. |

#### Example dataset item

```json
{
  "targetUsername": "samplepublisher",
  "targetUserId": "12345678901",
  "relationship": "follower",
  "userId": "10987654321",
  "username": "exampleuser",
  "fullName": "Example User",
  "isPrivate": false,
  "isVerified": false,
  "profilePicUrl": null,
  "followsViewer": null,
  "followedByViewer": null,
  "sourceUrl": "https://www.instagram.com/exampleuser/",
  "scrapedAt": "2025-01-15T12:00:00.000Z"
}
```

The example is anonymized.
Real runs return current public source values.

### Pagination and result limits

`maxItemsPerList` applies independently to every target and relationship list.
For example, `both` with a limit of 100 can save up to 100 followers and 100 following profiles for one target.

The Actor requests additional pages while Instagram supplies a cursor.
It stops when the limit is reached, the list ends, or no new profiles are returned.
Stable Instagram user IDs are used for deduplication within a list.

Instagram can return a page larger than the remaining requested amount.
Only the requested number of normalized rows is saved and charged.

### How much does it cost to export Instagram audience profiles?

The Actor uses pay-per-event pricing.
Each run has one `start` event, and each successfully saved follower or following row has one `profile` event.
Rejected, duplicate, or unsaved source entries are not charged as profile results.

Current prices are shown in Apify Console before you start a run.
At the BRONZE tier, the run start costs **$0.001** and each saved profile costs **$0.00104**.
That is about **$0.00204 for 1 profile**, **$0.0114 for 10 profiles**, or **$0.105 for 100 profiles**.
Other subscription tiers use the displayed tier price.
Your exact total depends mainly on the number of rows saved; a list that ends early produces and charges fewer rows.

Use a small limit to estimate a recurring job before increasing it.
The run log and Apify usage details show the charged event counts.

### Recurring creator audience research

Apify schedules can run the same input daily, weekly, or monthly.
Save each dataset to your warehouse or spreadsheet, then compare stable `userId` values between runs.

A typical change workflow is:

1. Schedule a bounded followers export.
2. Store the dataset with its run timestamp.
3. Join new rows to the previous dataset by `targetUserId`, `relationship`, and `userId`.
4. Label IDs present only in the new run as additions.
5. Label IDs present only in the previous run as removals.

The Actor returns snapshots.
It does not claim that a single run is a historical monitoring database or an alerting service.

### Spreadsheet and data-pipeline exports

Open a completed dataset and choose CSV or Excel for manual analysis.
For automation, request dataset items from the Apify API in JSON.

Useful downstream operations include:

- grouping rows by target and relationship;
- filtering verified or public profiles;
- matching stable IDs across scheduled exports;
- loading profile links into an approved outreach review process;
- joining audience rows with other lawful first-party research data.

Profile image URLs are source-controlled and can expire.
Store the profile identity fields rather than treating image URLs as permanent assets.

### Run with the Apify API

Replace `YOUR_TOKEN` with an Apify API token.
The Actor input is sent as JSON.

#### cURL

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/automation-lab~instagram-followers-following-scraper/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"usernames":["natgeo"],"relationshipType":"followers","maxItemsPerList":100}'
```

#### JavaScript

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const actor = client.actor('automation-lab/instagram-followers-following-scraper');
const run = await actor.call({
  usernames: ['natgeo'],
  relationshipType: 'followers',
  maxItemsPerList: 100,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.length);
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("automation-lab/instagram-followers-following-scraper").call(
    run_input={
        "profileUrls": ["https://www.instagram.com/nasa/"],
        "relationshipType": "following",
        "maxItemsPerList": 100,
    }
)
items = client.dataset(run["defaultDatasetId"]).list_items().items
print(len(items))
```

### Use with Apify MCP

#### Claude Desktop, Cursor, and VS Code setup

Add the Actor as an Apify MCP tool in Claude Code:

```bash
claude mcp add --transport http apify \
  "https://mcp.apify.com?tools=automation-lab/instagram-followers-following-scraper"
```

Desktop and editor clients can use:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=automation-lab/instagram-followers-following-scraper"
    }
  }
}
```

Example prompts:

- "Export up to 100 followers of natgeo and return the dataset link."
- "Get the first 200 accounts followed by nasa on Instagram."
- "Run both audience lists for these public profiles and summarize counts by relationship."

### Reliability and retry behavior

The Actor retries temporary Instagram rate limits and server errors with bounded delays.
Permanent authentication rejection, invalid input, missing profiles, and unexpected response shapes fail the run instead of returning a misleading empty success.

If Instagram temporarily rejects the managed backend session, retry later.
The session is maintained by the Actor operator; users should not paste private Instagram credentials into the input.

Private target profiles can limit relationship visibility.
A returned audience row may itself describe a private profile because list membership is visible through the managed source session.

### Limitations

- Instagram is an undocumented and frequently changing source.
- A public account's displayed count does not guarantee every row is retrievable.
- Private, restricted, deleted, renamed, or age-limited targets may not resolve.
- Instagram may truncate or temporarily limit large relationship lists.
- Viewer-relative booleans can be `null` when omitted upstream.
- The Actor exports current snapshots, not historical changes by itself.
- Results do not include email addresses, phone numbers, or inferred private details.
- High limits take longer and increase the chance of an upstream interruption.

Use schedules and your own stable-ID comparison logic for monitoring workflows.
Do not interpret an empty or partial list as proof that an account has no relationships without checking the source state.

### Legality and responsible use

Use this Actor only for lawful purposes and data you are authorized to process.
Follow Instagram's terms, Apify's terms, applicable privacy law, and your organization's policies.

Do not use results for harassment, discriminatory profiling, unsolicited bulk messaging, or attempts to bypass account privacy controls.
Minimize stored personal data, define retention periods, and protect exported datasets.

A public username can still be personal data in some jurisdictions.
Consult qualified counsel for your specific use case.

### Troubleshooting

#### The run says the profile was not found

Check the spelling and open the exact profile URL in Instagram.
The account may be renamed, deleted, private, restricted, or temporarily unavailable.

#### The run fails because the managed session was rejected

Retry later.
The Actor deliberately fails rather than silently returning zero rows when its backend authentication needs rotation.

#### I received fewer rows than the requested limit

`maxItemsPerList` is a ceiling, not a guarantee.
Instagram may end or truncate the visible list before the requested count.

#### My run returned both relationship types

Set `relationshipType` to `followers` or `following` instead of `both`.
Each output row also carries the exact `relationship` value for filtering.

#### Why are some viewer-relative fields null?

Instagram does not include every optional relationship flag on every response.
Null preserves that distinction instead of inventing `false`.

### Related Automation Lab Actors

- [Instagram Scraper](https://apify.com/automation-lab/instagram-scraper) extracts profile and post data rather than audience relationship lists.
- [Instagram Stories Scraper](https://apify.com/automation-lab/instagram-stories-scraper) focuses on current stories, highlights, and profile context.
- [Instagram Bot Detector](https://apify.com/automation-lab/instagram-bot-detector) analyzes account signals for a different downstream workflow.

Choose this Actor when follower and following profile rows are the primary dataset.
Choose a related Actor when posts, stories, or account-level analysis is the actual job.

### FAQ

#### Do I need an Instagram login or cookie?

No.
The Actor uses managed backend infrastructure and does not expose a cookie input.

#### Can I scrape followers and following in one run?

Yes.
Select `both`; the per-list limit is applied separately to each relationship direction.

#### Can I provide several target profiles?

Yes.
A run supports up to 20 unique usernames or profile URLs.
Every row contains `targetUsername` and `targetUserId` so results remain attributable.

#### Does it download profile images?

No.
It returns the source profile image URL when Instagram supplies one, avoiding unnecessary media transfer.

#### Are results guaranteed to match Instagram's displayed counts?

No.
Displayed counts and retrievable list rows can differ because of privacy, source limits, account state, and session visibility.

#### How do I find additions and removals?

Schedule repeated exports and compare stable `userId` values between dated datasets.
The Actor supplies snapshots; your workflow defines the change window and alert rules.

#### Can I export CSV or Excel?

Yes.
Open the default dataset after a run and choose the desired Apify export format.

#### What happens if Instagram changes its private API?

The run fails with a diagnostic message when the response is not trustworthy.
Check the Actor's latest changelog and retry after maintenance rather than treating failed extraction as an empty audience.

# Actor input Schema

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

Public Instagram usernames, with or without the @ prefix. You can combine these with profile URLs.

## `profileUrls` (type: `array`):

Full public Instagram profile URLs. Duplicate profiles are processed once.

## `relationshipType` (type: `string`):

Export followers, accounts followed by each target, or both lists.

## `maxItemsPerList` (type: `integer`):

Maximum profile rows saved for each target and selected relationship list.

## Actor input object example

```json
{
  "usernames": [
    "natgeo"
  ],
  "profileUrls": [],
  "relationshipType": "both",
  "maxItemsPerList": 20
}
```

# Actor output Schema

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

Follower and following records saved by the run.

# 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": [
        "natgeo"
    ],
    "maxItemsPerList": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/instagram-followers-following-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": ["natgeo"],
    "maxItemsPerList": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/instagram-followers-following-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 '{
  "usernames": [
    "natgeo"
  ],
  "maxItemsPerList": 20
}' |
apify call automation-lab/instagram-followers-following-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,automation-lab/instagram-followers-following-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/cE69ig8YnbL8bB7iE/builds/dE5fNiThRT4ey6SVX/openapi.json
