# Instagram Profile Scraper

Scrape all Instagram profile info. Just add one or more Instagram usernames and extract number of followers & following, URLs, bio and many more.

## Actor Statistics

- Total users: 24
- Monthly users: 14
- Runs succeeded: 38.24%
- Categories: Social media, Developer tools, Automation

## Pricing

$2.00 / 1,000 results

## Input Schema

- **username** (type: array): The Instagram username to scrape (without @ symbol)
- **session\_id** (type: string): Instagram session ID for authenticated requests. Get this from browser cookies after logging in. Optional - scraper works for public profiles without it.
- **delay\_between\_requests** (type: integer): Delay in seconds between API requests to avoid rate limiting

## API example

## Instagram Profile Scraper

- **OpenAPI Version:** `3.1.1`
- **API Version:** `0.0`

Scrape all Instagram profile info. Just add one or more Instagram usernames and extract number of followers & following, URLs, bio and many more.

### Servers

- **URL:** `https://api.apify.com/v2`

### Operations

#### Executes an Actor, waits for its completion, and returns Actor's dataset items in response.

- **Method:** `POST`
- **Path:** `/acts/deepanshusharm~instagram-profile-scraper/run-sync-get-dataset-items`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`session_id` (required)**

  `string` — Instagram session ID for authenticated requests. Get this from browser cookies after logging in. Optional - scraper works for public profiles without it.

- **`username` (required)**

  `array`, default: `["virat.kohli"]` — The Instagram username to scrape (without @ symbol)

  **Items:**

  `string`

- **`delay_between_requests`**

  `integer`, default: `3` — Delay in seconds between API requests to avoid rate limiting

**Example:**

```
{
  "username": [
    "virat.kohli"
  ],
  "session_id": "",
  "delay_between_requests": 3
}
```

##### Responses

###### Status: 200 OK

#### Executes an Actor and returns information about the initiated run in response.

- **Method:** `POST`
- **Path:** `/acts/deepanshusharm~instagram-profile-scraper/runs`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`session_id` (required)**

  `string` — Instagram session ID for authenticated requests. Get this from browser cookies after logging in. Optional - scraper works for public profiles without it.

- **`username` (required)**

  `array`, default: `["virat.kohli"]` — The Instagram username to scrape (without @ symbol)

  **Items:**

  `string`

- **`delay_between_requests`**

  `integer`, default: `3` — Delay in seconds between API requests to avoid rate limiting

**Example:**

```
{
  "username": [
    "virat.kohli"
  ],
  "session_id": "",
  "delay_between_requests": 3
}
```

##### Responses

###### Status: 200 OK

\####### Content-Type: application/json

- **`data`**

  `object`

  - **`actId`**

    `string`

  - **`buildId`**

    `string`

  - **`buildNumber`**

    `string`

  - **`containerUrl`**

    `string`

  - **`defaultDatasetId`**

    `string`

  - **`defaultKeyValueStoreId`**

    `string`

  - **`defaultRequestQueueId`**

    `string`

  - **`finishedAt`**

    `string`, format: `date-time`

  - **`id`**

    `string`

  - **`meta`**

    `object`

    - **`origin`**

      `string`

    - **`userAgent`**

      `string`

  - **`options`**

    `object`

    - **`build`**

      `string`

    - **`diskMbytes`**

      `integer`

    - **`memoryMbytes`**

      `integer`

    - **`timeoutSecs`**

      `integer`

  - **`startedAt`**

    `string`, format: `date-time`

  - **`stats`**

    `object`

    - **`computeUnits`**

      `integer`

    - **`inputBodyLen`**

      `integer`

    - **`rebootCount`**

      `integer`

    - **`restartCount`**

      `integer`

    - **`resurrectCount`**

      `integer`

  - **`status`**

    `string`

  - **`usage`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `integer`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`usageTotalUsd`**

    `number`

  - **`usageUsd`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `number`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`userId`**

    `string`

**Example:**

```
{
  "data": {
    "id": "",
    "actId": "",
    "userId": "",
    "startedAt": "2025-01-08T00:00:00.000Z",
    "finishedAt": "2025-01-08T00:00:00.000Z",
    "status": "READY",
    "meta": {
      "origin": "API",
      "userAgent": ""
    },
    "stats": {
      "inputBodyLen": 2000,
      "rebootCount": 0,
      "restartCount": 0,
      "resurrectCount": 0,
      "computeUnits": 0
    },
    "options": {
      "build": "latest",
      "timeoutSecs": 300,
      "memoryMbytes": 1024,
      "diskMbytes": 2048
    },
    "buildId": "",
    "defaultKeyValueStoreId": "",
    "defaultDatasetId": "",
    "defaultRequestQueueId": "",
    "buildNumber": "1.0.0",
    "containerUrl": "",
    "usage": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 1,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    },
    "usageTotalUsd": 0.00005,
    "usageUsd": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 0.00005,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    }
  }
}
```

#### Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.

- **Method:** `POST`
- **Path:** `/acts/deepanshusharm~instagram-profile-scraper/run-sync`
- **Tags:** Run Actor

##### Request Body

###### Content-Type: application/json

- **`session_id` (required)**

  `string` — Instagram session ID for authenticated requests. Get this from browser cookies after logging in. Optional - scraper works for public profiles without it.

- **`username` (required)**

  `array`, default: `["virat.kohli"]` — The Instagram username to scrape (without @ symbol)

  **Items:**

  `string`

- **`delay_between_requests`**

  `integer`, default: `3` — Delay in seconds between API requests to avoid rate limiting

**Example:**

```
{
  "username": [
    "virat.kohli"
  ],
  "session_id": "",
  "delay_between_requests": 3
}
```

##### Responses

###### Status: 200 OK

### Schemas

#### inputSchema

- **Type:**`object`

* **`session_id` (required)**

  `string` — Instagram session ID for authenticated requests. Get this from browser cookies after logging in. Optional - scraper works for public profiles without it.

* **`username` (required)**

  `array`, default: `["virat.kohli"]` — The Instagram username to scrape (without @ symbol)

  **Items:**

  `string`

* **`delay_between_requests`**

  `integer`, default: `3` — Delay in seconds between API requests to avoid rate limiting

**Example:**

```
{
  "username": [
    "virat.kohli"
  ],
  "session_id": "",
  "delay_between_requests": 3
}
```

#### runsResponseSchema

- **Type:**`object`

* **`data`**

  `object`

  - **`actId`**

    `string`

  - **`buildId`**

    `string`

  - **`buildNumber`**

    `string`

  - **`containerUrl`**

    `string`

  - **`defaultDatasetId`**

    `string`

  - **`defaultKeyValueStoreId`**

    `string`

  - **`defaultRequestQueueId`**

    `string`

  - **`finishedAt`**

    `string`, format: `date-time`

  - **`id`**

    `string`

  - **`meta`**

    `object`

    - **`origin`**

      `string`

    - **`userAgent`**

      `string`

  - **`options`**

    `object`

    - **`build`**

      `string`

    - **`diskMbytes`**

      `integer`

    - **`memoryMbytes`**

      `integer`

    - **`timeoutSecs`**

      `integer`

  - **`startedAt`**

    `string`, format: `date-time`

  - **`stats`**

    `object`

    - **`computeUnits`**

      `integer`

    - **`inputBodyLen`**

      `integer`

    - **`rebootCount`**

      `integer`

    - **`restartCount`**

      `integer`

    - **`resurrectCount`**

      `integer`

  - **`status`**

    `string`

  - **`usage`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `integer`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`usageTotalUsd`**

    `number`

  - **`usageUsd`**

    `object`

    - **`ACTOR_COMPUTE_UNITS`**

      `integer`

    - **`DATA_TRANSFER_EXTERNAL_GBYTES`**

      `integer`

    - **`DATA_TRANSFER_INTERNAL_GBYTES`**

      `integer`

    - **`DATASET_READS`**

      `integer`

    - **`DATASET_WRITES`**

      `integer`

    - **`KEY_VALUE_STORE_LISTS`**

      `integer`

    - **`KEY_VALUE_STORE_READS`**

      `integer`

    - **`KEY_VALUE_STORE_WRITES`**

      `number`

    - **`PROXY_RESIDENTIAL_TRANSFER_GBYTES`**

      `integer`

    - **`PROXY_SERPS`**

      `integer`

    - **`REQUEST_QUEUE_READS`**

      `integer`

    - **`REQUEST_QUEUE_WRITES`**

      `integer`

  - **`userId`**

    `string`

**Example:**

```
{
  "data": {
    "id": "",
    "actId": "",
    "userId": "",
    "startedAt": "2025-01-08T00:00:00.000Z",
    "finishedAt": "2025-01-08T00:00:00.000Z",
    "status": "READY",
    "meta": {
      "origin": "API",
      "userAgent": ""
    },
    "stats": {
      "inputBodyLen": 2000,
      "rebootCount": 0,
      "restartCount": 0,
      "resurrectCount": 0,
      "computeUnits": 0
    },
    "options": {
      "build": "latest",
      "timeoutSecs": 300,
      "memoryMbytes": 1024,
      "diskMbytes": 2048
    },
    "buildId": "",
    "defaultKeyValueStoreId": "",
    "defaultDatasetId": "",
    "defaultRequestQueueId": "",
    "buildNumber": "1.0.0",
    "containerUrl": "",
    "usage": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 1,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    },
    "usageTotalUsd": 0.00005,
    "usageUsd": {
      "ACTOR_COMPUTE_UNITS": 0,
      "DATASET_READS": 0,
      "DATASET_WRITES": 0,
      "KEY_VALUE_STORE_READS": 0,
      "KEY_VALUE_STORE_WRITES": 0.00005,
      "KEY_VALUE_STORE_LISTS": 0,
      "REQUEST_QUEUE_READS": 0,
      "REQUEST_QUEUE_WRITES": 0,
      "DATA_TRANSFER_INTERNAL_GBYTES": 0,
      "DATA_TRANSFER_EXTERNAL_GBYTES": 0,
      "PROXY_RESIDENTIAL_TRANSFER_GBYTES": 0,
      "PROXY_SERPS": 0
    }
  }
}
```

## Instagram Profile Scraper

A powerful and efficient Instagram profile scraper built for the Apify platform. This tool can scrape basic profile information from single or multiple Instagram accounts with built-in rate limiting and error handling.

### Features

- **Single & Bulk Scraping**: Scrape one profile or hundreds at once
- **Rate Limiting**: Built-in delays to avoid Instagram's rate limits
- **Authenticated & Public Access**: Works with or without Instagram login
- **Comprehensive Data**: Extracts follower counts, bio, contact info, and more
- **Error Handling**: Robust retry mechanism with detailed error reporting
- **Apify Integration**: Seamless integration with Apify's dataset and storage

### Scraped Data

The scraper extracts the following information for each profile:

- **Basic Info**: Username, User ID, Full Name, Biography
- **Statistics**: Follower count, Following count, Media count
- **Profile Images**: Standard and HD profile picture URLs
- **Account Type**: Private/Public, Verified status, Business account
- **Contact Info**: External URL, Email, Phone number, Category
- **Metadata**: Scraping timestamp

### Input Configuration

#### Required Parameters

- **`username`** (string or array): Instagram username(s) to scrape
  - Single user: `"john_doe"`
  - Multiple users: `["user1", "user2", "user3"]`
  - Accepts usernames with or without the @ symbol

- **`session_id`** (string): Instagram session ID for authenticated access
  - Enables scraping of some private profiles
  - Increases rate limits
  - Format: Your Instagram sessionid cookie value

#### Optional Parameters

- **`delay_between_requests`** (integer, default: 3): Delay in seconds between requests
  - Recommended: 3-5 seconds for public access
  - Can be reduced to 1-2 seconds with authentication
  - Increase if experiencing rate limits

### Input Examples

#### Single Profile

```json
{
  "username": "instagram",
  "session_id": "your_session_id_here",
  "delay_between_requests": 3
}
```

### Output Format

#### Single Profile Output

```json
{
  "username": "instagram",
  "user_id": "25025320",
  "full_name": "Instagram",
  "biography": "Bringing you closer to the people and things you love. ❤️",
  "follower_count": 627000000,
  "following_count": 76,
  "media_count": 7553,
  "profile_pic_url": "https://...",
  "profile_pic_url_hd": "https://...",
  "is_private": false,
  "is_verified": true,
  "is_business": true,
  "external_url": "https://about.instagram.com/",
  "category": "Product/Service",
  "contact_phone_number": "",
  "public_email": "",
  "scraped_at": "2024-12-07T10:30:00"
}
```

### Getting Instagram Session ID

To scrape private profiles or increase rate limits, you'll need your Instagram session ID:

1. **Login to Instagram** in your web browser
2. **Open Developer Tools** (F12 or right-click → Inspect)
3. **Go to Application/Storage tab** → Cookies → https://www.instagram.com
4. **Find the `sessionid` cookie** and copy its value
5. **Use this value** in the `session_id` parameter

⚠️ **Security Note**: Never share your session ID publicly. It provides access to your Instagram account.

### Rate Limiting & Best Practices

#### Recommended Settings

- **Public Access**: 3-5 seconds delay, max 100 profiles per run
- **Authenticated Access**: 2-3 seconds delay, max 200 profiles per run
- **Large Scale**: Split into multiple smaller runs

#### Error Handling

The scraper automatically handles:

- Rate limiting with exponential backoff
- Network timeouts and connection errors
- Private profiles and deleted accounts
- Invalid usernames

### Limitations

- **Public Profiles Only** (without authentication): Cannot access private profiles
- **Rate Limits**: Instagram enforces rate limits; respect them to avoid blocks
- **Dynamic Content**: Some profile data may change frequently
- **Terms of Service**: Ensure compliance with Instagram's ToS and local laws

### Support

For issues specific to this scraper:

1. Check the error messages in the log output
2. Verify your input parameters
3. Test with a single profile first
4. Review Instagram's current ToS and rate limits

**Disclaimer**: This tool is for educational and research purposes. Users are responsible for complying with Instagram's Terms of Service and applicable laws. Use responsibly and ethically.
