# LinkedIn Scrape: Profiles, Posts, Messages, Reactions, Comments (`agent-x/linkedin-multi-functional-scraper`) Actor

Scrape & Collect profiles, companies, posts, messages, reactions, and comments efficiently.
Save 84% on costs while getting more functionality. Perfect for researchers, recruiters, sales teams, and marketers.
Customizable, automated, and easy to integrate.

- **URL**: https://apify.com/agent-x/linkedin-multi-functional-scraper.md
- **Developed by:** [Agent-X](https://apify.com/agent-x) (community)
- **Categories:** Lead generation, Social media, Automation
- **Stats:** 205 total users, 0 monthly users, 100.0% runs succeeded, 11 bookmarks
- **User rating**: 1.17 out of 5 stars

## Pricing

$20.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## 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

## LinkedIn Multi-Functional Scraper

### Overview

## LinkedIn Multi-Functional Scraper: The Ultimate All-in-One Solution

### 🚀 Transform Your LinkedIn Data Collection

Tired of juggling multiple scrapers and paying excessive fees? Meet the LinkedIn Multi-Functional Scraper - your comprehensive solution for extracting profiles, companies, posts, messages, reactions, and comments from LinkedIn, all in one powerful package.

**Save 84% on your LinkedIn data collection costs while getting more functionality!**

#### 💰 Unbeatable Value
- Traditional approach (separate scrapers): $125+/month
- Our all-in-one solution: Just $20/month
- Get more features, better integration, and superior support

### ✨ Key Features

#### 🎯 Comprehensive Data Collection
- **Profile Scraping**: Complete professional details, experience, education, skills
- **Company Data**: Company information, employees, posts, analytics
- **Post Collection**: Content, reactions, comments, engagement metrics
- **Message Extraction**: Conversation details and participant information
- **Reaction Analysis**: Detailed engagement data and user interactions
- **Comment Processing**: Thread analysis and user engagement

#### 🔄 Advanced Automation
- Webhook integration for real-time data processing
- Customizable operation parameters
- Flexible proxy configuration
- Batch processing capabilities
- Automated data export

#### 🛠 Enterprise-Grade Capabilities
- Multiple operation types in single runs
- Advanced filtering options
- Customizable search parameters
- Detailed output formatting
- Rate limit handling
- Error recovery

### 💡 Perfect For

- **Market Researchers**: Gather comprehensive market intelligence
- **Recruiters**: Streamline talent sourcing and analysis
- **Sales Teams**: Generate qualified leads and insights
- **Marketing Professionals**: Track campaign performance and engagement
- **Business Analysts**: Collect data for strategic decision-making
- **HR Professionals**: Monitor employee engagement and company presence

### 🎮 Easy to Use

1. Configure your LinkedIn credentials
2. Define your operations
3. Set your parameters
4. Get comprehensive data

```json
{
   "operations": [
     {
       "retrieval_type": "Post_Content",
       "url": "https://linkedin.com/in/example-profile",
       "days_to_go_back": 7,
       "number_of_posts": 5
     }
   ]
}
````

### 🔧 Powerful Configuration Options

#### Authentication

- Simple cookie-based authentication
- Secure credential handling
- Multiple session support

#### Operation Types

- Profile data extraction
- Company information gathering
- Post content collection
- Message retrieval
- Reaction analysis
- Comment processing

#### Advanced Filtering

- Geographic targeting
- Industry-specific filtering
- Network-level filtering
- Time-based parameters
- Language preferences

### 🔄 Seamless Integration

- Webhook support for automated workflows
- API integration capabilities
- Export to multiple formats
- Custom data processing options
- Real-time data streaming

### 💪 Why Choose Our Scraper?

1. **Cost-Effective**: Save over 80% compared to using multiple scrapers
2. **Comprehensive**: All LinkedIn data extraction needs in one tool
3. **Reliable**: Enterprise-grade infrastructure and support
4. **Flexible**: Customizable to your specific needs
5. **Automated**: Built for seamless integration with your workflows

### 🎯 Getting Started

1. Get your Apify token
2. Configure your LinkedIn credentials
3. Define your operations
4. Start collecting valuable data

### 📊 Sample Output

```json
{
  "profiles": [
    {
      "firstName": "John",
      "lastName": "Doe",
      "headline": "Senior Developer",
      "location": {
        "country": "United States",
        "city": "San Francisco"
      }
    }
  ]
}
```

### 🤝 Support & Resources

- Detailed documentation
- Technical support
- Regular updates
- Custom development options
- Community forum

### 🚀 Ready to Transform Your LinkedIn Data Collection?

Don't waste time and money on multiple scrapers. Get started with the LinkedIn Multi-Functional Scraper today and experience the power of comprehensive LinkedIn data extraction at an unbeatable price.

***

*Note: Use this tool responsibly and ensure compliance with LinkedIn’s terms of service, as well as all relevant data protection regulations applicable in your region.*

Need help or have questions? Create an issue on the actor's Issues tab in Apify Console or contact our support team.

***

### Configuration

#### Input Fields

##### 1. **LinkedIn Session Cookie (`cookie`)**

- **Description**: Your LinkedIn session cookies (`li_at` and `JSESSIONID`) are required for authentication.
- **How to Retrieve**:

  1. Log in to LinkedIn in your browser.
  2. Open Developer Tools (press `F12` or right-click and select "Inspect").
  3. Navigate to the **Application** or **Storage** tab.
  4. Under **Cookies**, find the domain `linkedin.com`.
  5. Copy the value of the cookie named `li_at`.
  6. Repeat step 5 for `JSESSIONID`.

  - **Example**:

  ```json
   {
     "li_at": "Your li_at cookie",
     "JSESSIONID": "Your JSESSIONID cookie"
   }
  ```

##### 2. **Operations (`operations`)**

- **Description**: A JSON array defining the operations the scraper should perform. Each operation specifies the retrieval type, URL, and optional parameters.

- **Input Format**:
  - The `operations` field expects a JSON array. Each item in the array is an object with the following properties:
    - **`retrieval_type`** (required): The type of operation. Must be one of:
      - `"Post_Content"`: Retrieve posts from a profile.
      - `"LinkedIn_Profile"`: Retrieve LinkedIn profile details.
      - `"Company"`: Retrieve LinkedIn company details.
      - `"Post_From_URL"`: Retrieve posts from a URL.
      - `"Conversation_Detail"`: Retrieve conversation details from a profile. Also gets the profile of the person you are conversing with.
    - **`profile`** (required for `Conversation_Detail`): The LinkedIn URL of the profile to retrieve conversation details from.
    - **`url`** (required): The LinkedIn URL for the operation.
    - **`days_to_go_back`** (optional): Number of days to retrieve posts from (for `Post_Content` only). Default: `1`.
    - **`number_of_posts`** (optional): Number of posts to retrieve (for `Post_Content` only). Default: `10`.
    - **`number_of_comments`** (optional): Number of comments to retrieve (for `Post_Content` only). Default: `10`.
    - **`number_of_reactions`** (optional): Number of reactions to retrieve (for `Post_Content` only). Default: `10`.
    - **`keywords`** (optional): Keywords to search for (for `Post_From_URL` only).
    - **`extra_filters`** (optional): Extra filters to apply (for `Post_From_URL` only). Example: `",geoUrn->103644278,network->F"`.
    - **`number_of_search_pages`** (optional): Number of search pages to retrieve (for `Post_From_URL` only). Default: `1`.
      - Note Due to the way LinkedIn batches the number of search pages can result in different numbers of posts being returned.

- **Additional filters we are aware of are**:

  - **`geoUrn`**: Filters results by geographic region. For example:
    - Europe: "103644278"
    - United States: "103644279"
      These URNs can be found by inspecting LinkedIn's network requests during region-specific searches.
  - **`industry`**: Filters results by industries using URN IDs. Examples include:
    - Technology: "104091591"
    - Finance: "104091587"
      You can find valid industry URNs by inspecting network requests or LinkedIn search results.
  - **`currentCompany`**: Filters by current employer using their URN. Example:
    - "urn:li:organization:123456" for a specific company.
      These URNs can be obtained from a company’s LinkedIn page.
  - **`pastCompany`**: Filters by past employers using their URNs (similar to currentCompany).
  - **`network`**: Filters by connection degree:
    - F: 1st-degree connections (direct connections).
    - S: 2nd-degree connections (connections of connections).
    - O: 3rd-degree connections and beyond.
  - **`profileLanguage`**: Filters by profile language. Examples include:
    - 'en': English
    - 'es': Spanish
      Specify the language code for filtering.
  - **`school`**: Filters by educational institutions using their URNs. Example:
    - "urn:li:fs\_miniSchool:123456" for a specific school.
      These URNs can be obtained by inspecting LinkedIn profiles or school pages.
  - **`listed_at`**: Restricts results to posts made within a specific timeframe. Examples:
    - "86400": Last 24 hours (in seconds).
    - "604800": Last 7 days (in seconds).
  - **`connectionOf`**: Filters results to connections of a specified profile using their URN. Example:
    - "urn:li:fs\_miniProfile:123456" to filter connections of a specific profile.

  * Note: We cannot guatanee the these filters are correct, you must verify if they are correct before using them.

- **Example**:
  ```json
   {
     "operations": [
       {
         "retrieval_type": "Post_Content",
         "url": "https://linkedin.com/in/example-profile",
         "days_to_go_back": 7,
         "number_of_posts": 5,
         "deep_search": true,
         "number_of_comments": 5,
         "number_of_reactions": 5
       },
       {
           "retrieval_type": "Post_From_URL",
           "keywords": "artificial intelligence",
           "extra_filters": ",geoUrn->103644278,network->F",
           "deep_search": true,
           "number_of_comments": 1,
           "number_of_reactions": 1,
           "number_of_search_pages": 1
       },
       {
         "retrieval_type": "Company",
         "url": "https://linkedin.com/company/example-company"
       },
       {
         "retrieval_type": "LinkedIn_Profile",
         "url": "https://linkedin.com/in/example-profile-2"
       },
       {
         "retrieval_type": "Conversation_Detail",
         "profile": "https://linkedin.com/in/example-profile"
       }
     ]
   }
  ```

##### 3. **Proxy Configuration (`proxyConfiguration`)**

- **Description**: Configure proxy settings for the scraper.
- **Fields**:
  - **`useApifyProxy`**: Use Apify Proxy for requests. Default: `true`.
  - **`apifyProxyCountry`**: Specify a preferred country for Apify proxies. Example: `"US"`.

##### 4. **Timeout (`timeout`)**

- **Description**: Maximum time (in seconds) to wait for each operation. Default: `30`.

##### 5. **Apify Token (`apifyToken`)**

- **Description**: Your Apify API token. If not provided here, the token must be set in the `APIFY_TOKEN` environment variable.

##### 6. **Webhook URLs (`webHookUrls`)**

- **Description**: A list of URLs that will be called when the scraper completes its operation. Each webhook will receive the scraping results in JSON format.
- **Type**: Array of strings
- **Optional**: Yes
- **Example**:
  ```json
  {
    "webHookUrls": [
      "https://example.com/webhook1",
      "https://example.com/webhook2"
    ]
  }
  ```

##### 7. **Include Raw Data (`include_raw_data`)**

- **Description**: Optional boolean parameter to include the complete raw data in the output
- **Default**: `false`
- **Example**:
  ```json
  {
    "include_raw_data": true
  }
  ```
- **Use Case**: Useful for accessing additional data fields not included in the standard cleaned structure or for debugging purposes

***

#### Full Example Input

```json
{
  "cookie": {
    "li_at": "AQEDAS8C5QoFE-KwAAABjLU1NbIAAAGM2UG5sk4AKQeJJk...",
    "JSESSIONID": "ajax:8537563245245"
  },
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyCountry": "US",
    "apifyProxyGroups": ["RESIDENTIAL"]
  },
  "minWaitTime": 10,
  "maxWaitTime": 30,
  "include_raw_data": false,
  "webhookUrls": ["https://your-webhook.com/endpoint"],
  "apifyToken": "your_apify_token",
  "include_raw_data": false,
  "operations": {
    "operations": [
          {
            "retrieval_type": "Post_Content",
            "url": "https://linkedin.com/in/example-profile",
            "days_to_go_back": 7,
            "number_of_posts": 10,
            "number_of_comments": 5,
            "number_of_reactions": 5,
            "deepSearch": false
          },
          {
            "retrieval_type": "Company",
            "url": "https://linkedin.com/company/example-company"
          },
          {
            "retrieval_type": "LinkedIn_Profile",
            "url": "https://linkedin.com/in/example-profile"
          },
          {
            "retrieval_type": "Post_From_URL",
            "keywords": "software engineer",
            "extra_filters": ",geoUrn->103644278,network->F",
            "number_of_search_pages": 1,
            "number_of_comments": 5,
            "number_of_reactions": 5,
            "deepSearch": false
          },
          {
            "retrieval_type": "Conversation_Detail",
            "profile": "https://linkedin.com/in/example-profile"
          }
        ]
      }
}
```

#### Example Output

```json
{
  "profiles": [
    {
      "profileUrn": "",
      "profileId": "",
      "firstName": "",
      "lastName": "",
      "headline": "",
      "summary": "",
      "location": {
        "country": "",
        "city": ""
      },
      "experience": [
        {
          "title": "",
          "companyName": "",
          "description": null,
          "linkedinCompanyURN": null,
          "dateRange": {
            "startDate": {
              "month": null,
              "year": null
            },
            "endDate": {
              "month": null,
              "year": null
            }
          }
        }
      ],
      "education": [
        {
          "schoolName": "",
          "degreeName": null,
          "fieldOfStudy": null,
          "dateRange": {
            "startYear": null,
            "endYear": null
          }
        }
      ],
      "skills": [],
      "languages": [
        {
          "name": "",
          "proficiency": ""
        }
      ],
      "certifications": [
        {
          "name": "",
          "authority": "",
          "date": {
            "startDate": null,
            "endDate": null
          }
        }
      ],
      "publications": [],
      "volunteer": [],
      "honours": [],
      "projects": [
        {
          "title": "",
          "description": "",
          "dateRange": {
            "startDate": {
              "month": null,
              "year": null
            },
            "endDate": {
              "month": null,
              "year": null
            }
          }
        }
      ],
      "contactDetails": {
        "email": "",
        "websites": [
          {
            "url": "",
            "label": ""
          }
        ],
        "phoneNumbers": [
          {
            "type": "",
            "number": ""
          }
        ]
      },
      "privacyDetails": {
        "messagingTypingIndicators": "",
        "allowOpenProfile": false,
        "profilePictureVisibilitySetting": "",
        "entityUrn": "",
        "showPublicProfile": false,
        "showPremiumSubscriberBadge": false,
        "publicProfilePictureVisibilitySetting": "",
        "formerNameVisibilitySetting": "",
        "messagingSeenReceipts": "",
        "allowProfileEditBroadcasts": false,
        "$type": ""
      },
      "industry": "",
      "profilePicture": {
        "small": "",
        "large": ""
      }
    }
  ],
  "posts": [
    {
      "postUrn": "",
      "profileId": "",
      "author": {
        "firstName": "",
        "lastName": "",
        "headline": "",
        "profileUrn": null
      },
      "content": "",
      "publishedDate": null,
      "stats": {
        "numLikes": 0,
        "numComments": 0,
        "numShares": 0
      },
      "reactions": [
        {
          "reactionType": "",
          "reactor": {
            "firstName": "",
            "lastName": ""
          },
          "reactorProfileUrl": ""
        }
      ],
      "comments": [
        {
          "author": {
            "firstName": "",
            "lastName": ""
          },
          "commenterProfileUrl": "",
          "text": "",
          "timeOffset": -1
        }
      ]
    }
  ],
  "companies": [
    {
      "companyUrn": "",
      "name": "",
      "tagline": "",
      "description": "",
      "industry": "",
      "companySize": {
        "min": null,
        "max": null
      },
      "locations": [
        {
          "city": "",
          "country": "",
          "isHeadquarter": false
        }
      ],
      "specialities": [],
      "website": "",
      "foundedYear": null
    }
  ],
  "conversationDetail": [
    {
      "conversation_id": "",
      "messages": [
        {
          "message_id": "",
          "timestamp": 0,
          "sender": {
            "firstName": "",
            "lastName": "",
            "profileId": "",
            "occupation": ""
          },
          "message": "",
          "previous_message_id": "",
          "reactions": []
        }
      ],
      "metadata": {
        "participants": [
          {
            "firstName": "",
            "lastName": "",
            "profileId": "",
            "occupation": ""
          }
        ],
        "total_messages": 0,
        "unread_count": 0,
        "last_activity": 0,
        "group_chat": false,
        "read": true
      }
    }
  ]
}
```

### 📜 Legal Disclaimer

This software is provided **"as is,"** without warranty of any kind, express or implied, including but not limited to warranties of **merchantability, fitness for a particular purpose, or non-infringement**. The authors and contributors shall **not be held liable** for any claim, damages, or other liabilities arising from the use of this software.

By using this tool, you acknowledge that:

- You are **solely responsible** for how you use this software.
- You must **comply with LinkedIn's Terms of Service** and all applicable **data protection laws** (such as **GDPR, CCPA**, or other regional regulations).
- You must **not use this tool for unlawful or unethical purposes**, including unauthorized data scraping.
- The data accessible through this tool is **limited by LinkedIn's visibility settings** and the permissions of the LinkedIn account used.
- This project is **not affiliated with, endorsed by, or connected to LinkedIn Corporation** in any way.
- The availability and structure of data may change without notice due to LinkedIn platform updates.

The maintainers of this project **do not endorse** or encourage any misuse of LinkedIn’s platform. **Use at your own risk.**

# Actor input Schema

## `cookie` (type: `object`):

LinkedIn session cookies (li\_at and JSESSIONID). To retrieve it: 1. Log in to LinkedIn. 2. Open developer tools (F12). 3. Navigate to Application > Cookies. 4. Copy the value of the li\_at and JSESSIONID cookies.

## `operations` (type: `object`):

Define the operations to perform as a JSON array.

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

Select proxies to be used by your crawler.

## `apifyToken` (type: `string`):

Provide your Apify API token. If not provided, the token must be set in the environment.

## `include_raw_data` (type: `boolean`):

Can be useful if you want to map something extra.

## `minWaitTime` (type: `integer`):

Minimum time in seconds to wait between operations.

## `maxWaitTime` (type: `integer`):

Maximum time in seconds to wait between operations.

## `webHookUrls` (type: `array`):

A list of webhook URLs to be called upon completion.

## Actor input object example

```json
{
  "cookie": {
    "li_at": "AQEDASp5C8kFE-KwAAABjLU1NbIAAAGM2UG5sk4AKQeJJk...",
    "JSESSIONID": "ajax:853756...."
  },
  "operations": {
    "operations": [
      {
        "retrieval_type": "Post_Content",
        "url": "https://linkedin.com/in/sarah-smith-12345...",
        "days_to_go_back": 7,
        "number_of_posts": 5,
        "deep_search": false,
        "number_of_comments": 5,
        "number_of_reactions": 5
      },
      {
        "retrieval_type": "Post_From_URL",
        "keywords": "artificial intelligence",
        "extra_filters": ",geoUrn->103644278,network->F",
        "deep_search": false,
        "number_of_comments": 1,
        "number_of_reactions": 1,
        "number_of_search_pages": 1
      },
      {
        "retrieval_type": "Company",
        "url": "https://linkedin.com/company/acme-innovations..."
      },
      {
        "retrieval_type": "LinkedIn_Profile",
        "url": "https://linkedin.com/in/sarah-smith-12345..."
      },
      {
        "retrieval_type": "Conversation_Detail",
        "profile": "https://linkedin.com/in/sarah-smith-12345..."
      }
    ]
  },
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "apifyToken": "apfy_act_1234567890abcdefghijklmn",
  "include_raw_data": false,
  "minWaitTime": 1,
  "maxWaitTime": 30,
  "webHookUrls": [
    "https://api.company.com/webhook/linkedin"
  ]
}
```

# 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 = {
    "cookie": {
        "li_at": "AQEDASp5C8kFE-KwAAABjLU1NbIAAAGM2UG5sk4AKQeJJk...",
        "JSESSIONID": "ajax:853756...."
    },
    "operations": {
        "operations": [
            {
                "retrieval_type": "Post_Content",
                "url": "https://linkedin.com/in/sarah-smith-12345...",
                "days_to_go_back": 7,
                "number_of_posts": 5,
                "deep_search": false,
                "number_of_comments": 5,
                "number_of_reactions": 5
            },
            {
                "retrieval_type": "Post_From_URL",
                "keywords": "artificial intelligence",
                "extra_filters": ",geoUrn->103644278,network->F",
                "deep_search": false,
                "number_of_comments": 1,
                "number_of_reactions": 1,
                "number_of_search_pages": 1
            },
            {
                "retrieval_type": "Company",
                "url": "https://linkedin.com/company/acme-innovations..."
            },
            {
                "retrieval_type": "LinkedIn_Profile",
                "url": "https://linkedin.com/in/sarah-smith-12345..."
            },
            {
                "retrieval_type": "Conversation_Detail",
                "profile": "https://linkedin.com/in/sarah-smith-12345..."
            }
        ]
    },
    "proxyConfiguration": {
        "useApifyProxy": true
    },
    "apifyToken": "apfy_act_1234567890abcdefghijklmn",
    "webHookUrls": [
        "https://api.company.com/webhook/linkedin"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("agent-x/linkedin-multi-functional-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 = {
    "cookie": {
        "li_at": "AQEDASp5C8kFE-KwAAABjLU1NbIAAAGM2UG5sk4AKQeJJk...",
        "JSESSIONID": "ajax:853756....",
    },
    "operations": { "operations": [
            {
                "retrieval_type": "Post_Content",
                "url": "https://linkedin.com/in/sarah-smith-12345...",
                "days_to_go_back": 7,
                "number_of_posts": 5,
                "deep_search": False,
                "number_of_comments": 5,
                "number_of_reactions": 5,
            },
            {
                "retrieval_type": "Post_From_URL",
                "keywords": "artificial intelligence",
                "extra_filters": ",geoUrn->103644278,network->F",
                "deep_search": False,
                "number_of_comments": 1,
                "number_of_reactions": 1,
                "number_of_search_pages": 1,
            },
            {
                "retrieval_type": "Company",
                "url": "https://linkedin.com/company/acme-innovations...",
            },
            {
                "retrieval_type": "LinkedIn_Profile",
                "url": "https://linkedin.com/in/sarah-smith-12345...",
            },
            {
                "retrieval_type": "Conversation_Detail",
                "profile": "https://linkedin.com/in/sarah-smith-12345...",
            },
        ] },
    "proxyConfiguration": { "useApifyProxy": True },
    "apifyToken": "apfy_act_1234567890abcdefghijklmn",
    "webHookUrls": ["https://api.company.com/webhook/linkedin"],
}

# Run the Actor and wait for it to finish
run = client.actor("agent-x/linkedin-multi-functional-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 '{
  "cookie": {
    "li_at": "AQEDASp5C8kFE-KwAAABjLU1NbIAAAGM2UG5sk4AKQeJJk...",
    "JSESSIONID": "ajax:853756...."
  },
  "operations": {
    "operations": [
      {
        "retrieval_type": "Post_Content",
        "url": "https://linkedin.com/in/sarah-smith-12345...",
        "days_to_go_back": 7,
        "number_of_posts": 5,
        "deep_search": false,
        "number_of_comments": 5,
        "number_of_reactions": 5
      },
      {
        "retrieval_type": "Post_From_URL",
        "keywords": "artificial intelligence",
        "extra_filters": ",geoUrn->103644278,network->F",
        "deep_search": false,
        "number_of_comments": 1,
        "number_of_reactions": 1,
        "number_of_search_pages": 1
      },
      {
        "retrieval_type": "Company",
        "url": "https://linkedin.com/company/acme-innovations..."
      },
      {
        "retrieval_type": "LinkedIn_Profile",
        "url": "https://linkedin.com/in/sarah-smith-12345..."
      },
      {
        "retrieval_type": "Conversation_Detail",
        "profile": "https://linkedin.com/in/sarah-smith-12345..."
      }
    ]
  },
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "apifyToken": "apfy_act_1234567890abcdefghijklmn",
  "webHookUrls": [
    "https://api.company.com/webhook/linkedin"
  ]
}' |
apify call agent-x/linkedin-multi-functional-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "LinkedIn Scrape: Profiles, Posts, Messages, Reactions, Comments",
        "description": "Scrape & Collect profiles, companies, posts, messages, reactions, and comments efficiently. \nSave 84% on costs while getting more functionality. Perfect for researchers, recruiters, sales teams, and marketers. \nCustomizable, automated, and easy to integrate.",
        "version": "0.0",
        "x-build-id": "SafbwyuVJaQdmvn0r"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/agent-x~linkedin-multi-functional-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-agent-x-linkedin-multi-functional-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/agent-x~linkedin-multi-functional-scraper/runs": {
            "post": {
                "operationId": "runs-sync-agent-x-linkedin-multi-functional-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/agent-x~linkedin-multi-functional-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-agent-x-linkedin-multi-functional-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": [
                    "cookie",
                    "operations",
                    "proxyConfiguration",
                    "apifyToken"
                ],
                "properties": {
                    "cookie": {
                        "title": "LinkedIn cookie session cookie (li_at and JSESSIONID)",
                        "type": "object",
                        "description": "LinkedIn session cookies (li_at and JSESSIONID). To retrieve it: 1. Log in to LinkedIn. 2. Open developer tools (F12). 3. Navigate to Application > Cookies. 4. Copy the value of the li_at and JSESSIONID cookies."
                    },
                    "operations": {
                        "title": "Operations",
                        "type": "object",
                        "description": "Define the operations to perform as a JSON array."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Select proxies to be used by your crawler."
                    },
                    "apifyToken": {
                        "title": "Apify Token",
                        "type": "string",
                        "description": "Provide your Apify API token. If not provided, the token must be set in the environment."
                    },
                    "include_raw_data": {
                        "title": "Include Raw Data in output",
                        "type": "boolean",
                        "description": "Can be useful if you want to map something extra.",
                        "default": false
                    },
                    "minWaitTime": {
                        "title": "Minimum Wait Time",
                        "type": "integer",
                        "description": "Minimum time in seconds to wait between operations.",
                        "default": 1
                    },
                    "maxWaitTime": {
                        "title": "Maximum Wait Time",
                        "type": "integer",
                        "description": "Maximum time in seconds to wait between operations.",
                        "default": 30
                    },
                    "webHookUrls": {
                        "title": "Webhook Urls",
                        "type": "array",
                        "description": "A list of webhook URLs to be called upon completion.",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
