# LinkedIn Posts API | Scrape Profile Posts & Engagement (`johnvc/linkedin-posts-api`) Actor

Collect public LinkedIn posts as clean, structured JSON. Discover every post from a profile URL, or fetch specific post URLs, with text, reactions, comments, shares, media, hashtags, and author details. Pay per post, MCP-ready for Claude and AI agents.

- **URL**: https://apify.com/johnvc/linkedin-posts-api.md
- **Developed by:** [John](https://apify.com/johnvc) (community)
- **Categories:** Social media, Lead generation, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

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/platform/actors/running/actors-in-store#pay-per-event

## 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 Posts API | Scrape Profile Posts & Engagement

Collect public [LinkedIn](https://www.linkedin.com) posts as clean, structured JSON. Use this actor with Claude, Cursor, or any MCP-compatible AI agent to scrape post text, reactions, comments, shares, media, hashtags, and author details, billed per post.

Give it a profile URL and it discovers that person's recent posts, or give it specific post URLs to fetch directly. Built API-first and MCP-ready so AI agents can call it as a tool.

---

### 📋 What this API returns

| Field | Description |
|---|---|
| `postUrl`, `postId` | The post's public URL and identifier. |
| `postType` | The kind of post (post, article, repost). |
| `datePosted` | When the post was published. |
| `title`, `text` | The post title (for articles) and body text. |
| `hashtags` | Hashtags used in the post. |
| `authorName`, `authorHeadline`, `authorUrl` | Who posted it and their headline / profile URL. |
| `authorFollowers`, `authorType` | Author audience size and person/company type. |
| `numLikes`, `numComments`, `numShares` | Engagement counts. |
| `images`, `videos`, `embeddedLinks` | Media and links attached to the post. |
| `taggedCompanies`, `taggedPeople` | Entities tagged in the post. |
| `topComments` | A sample of the most visible comments. |
| `summary` | A plain-language one-line interpretation of the post. |

---

### 🎯 Use cases

- **Content research.** Pull a creator's or brand's recent posts to study what performs.
- **Competitive monitoring.** Track a competitor's LinkedIn posts and engagement over time.
- **Social listening.** Collect posts and their reactions and comments for sentiment and trend analysis.
- **Lead generation.** Find the most-engaged posts from target accounts to spot warm prospects.
- **Personal brand analytics.** Measure reactions, comments, and shares across your own posts.
- **AI agent workflows.** Drive this API over MCP from Claude to fetch and summarize posts in-conversation.

---

### ⚙️ Input examples

#### Discover a profile's posts

```json
{
  "profileUrls": ["https://www.linkedin.com/in/williamhgates"],
  "maxPostsPerProfile": 20
}
````

#### Limit discovery to a date range

```json
{
  "profileUrls": ["https://www.linkedin.com/in/williamhgates"],
  "maxPostsPerProfile": 50,
  "startDate": "2025-01-01",
  "endDate": "2025-12-31"
}
```

#### Fetch specific posts by URL

```json
{
  "postUrls": [
    "https://www.linkedin.com/posts/williamhgates_activity-7446904645010210816"
  ]
}
```

`maxPostsPerProfile` caps how many posts are returned per profile, so you control cost. The API returns one row per post.

***

### 📤 Example output

Each post is returned as one JSON row:

```json
{
  "result_type": "post",
  "postId": "7446904645010210816",
  "postUrl": "https://www.linkedin.com/posts/williamhgates_activity-7446904645010210816",
  "postType": "post",
  "datePosted": "2025-06-01T12:00:00.000Z",
  "text": "A few books shaped how I think about clean energy this year...",
  "hashtags": ["cleanenergy", "books"],
  "authorName": "williamhgates",
  "authorHeadline": "Co-chair, Bill & Melinda Gates Foundation",
  "authorUrl": "https://www.linkedin.com/in/williamhgates",
  "numLikes": 12045,
  "numComments": 843,
  "numShares": 210,
  "summary": "Post by williamhgates, 12,045 reactions, 843 comments, posted 2025-06-01"
}
```

***

### 💰 Pricing (pay-per-event)

You pay per post returned. There is no per-run setup fee. The current per-event price is shown on the Store card and in the Actor's Monetization details. Because billing is per post, you only pay for the posts actually delivered, and `maxPostsPerProfile` lets you cap the volume of each run.

***

### 🔌 Use this API from Claude (MCP)

This Actor is MCP-server-compatible, so [Claude Code](https://claude.ai/referral/uIlpa7nPLg) (free trial), Claude (desktop and web), Cursor, and other MCP clients can call it as a tool through Apify's hosted MCP server.

Add it with this Actor-specific URL:

`https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api`

Apify MCP integration docs: https://docs.apify.com/platform/integrations/mcp

Setup walkthrough:

https://www.youtube.com/watch?v=jREWahDGhJM

**New to Claude Code or Claude Cowork?** Start a [free trial](https://claude.ai/referral/uIlpa7nPLg).

Then ask Claude:

> *"Use the LinkedIn Posts API to pull Bill Gates's last 10 posts and summarize which got the most engagement."*

***

### 🚀 How to get started

1. Open the Actor and paste one or more LinkedIn profile URLs into `profileUrls` (or post URLs into `postUrls`).
2. Set `maxPostsPerProfile` to bound the volume, then run it and read the results from the dataset (JSON, CSV, Excel, or API).

[View on Apify Store](https://apify.com/johnvc/linkedin-posts-api?fpr=9n7kx3)

***

### ❓ FAQ

#### What input should I provide?

A public LinkedIn profile URL (e.g. `https://www.linkedin.com/in/williamhgates`) to discover its posts, and/or specific post URLs to fetch directly.

#### How many posts do I get per profile?

As many as `maxPostsPerProfile` (default 20). Newest posts are returned first, and you can narrow the range with `startDate` and `endDate`.

#### Do you return comment and reaction counts?

Yes. Each post row includes reaction, comment, and share counts, plus a sample of the most visible comments.

#### What if a profile has no public posts?

The API returns a clear error row for that profile explaining why, so one empty profile does not fail the whole run.

***

Last Updated: 2026.07.07

# Actor input Schema

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

One or more LinkedIn profile URLs, e.g. https://www.linkedin.com/in/williamhgates. The API discovers and returns that profile's recent posts (newest first), up to Max posts per profile. Non-/in/ profile URLs are skipped. Up to 25 per run. Need larger batches? Contact us and we can raise this limit for your account.

## `postUrls` (type: `array`):

One or more specific LinkedIn post URLs, e.g. https://www.linkedin.com/posts/...-activity-1234567890 or https://www.linkedin.com/feed/update/urn:li:activity:1234567890. Each returns one row. Up to 1000 per run. Need larger batches? Contact us and we can raise this limit for your account.

## `maxPostsPerProfile` (type: `integer`):

Maximum number of posts to return for each profile URL (discover mode). Caps upstream cost. Ignored for specific post URLs.

## `startDate` (type: `string`):

Only discover posts on or after this date (YYYY-MM-DD). Applies to profile discovery only.

## `endDate` (type: `string`):

Only discover posts on or before this date (YYYY-MM-DD). Applies to profile discovery only.

## Actor input object example

```json
{
  "profileUrls": [
    "https://www.linkedin.com/in/williamhgates"
  ],
  "maxPostsPerProfile": 20,
  "startDate": "2025-01-01",
  "endDate": "2025-12-31"
}
```

# Actor output Schema

## `allResults` (type: `string`):

Every dataset item from this run: collected posts and any error rows.

## `overview` (type: `string`):

Tabular overview of every dataset item using the dataset schema's default view. Columns: type, author, text, reactions, comments, posted, URL, summary.

## `engagement` (type: `string`):

Author reach and reactions/comments/shares per post.

# 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 = {
    "profileUrls": [
        "https://www.linkedin.com/in/williamhgates"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("johnvc/linkedin-posts-api").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 = { "profileUrls": ["https://www.linkedin.com/in/williamhgates"] }

# Run the Actor and wait for it to finish
run = client.actor("johnvc/linkedin-posts-api").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 '{
  "profileUrls": [
    "https://www.linkedin.com/in/williamhgates"
  ]
}' |
apify call johnvc/linkedin-posts-api --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "LinkedIn Posts API | Scrape Profile Posts & Engagement",
        "description": "Collect public LinkedIn posts as clean, structured JSON. Discover every post from a profile URL, or fetch specific post URLs, with text, reactions, comments, shares, media, hashtags, and author details. Pay per post, MCP-ready for Claude and AI agents.",
        "version": "0.0",
        "x-build-id": "EhlYGK3J7VvS8BV9D"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/johnvc~linkedin-posts-api/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-johnvc-linkedin-posts-api",
                "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/johnvc~linkedin-posts-api/runs": {
            "post": {
                "operationId": "runs-sync-johnvc-linkedin-posts-api",
                "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/johnvc~linkedin-posts-api/run-sync": {
            "post": {
                "operationId": "run-sync-johnvc-linkedin-posts-api",
                "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",
                "properties": {
                    "profileUrls": {
                        "title": "Profile URLs (discover posts)",
                        "maxItems": 25,
                        "type": "array",
                        "description": "One or more LinkedIn profile URLs, e.g. https://www.linkedin.com/in/williamhgates. The API discovers and returns that profile's recent posts (newest first), up to Max posts per profile. Non-/in/ profile URLs are skipped. Up to 25 per run. Need larger batches? Contact us and we can raise this limit for your account.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "postUrls": {
                        "title": "Post URLs (fetch specific posts)",
                        "maxItems": 1000,
                        "type": "array",
                        "description": "One or more specific LinkedIn post URLs, e.g. https://www.linkedin.com/posts/...-activity-1234567890 or https://www.linkedin.com/feed/update/urn:li:activity:1234567890. Each returns one row. Up to 1000 per run. Need larger batches? Contact us and we can raise this limit for your account.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxPostsPerProfile": {
                        "title": "Max posts per profile",
                        "minimum": 1,
                        "maximum": 200,
                        "type": "integer",
                        "description": "Maximum number of posts to return for each profile URL (discover mode). Caps upstream cost. Ignored for specific post URLs.",
                        "default": 20
                    },
                    "startDate": {
                        "title": "Start date",
                        "type": "string",
                        "description": "Only discover posts on or after this date (YYYY-MM-DD). Applies to profile discovery only."
                    },
                    "endDate": {
                        "title": "End date",
                        "type": "string",
                        "description": "Only discover posts on or before this date (YYYY-MM-DD). Applies to profile discovery only."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
