# 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
- **Features:** Limited permissions
- **Stats:** 164 total users, 103 monthly users, 100.0% runs succeeded, 10 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.01 / 1,000 post scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## 📝 LinkedIn Posts API | Scrape Profile Posts & Engagement

The **LinkedIn Posts API** turns public [LinkedIn](https://www.linkedin.com) posts into clean, structured JSON. Use this actor with Claude, Cursor, or any MCP-compatible AI agent to collect post text, reactions, comments, media, hashtags, and author details from LinkedIn's public pages, billed per post.

Give it a person or company URL and it returns the recent posts LinkedIn shows publicly, or give it specific post URLs to fetch directly. It works as a straightforward **LinkedIn posts scraper** for content research, post engagement analysis, and social listening, and it is built API-first and MCP-ready so AI agents can call it as a tool.

***

### 🧩 Part of the Alpha OSINT LinkedIn suite: no login, no cookies

Eight Actors that read only what LinkedIn shows to a signed-out visitor. None of them asks for your account, your password or an `li_at` session cookie, so none of them can get your LinkedIn account restricted. Each one takes what the previous one returns, so you can chain them into a full people-and-company workflow:

| Step | You want to | Use |
|---|---|---|
| 1 | Find people by name, job title, company, school or location, no profile URL needed | [LinkedIn People Search API](https://apify.com/johnvc/linkedin-people-search-api?fpr=9n7kx3) |
| 2 | Turn profile URLs into full structured profiles: experience, education, followers | [LinkedIn Profile API](https://apify.com/johnvc/linkedin-profile-api?fpr=9n7kx3) |
| 3 | Enrich the employer: industry, size, headquarters, specialties, follower count | [LinkedIn Company API](https://apify.com/johnvc/linkedin-company-api?fpr=9n7kx3) |
| 4 | List the people who work at a company, each checked against their public profile | [LinkedIn Company Employees API](https://apify.com/johnvc/linkedin-company-employees-api?fpr=9n7kx3) |
| 5 | See what a company is hiring for, with salary data where LinkedIn publishes it | [LinkedIn Jobs API](https://apify.com/johnvc/linkedin-jobs-api?fpr=9n7kx3) |
| 6 | Search jobs as a guest with filters, total result counts and autocomplete ids | [LinkedIn Job Scraper](https://apify.com/johnvc/linkedin-job-search-scraper?fpr=9n7kx3) |
| 7 | Read what a person or company posts, with reactions and comments | **LinkedIn Posts API** (this Actor) |
| 8 | Map the skills people list to courses, learner reviews and full syllabi | [LinkedIn Learning API](https://apify.com/johnvc/linkedin-learning-api?fpr=9n7kx3) |

A worked map of these chains, with live adoption and success-rate stats for every Actor, is at [alphaosint.com/linkedin](https://alphaosint.com/linkedin/).

### 📋 What this API returns

| Field | Description |
|---|---|
| `postUrl`, `postId` | The post's public URL and identifier. |
| `postType` | The kind of post: post, repost (quotes or reshares another post), video, document, or article. |
| `datePosted` | When the post was published, as an exact ISO 8601 timestamp. |
| `title`, `text` | The post title (for articles) and body text. |
| `hashtags` | Hashtags used in the post. |
| `authorName`, `authorHeadline`, `authorUrl` | Who posted it (display name), their headline and profile URL. |
| `authorFollowers`, `authorType` | Author audience size and person/company type. |
| `numLikes`, `numComments` | 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. |
| `resharedPost`, `document` | The post it quotes or reshares, and any document or carousel attached. |
| `isRepost`, `isInfluencer` | Company feeds: whether the company reposted someone else's post; whether LinkedIn marks the author as an Influencer. |
| `fromCache` | True when the row came from the shared cache (see below). |
| `summary` | A plain-language one-line interpretation of the post. |

#### Sources and limits

Everything comes from LinkedIn's public pages, the ones a signed-out visitor sees:

- **Post URLs:** the post's own public page. Full text, reactions, comments shown to visitors, mentions, images, video and documents.
- **Person profile URLs:** the recent posts the public profile shows, usually 3 to 8. That is all LinkedIn shows a signed-out visitor, so a profile can return fewer posts than `maxPostsPerProfile`.
- **Company page URLs:** the company's public feed, newest first, up to about 70 recent updates.

Not available: share and repost counts (`numShares`), which LinkedIn does not show signed-out visitors. Dates are exact, read from the post's own id.

***

### 🎯 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 and comments across your own posts.
- **AI agent workflows.** Drive this API over MCP from Claude to fetch and summarize posts in-conversation.

***

### 🔁 Use it as a LinkedIn posts scraper at scale

Point this LinkedIn posts scraper at a profile or a company page and it returns their recent posts, one clean row each, with the same flat fields every time, which is what makes the output easy to load into a sheet, a database, or a BI tool. Cap each profile with `maxPostsPerProfile` so a large run never overshoots your budget, and narrow discovery with `startDate` and `endDate` to a specific window.

Every row carries the **post engagement** you care about: reactions and comments, alongside the post text, hashtags, and author details. That makes it a ready source for content research, tracking a creator or brand, and finding the highest-engagement **influencer posts**. If a profile has no public posts, you get a clear error row instead of a failed run, so one empty profile never sinks the batch.

***

### ⚙️ 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"
}
```

#### Read a company's feed

```json
{
  "profileUrls": ["https://www.linkedin.com/company/apify"],
  "maxPostsPerProfile": 50,
  "includeReposts": false
}
```

#### 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. Set `includeReposts` to also get posts a company reposted from other authors.

#### Freshness and the shared cache

Recently fetched posts are kept in a shared cache for a short time: posts for up to 3 days, company feed pages for up to 6 hours. A request inside that window is served from the cache, and the row says `"fromCache": true` with `fetched_at` set to the original fetch time. A post or feed page older than its window is fetched fresh. To have a cached post removed, [open an issue](https://apify.com/johnvc/linkedin-posts-api/issues/open?fpr=9n7kx3).

***

### 📤 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": "Bill Gates",
  "authorHeadline": "Chair, Gates Foundation and Founder, Breakthrough Energy",
  "authorUrl": "https://www.linkedin.com/in/williamhgates",
  "authorType": "Person",
  "numLikes": 12045,
  "numComments": 843,
  "videos": [],
  "fromCache": false,
  "summary": "Post by Bill Gates, 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 the LinkedIn Posts 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."*

***

### 💸 Pay per run with crypto (x402)

The LinkedIn Posts API supports agentic payments via the [x402 protocol](https://docs.apify.com/platform/integrations/x402).
AI agents and MCP clients can pay for runs in USDC (on Base) with no Apify account or API token needed:
point your agent at the [Apify MCP server](https://mcp.apify.com/?tools=actors,docs,johnvc/linkedin-posts-api) and it can
discover, pay for, and run this Actor autonomously. Read the
[Apify x402 announcement](https://apify.com/change-log/pay-for-apify-actors-with-x402?fpr=9n7kx3) for details.

### 🔌 Integrations: track post engagement on a schedule

This API earns its keep as a recurring step in a pipeline, not a one-off run:

- **Tasks and Schedules.** Save a set of profile URLs as a Task, then attach a Schedule to pull new posts and their engagement daily, weekly, or monthly with no code.
- **n8n, Make, and Zapier.** Trigger a run on a schedule, then route new posts into a content dashboard, a Slack channel, or your CRM. Apify has native connectors for each.
- **Supabase, Google Sheets, and databases.** Send the dataset straight to storage with a webhook or the Apify API so the rows land where your team already works.
- **MCP.** Call the API as a tool from Claude and other AI agents (see the section above) to fetch and summarize posts inside an agent workflow.
- **Webhooks.** Fire a webhook on run completion to kick off the next step in your own system, such as scoring the most-engaged posts.

***

### 🔗 Related Tools

Build a full picture of a person, their posts, and where they work by pairing this with the rest of the LinkedIn suite:

- [LinkedIn Profile API](https://apify.com/johnvc/linkedin-profile-api?fpr=9n7kx3) - structured profile data on the people whose posts you collect.
- [LinkedIn Company API](https://apify.com/johnvc/linkedin-company-api?fpr=9n7kx3) - firmographics for the companies behind the authors.
- [LinkedIn Jobs API](https://apify.com/johnvc/linkedin-jobs-api?fpr=9n7kx3) - open roles by keyword and location, a companion hiring signal.
- [LinkedIn Learning API](https://apify.com/johnvc/linkedin-learning-api?fpr=9n7kx3) - public course data, ratings and syllabus for the topics an author posts about.
- [YouTube Download API](https://apify.com/johnvc/youtube-download-api?fpr=9n7kx3): archive the YouTube videos that the creators you track share in their posts.

Comparison point: many LinkedIn posts tools on the Store cover only one slice of engagement (for example [harvestapi/linkedin-post-reactions](https://apify.com/harvestapi/linkedin-post-reactions?fpr=9n7kx3), reactions only). This API returns the full post, text, reactions, and comments, in one row, with pay-per-post billing and MCP access from AI agents.

***

### 📎 Applications

Ready-made task pages for common jobs. Open one, run it, or duplicate it as a starting point:

#### [Scrape LinkedIn Posts to Structured JSON](https://apify.com/johnvc/linkedin-posts-api/examples/scrape-linkedin-posts-to-structured-json?fpr=9n7kx3)

Turn a profile URL into clean JSON: post text, reactions, comments, date, and author, newest first.

#### [Track a Profile's LinkedIn Posts](https://apify.com/johnvc/linkedin-posts-api/examples/track-a-profile-s-linkedin-posts?fpr=9n7kx3)

Pull a profile's recent posts on a schedule, filtered to a date range.

#### [Analyze LinkedIn Post Engagement](https://apify.com/johnvc/linkedin-posts-api/examples/analyze-linkedin-post-engagement?fpr=9n7kx3)

Get reactions, comments, author, and follower count per post, ready for a dashboard.

#### [Collect Influencer Posts from LinkedIn](https://apify.com/johnvc/linkedin-posts-api/examples/collect-influencer-posts-from-linkedin?fpr=9n7kx3)

Pull a creator's recent posts with reach and engagement for influencer research.

#### [LinkedIn Posts Data API for Python](https://apify.com/johnvc/linkedin-posts-api/examples/linkedin-posts-data-api-for-python?fpr=9n7kx3)

Call the API from Python: a profile URL in, structured posts out.

#### [Scrape LinkedIn Posts in an n8n Workflow](https://apify.com/johnvc/linkedin-posts-api/examples/scrape-linkedin-posts-in-an-n8n-workflow?fpr=9n7kx3)

Add post data to an n8n workflow: pass profile URLs, get structured rows back.

#### [Get LinkedIn Posts in Claude via MCP](https://apify.com/johnvc/linkedin-posts-api/examples/get-linkedin-posts-in-claude-via-mcp?fpr=9n7kx3)

Use posts as a tool in Claude and other AI agents over MCP.

#### [Fetch Specific LinkedIn Posts by URL](https://apify.com/johnvc/linkedin-posts-api/examples/fetch-specific-linkedin-posts-by-url?fpr=9n7kx3)

Paste up to 1000 post URLs and get one clean row each.

***

### 🚀 How to get started

1. Open the Actor and paste one or more LinkedIn profile or company 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)

**Example code:** [Python quick-start + MCP setup on GitHub](https://github.com/johnisanerd/Apify-LinkedIn-Posts-API) - call the API from Python, or install it as a tool in Claude, Cursor, and ChatGPT.

***

### 🤖 Ask an AI assistant about this API

Open a ready-to-send prompt about the LinkedIn Posts API in the AI of your choice:

- 💬 [ChatGPT](https://chatgpt.com/?q=Using%20the%20LinkedIn%20Posts%20API%20on%20Apify%20%28https://apify.com/johnvc/linkedin-posts-api?fpr=9n7kx3%29%2C%20walk%20me%20through%20this%20use%20case:%20%22Scrape%20LinkedIn%20Posts%20to%20Structured%20JSON%22.%20Show%20me%20the%20input%20JSON%2C%20the%20output%20fields%2C%20and%20how%20to%20automate%20it%20with%20the%20API%20or%20MCP.)
- 🧠 [Claude](https://claude.ai/new?q=Using%20the%20LinkedIn%20Posts%20API%20on%20Apify%20%28https://apify.com/johnvc/linkedin-posts-api?fpr=9n7kx3%29%2C%20walk%20me%20through%20this%20use%20case:%20%22Scrape%20LinkedIn%20Posts%20to%20Structured%20JSON%22.%20Show%20me%20the%20input%20JSON%2C%20the%20output%20fields%2C%20and%20how%20to%20automate%20it%20with%20the%20API%20or%20MCP.)
- 🔍 [Perplexity](https://www.perplexity.ai/search?q=Using%20the%20LinkedIn%20Posts%20API%20on%20Apify%20%28https://apify.com/johnvc/linkedin-posts-api?fpr=9n7kx3%29%2C%20walk%20me%20through%20this%20use%20case:%20%22Scrape%20LinkedIn%20Posts%20to%20Structured%20JSON%22.%20Show%20me%20the%20input%20JSON%2C%20the%20output%20fields%2C%20and%20how%20to%20automate%20it%20with%20the%20API%20or%20MCP.)
- 🅒 [Copilot](https://copilot.microsoft.com/?q=Using%20the%20LinkedIn%20Posts%20API%20on%20Apify%20%28https://apify.com/johnvc/linkedin-posts-api?fpr=9n7kx3%29%2C%20walk%20me%20through%20this%20use%20case:%20%22Scrape%20LinkedIn%20Posts%20to%20Structured%20JSON%22.%20Show%20me%20the%20input%20JSON%2C%20the%20output%20fields%2C%20and%20how%20to%20automate%20it%20with%20the%20API%20or%20MCP.)

### ❓ FAQ

#### Will this put my LinkedIn or LinkedIn Recruiter account at risk?

No. It reads public LinkedIn pages only, the ones anyone can open while signed out. It never logs in and never asks for your cookies: there is no input for an account, a password or an `li_at` session cookie. Nothing it does is tied to your LinkedIn account, your LinkedIn Recruiter seat or your Sales Navigator license. The requests run on Apify's servers, not in your browser, so nothing connects them to you, and you can keep working in Recruiter while a run is going.

#### Do I need to give you my LinkedIn cookies or login?

No, never. This Actor does not ask for, accept or store your LinkedIn cookies, your session cookie (`li_at`), your password or your account. There is no input field for any of them. It reads LinkedIn's public pages the way a signed-out visitor sees them. Any cookie involved is one LinkedIn's site hands to that anonymous visit, and it is used only inside that single run.

#### Is this a LinkedIn Posts API or a LinkedIn posts scraper?

Both descriptions fit. You call it like an API (a profile or post URL in, structured JSON out), and under the hood it is a LinkedIn posts scraper that reads LinkedIn's public pages. You never touch scraping infrastructure; you get clean, one-row-per-post data back.

#### What input should I provide?

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

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

Up to `maxPostsPerProfile` (default 20, up to 200), limited by what LinkedIn shows a signed-out visitor: a person's public profile shows only their few most recent posts (usually 3 to 8), and a company feed goes back about 70 updates. 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 and comment counts, plus a sample of the most visible comments, so the output doubles as post engagement data. Share counts are not shown on LinkedIn's public pages, so they are not included.

#### Is it legal to scrape public LinkedIn posts?

This actor collects only public post data. Public-data scraping has been addressed in court cases such as [hiQ Labs v. LinkedIn](https://en.wikipedia.org/wiki/HiQ_Labs_v._LinkedIn), but you are responsible for your own use, including [GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation) and platform terms. Consult your own counsel for your use case.

#### Can I run it from Claude or another AI agent over MCP?

Yes. The Actor is MCP-server-compatible, so [Claude Code](https://claude.ai/referral/uIlpa7nPLg) (free trial) and other MCP clients call it as a tool. See the MCP section above for the setup URL.

#### Can I schedule it or connect it to my other apps?

Yes. Save your profile URLs as a Task and attach a Schedule for recurring runs, and connect the output to n8n, Make, Zapier, Supabase, or your own system by webhook. See the Integrations section above.

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

***

### 🧠 Claude skill: find the hiring manager

This API is one of the data sources in a ready-made Claude skill. Give the skill one job posting and it returns the likely hiring manager, the recruiter, and the best people to ask for a referral, each with evidence and an outreach draft you send yourself.

- Skill repo: [claude-skill-find-hiring-manager](https://github.com/johnisanerd/claude-skill-find-hiring-manager)

```bash
npx skills add johnisanerd/claude-skill-find-hiring-manager
```

### 🌐 About Alpha OSINT

This Actor is part of [Alpha OSINT](https://www.alphaosint.com), toolset of financial and operations data sources and APIs.
See the [LinkedIn Posts API source page](https://www.alphaosint.com/sources/linkedin-posts-api/) for related tools and use cases.
For support or requests for this actor, please start a ticket [directly on our support page](https://apify.com/johnvc/linkedin-posts-api/issues/open?fpr=9n7kx3).

Last Updated: 2026.10.27

# Actor input Schema

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

One or more LinkedIn person profile URLs (https://www.linkedin.com/in/williamhgates) or company page URLs (https://www.linkedin.com/company/apify). A person URL returns the recent posts their public profile shows (usually 3 to 8). A company URL returns its public feed, newest first, up to about 70 recent updates. Both stop at Max posts per profile. Other URL types 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 or company URL (discover mode). Caps cost. A person's public profile shows only a few recent posts and a company feed about 70, so fewer may come back. Ignored for specific post URLs.

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

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

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

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

## `includeReposts` (type: `boolean`):

Company feeds only: also return posts by other authors that the company reposted without comment. Each such row has isRepost set to true. Off by default.

## Actor input object example

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

# 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(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 '{
  "profileUrls": [
    "https://www.linkedin.com/in/williamhgates"
  ]
}' |
apify call johnvc/linkedin-posts-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,johnvc/linkedin-posts-api"
        }
    }
}
```

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/P9ArUDJDSgHTmYzDp/builds/pegsbe95VAJw9Nahf/openapi.json
