# LinkedIn Company Posts Scraper (`api_massta/linkedin-posts-scraper`) Actor

Extract posts from any LinkedIn company page — text, date, reactions, comments, shares. Track competitors, monitor brands, feed AI pipelines. Accepts URLs or slugs in bulk. Batch or real-time API. Pay-per-result.

- **URL**: https://apify.com/api\_massta/linkedin-posts-scraper.md
- **Developed by:** [Sh0ck Labs](https://apify.com/api_massta) (community)
- **Categories:** Jobs, Lead generation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 record scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#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

## LinkedIn Company Posts Scraper & API 📢

**Extract posts and updates from any LinkedIn company page — post text, date, reactions count, comments count, and shares count.** Track competitor content strategies, monitor brand messaging, analyze engagement, or give your AI agents live company content data.

Pass a company URL or a plain slug (`google`, `microsoft`) and get back clean structured JSON with the most recent posts. Run it as a one-off batch job, schedule it, or turn it into a **real-time API** your apps and AI agents can call.

***

### ✨ What you get

- 📢 **Full post data** — text content, post URL, and unique post ID
- 📅 **Timestamps** — when each post was published (ISO 8601)
- 📊 **Engagement metrics** — reactions, comments, and shares count per post
- 🔢 **Bulk lookups** — fetch posts from multiple companies in one run
- 🔗 **Flexible input** — full LinkedIn company URLs *or* bare slugs
- 🤖 **Real-time API + MCP** — call it live from your code or from AI agents
- 💸 **Pay only for results** — billed per post returned

***

### 🎯 Use cases

- **Competitive intelligence** — track what competitors are posting, how often, and what gets engagement.
- **Content strategy & benchmarking** — analyze top-performing post formats, topics, and posting cadence across your industry.
- **Brand monitoring** — keep a structured log of a company's public messaging over time.
- **Social selling & sales triggers** — detect product launches, hiring announcements, and partnerships from company posts.
- **AI agents & RAG pipelines** — give LLM apps fresh company content data on demand via the Apify MCP server.

***

### 📥 Input

| Field | Description |
|---|---|
| `companies` | LinkedIn companies to fetch posts from — full URLs or slugs. **Required.** |
| `limit` | Max posts per company (1-100, default 50). |
| `cookies` | LinkedIn session cookies (JSON export). **Required** — there is no public API for company posts. |
| `proxy` | Proxy configuration (recommended). |
| `timeout` | Seconds before the run gives up. |

```json
{
  "companies": ["google", "microsoft"],
  "limit": 20,
  "cookies": [{"name": "li_at", "value": "...", "domain": ".linkedin.com", "path": "/"}]
}
```

### 📤 Output

One record per post:

```json
{
  "post_id": "7312345678901234567",
  "post_url": "https://www.linkedin.com/feed/update/urn:li:share:7312345678901234567/",
  "company_slug": "google",
  "text": "We're excited to announce our latest advancement in AI...",
  "posted_at": "2026-06-20T14:30:00+00:00",
  "reactions_count": 4523,
  "comments_count": 312,
  "shares_count": 187
}
```

***

### 🤖 Use it as a real-time API / AI agent tool

Enable **Standby mode** and the Actor stays warm, answering HTTP requests instantly:

```bash
curl -X POST "https://<your-standby-url>/" \
  -H "Content-Type: application/json" \
  -d '{"company": "google", "limit": 10, "cookies": [...]}'
```

Returns `{ "count": N, "items": [ ... ] }`. AI agents can discover and call this Actor as a tool through the **[Apify MCP server](https://mcp.apify.com)** (Claude, Cursor, Windsurf, and any MCP client).

***

### 💸 Pricing

This Actor uses **pay-per-event** pricing: you're billed **per post returned** (`post-result`). Empty results aren't charged. You also pay Apify's standard platform usage for the run.

***

### 🍪 How to get LinkedIn cookies

Cookies are **required** for this Actor — LinkedIn does not expose company posts without authentication. Here's how to export them:

1. **Install a cookie-export extension** — [Cookie-Editor](https://cookie-editor.com/) (Chrome/Firefox/Edge) or [EditThisCookie](https://www.editthiscookie.com/) work well.
2. **Log into LinkedIn** at `https://www.linkedin.com` in your browser.
3. **Open the extension** and click **Export** (choose JSON format). This copies all LinkedIn cookies to your clipboard.
4. **Paste the JSON** into the `cookies` input field in this Actor.

> **Tip:** The key cookie is `li_at`. If you prefer a minimal setup, you can pass just that one:
>
> ```json
> [{"name": "li_at", "value": "YOUR_LI_AT_VALUE", "domain": ".linkedin.com", "path": "/"}]
> ```

> **Note:** Session cookies expire periodically. If you get authentication errors, re-export fresh cookies.

***

### ❓ FAQ

**Why are cookies required?**
LinkedIn does not expose company posts through a public/guest API (unlike job listings). The scraper uses LinkedIn's internal Voyager API, which requires an authenticated session.

**How do I get LinkedIn cookies?**
Use a browser extension like "Cookie-Editor" or "EditThisCookie" to export your LinkedIn session cookies as JSON. The key cookie is `li_at`.

**How many posts can I get?**
Up to ~100 most recent posts per company per request. For historical data beyond that, run multiple times with different date ranges (not currently supported — feature in backlog).

**Can my AI agent call this automatically?**
Yes — run it in Standby mode and connect via the Apify MCP server. Pass cookies in the request body.

**Is scraping LinkedIn legal?**
You are responsible for how you use scraped data. Comply with LinkedIn's terms and applicable laws in your jurisdiction.

***

### 🔧 Tips

- Use the **Apify Proxy** (especially residential) for larger runs to reduce blocking.
- Combine with the **LinkedIn Company Profile Scraper** for firmographic context alongside post content.
- Combine with the **LinkedIn Jobs Scraper** to correlate hiring activity with content strategy.

# Actor input Schema

## `companies` (type: `array`):

LinkedIn companies whose posts you want to fetch. Each item can be a full company URL (https://www.linkedin.com/company/google) or just the slug ('google'). Add several to fetch posts from multiple companies in one run.

## `limit` (type: `integer`):

Maximum number of posts to return per company. LinkedIn's API returns up to ~100 most recent posts per request.

## `cookies` (type: `array`):

Your LinkedIn session cookies (JSON export). Required — LinkedIn does not expose company posts without authentication.

## `proxy` (type: `object`):

Proxy used for requests. Recommended to reduce blocking.

## `timeout` (type: `integer`):

Seconds before the run gives up, to avoid getting stuck.

## Actor input object example

```json
{
  "companies": [
    "google",
    "https://www.linkedin.com/company/microsoft"
  ],
  "limit": 50,
  "proxy": {
    "useApifyProxy": true
  },
  "timeout": 300
}
```

# Actor output Schema

## `posts` (type: `string`):

One object per company post with fields like post\_id, post\_url, text, posted\_at, reactions\_count, comments\_count, and shares\_count.

# 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 = {
    "companies": [
        "google"
    ],
    "limit": 50,
    "proxy": {
        "useApifyProxy": true
    },
    "timeout": 300
};

// Run the Actor and wait for it to finish
const run = await client.actor("api_massta/linkedin-posts-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 = {
    "companies": ["google"],
    "limit": 50,
    "proxy": { "useApifyProxy": True },
    "timeout": 300,
}

# Run the Actor and wait for it to finish
run = client.actor("api_massta/linkedin-posts-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 '{
  "companies": [
    "google"
  ],
  "limit": 50,
  "proxy": {
    "useApifyProxy": true
  },
  "timeout": 300
}' |
apify call api_massta/linkedin-posts-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,api_massta/linkedin-posts-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/6dc8kkT7v9MbocZQm/builds/dQ4zJYXmIixTIgqlL/openapi.json
