# LinkedIn Post Search API — Keywords, Authors & Mentions (`gauravlabs/linkedin-post-search-api`) Actor

Search LinkedIn posts by keyword, company, author industry and mentions. Export text, author links and available engagement counts. Private preview: up to 100 posts per search; no pagination.

- **URL**: https://apify.com/gauravlabs/linkedin-post-search-api.md
- **Developed by:** [Gaurav Kumar Choudhary](https://apify.com/gauravlabs) (community)
- **Categories:** Social media, Marketing, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 post 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/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 Post Search Scraper & API

### At a glance

- Collect: Keyword/author/company-filtered LinkedIn post search with available engagement and media metadata.
- Input: use the runnable example below or the prefilled Input form.
- Output: the default dataset supports JSON/CSV/Excel export; see output modes below.
- Billing: $2 per 1,000 unique delivered posts, including usable media-only posts. Empty/excluded results are not result charges. No startup fee. Platform usage may be additional.
- Limits: One search request, at most 100 saved posts, no cursor pagination. Media links may expire; no media downloads.

Find LinkedIn posts for brand monitoring, content research and company updates.
Search a phrase and optionally filter the
posting company, mentioned companies, author employers, industry or headline.
No LinkedIn account or cookies are requested in input. This independent tool is
not affiliated with LinkedIn.

### Why choose this Actor?

- Simple keyword input with company, author and mention filters for targeted research.
- Transparent $2-per-1,000-result billing with no startup fee.
- Unique post IDs and within-run deduplication make exported data easier to use.
- Caller-supplied exclusions help avoid collecting previously seen posts again.
- Structured output, missing-value handling and copy-and-paste API examples.

These are supported features, not a claim that this Actor is the cheapest or
most accurate competitor. Search coverage and text completeness vary.

### Pricing

$2 per 1,000 delivered unique post results ($0.002 per post), with no startup fee.
Duplicates, excluded posts, empty results and error summaries are not billed as
results. Pricing is the same across subscription tiers. Check the Apify pricing
panel for the active configuration. Source requests may return fewer posts than
requested. There is no complete-index guarantee. Within-run deduplication only;
there is no resume or cross-run double-charge guarantee.

### Quick start

1. Open the Input tab and enter your search phrase.
2. Choose the result limit and optional filters, then click Start.
3. Open the completed run's dataset to view results or export JSON, CSV or Excel.

```json
{"keywords":"generative AI","maxPosts":20,"maxServiceCredits":1,"sortBy":"Latest"}
```

One request returns up to the requested limit. The service supports 20, 40, 60,
80 or 100 posts per request. `maxPosts` rounds the fetched limit upward to the
next multiple of 20, then caps saved unique posts. Increase `maxServiceCredits`
to cover that limit. For example, 25 saved posts requests up to 40 and reserves
two operational credits. These estimates are not Apify customer prices.

You can request **20, 40, 60, 80 or 100 posts in one run**. These are maximum
fetch limits, not guaranteed delivery counts. Use operational budgets 1, 2, 3,
4 or 5 respectively. Smaller saved limits from 1 to 100 are also supported.

For up to 100 posts, use:

```json
{"keywords":"supply chain","maxPosts":100,"maxServiceCredits":5,"sortBy":"Latest"}
```

Twenty delivered posts cost $0.04; 100 cost $0.20 in Actor result charges.
Apify platform usage may be additional. Set `maxServiceCredits` to at least
`ceil(maxPosts / 20)`; this operational limit is not the customer billing unit.

### Call the API from Python

Install `requests`, then set the `APIFY_TOKEN` environment variable to your own
Apify token. No LinkedIn password is needed.

```python
import os
import requests

response = requests.post(
    "https://api.apify.com/v2/acts/gauravlabs~linkedin-post-search-api/run-sync-get-dataset-items",
    headers={"Authorization": f"Bearer {os.environ['APIFY_TOKEN']}"},
    json={
        "keywords": "generative AI",
        "maxPosts": 20,
        "maxServiceCredits": 1,
        "sortBy": "Latest",
    },
    timeout=200,
)
response.raise_for_status()
print(response.json())
```

This synchronous endpoint returns the completed run's dataset items. For longer
workflows, start a run asynchronously with Apify and retrieve its default dataset
after completion. Never place credentials in public code or support messages.

### Filter guide

| Field | Meaning |
| --- | --- |
| `keywords` | Required phrase to search. |
| `sortBy` | `Latest` or `Top match`. |
| `datePosted` | For example `Any time`, `Past week` or `Past month`. |
| `fromCompany` | Numeric IDs of companies publishing posts. |
| `mentioningCompany` | Numeric company IDs mentioned in posts. |
| `authorCompany`, `authorIndustry` | Filter authors by company or industry IDs. |
| `authorKeyword` | Keyword filter for author headlines. |
| `fromMember`, `mentioningMember` | ACo-style member identifiers, not profile URLs. |
| `excludePostIds` | Previously collected activity IDs to skip. |

Use the Input form for the complete list of supported content and date filters.

### Search Microsoft posts mentioning AI

```json
{"keywords":"AI","fromCompany":[1035],"datePosted":"Past month","maxPosts":20,"maxServiceCredits":1}
```

Company filters use numeric LinkedIn company IDs. Member filters require ACo-style
member identifiers, not profile URLs. The filters are passed to the source and
their matching accuracy must be evaluated before production use.

### Output

Each dataset row contains a unique activity ID, canonical LinkedIn post URL,
source text, query and collection timestamp. Available author names, author
headlines and links, posting-time text and content type are included. Likes,
comments and shares appear only when the source supplies numeric counts. Missing
counts are omitted, never replaced with zero. Text completeness and current
engagement accuracy are not guaranteed; this is search output, not an enrichment
endpoint. No individual comment or reaction records or image/video downloads
are included. Unknown response fields are not exported.

Required fields are `postId`, `postUrl`, `text`, `query`, `recordType` and
`fetchedAt`. Optional fields include `authorName`, `authorHeadline`, `authorUrl`,
`postedAt`, `contentType`, `likes`, `comments` and `shares`. `postedAt` preserves
source posting-time text; `fetchedAt` is collection time in UTC.

#### Example output

The following is an abbreviated, normalized example based on a supplied
response, not a newly collected post. `text` is shortened here for readability;
the actual row retains the supplied text. `fetchedAt` is added at runtime.

```json
{
  "postId": "7326436329808904192",
  "postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:7326436329808904192/",
  "text": "We’re proud to announce that our climate goals and our near term targets have officially been validated by the Science Based Targets initiative (SBTi)! ...",
  "query": "SBTi",
  "recordType": "post",
  "postedAt": "2025-05-09 02:42:19.000",
  "authorName": "Monika Shrivastava",
  "authorHeadline": "Head-Sustainability at JSW Cement",
  "authorUrl": "https://www.linkedin.com/in/monika-shrivastava-7545b11a",
  "contentType": "unknown",
  "likes": 74,
  "comments": 7
}
```

The supplied `num_shares: null` is omitted rather than misrepresented as zero.
This Actor normalizes the search response. Available `images`, `video` and `document` links/metadata are now included after HTTPS host validation; nested `original_post` is not exported.

### Limits and repeated searches

The documented endpoint has no pagination or cursor, so this Actor does not
pretend to collect all matching posts. It makes one request per run, saves at most
100 posts and does not retry automatically. Empty results are valid. Errors fail
the run with a sanitized code in SUMMARY. Credentials and raw errors are never
exported. Results are deduplicated within a run. To suppress previously seen
posts, supply their IDs in `excludePostIds`; you maintain that list yourself.
Empty-text posts are retained when validated media links are available; posts with neither useful text nor validated media are skipped and not billed.
Exclusions can reduce the saved count and do not trigger replacement requests.
There is no automatic cross-run monitoring, new-post alert or history store.

### Exports and integration

Use Apify's dataset export for JSON, CSV or Excel. Scheduling and integrations
such as n8n and Make are Apify platform features.
Use this only with appropriate access and redistribution permissions. Source
availability can change. For support, provide a run ID and non-sensitive input,
never API keys. This preview is not an uptime, complete-index or freshness promise.

### Minimal API example

Store your own Apify token in `APIFY_TOKEN`; never paste it into public input or code. This example uses the same small input as the prefilled form.

```python
import os
import requests

response = requests.post(
    "https://api.apify.com/v2/acts/gauravlabs~linkedin-post-search-api/run-sync-get-dataset-items",
    headers={"Authorization": "Bearer " + os.environ["APIFY_TOKEN"]},
    json={"keywords":"generative AI"},
    timeout=300,
)
response.raise_for_status()
print(response.json())
```

For large batches, start an asynchronous run with `/runs`, wait for its final status, and retrieve its default dataset. HTTP success when starting a run does not prove the extraction succeeded.

#### Minimal output shape (illustrative)

The following shows one documented field, not a fresh result or a promised yield. Inspect the output reference above for the complete schema.

```json
{
  "recordType": "post"
}
```

### Practical workflow and accuracy notes

Media-only posts with validated HTTPS LinkedIn media links are now usable results and can be charged as one delivered post. Missing engagement counts stay absent. Media URLs are metadata only; they can expire. Keyword searches remain a single request with no supported pagination cursor.

# Actor input Schema

## `keywords` (type: `string`):

One search phrase, up to 500 characters.

## `maxPosts` (type: `integer`):

One search only. Requests round up to a multiple of 20; fewer results may be returned.

## `maxServiceCredits` (type: `integer`):

At least ceil(maxPosts/20). An operational estimate, not customer pricing or a free quota.

## `sortBy` (type: `string`):

Request latest or top-match ordering.

## `datePosted` (type: `string`):

Optional source recency filter.

## `contentType` (type: `string`):

Optional source content-type filter.

## `fromCompany` (type: `array`):

Numeric LinkedIn company IDs; 1035 = Microsoft.

## `mentioningCompany` (type: `array`):

Numeric IDs of mentioned companies.

## `authorCompany` (type: `array`):

Filter by author employer company IDs.

## `authorIndustry` (type: `array`):

Filter by numeric author industry IDs.

## `fromMember` (type: `array`):

ACo-style identifiers, not profile URLs. Up to 20.

## `mentioningMember` (type: `array`):

ACo-style identifiers of mentioned members.

## `authorKeyword` (type: `string`):

Optional keyword filter for author headlines.

## `excludePostIds` (type: `array`):

Up to 1000 activity IDs. Caller-maintained exclusions; no automatic history or deeper fetching.

## `requestTimeoutSecs` (type: `integer`):

HTTP timeout; requests are not automatically retried.

## Actor input object example

```json
{
  "keywords": "generative AI",
  "maxPosts": 20,
  "maxServiceCredits": 1,
  "sortBy": "Latest",
  "datePosted": "Any time",
  "contentType": "Any type",
  "fromCompany": [],
  "mentioningCompany": [],
  "authorCompany": [],
  "authorIndustry": [],
  "fromMember": [],
  "mentioningMember": [],
  "authorKeyword": "",
  "excludePostIds": [],
  "requestTimeoutSecs": 60
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "keywords": "generative AI"
};

// Run the Actor and wait for it to finish
const run = await client.actor("gauravlabs/linkedin-post-search-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 = { "keywords": "generative AI" }

# Run the Actor and wait for it to finish
run = client.actor("gauravlabs/linkedin-post-search-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 '{
  "keywords": "generative AI"
}' |
apify call gauravlabs/linkedin-post-search-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,gauravlabs/linkedin-post-search-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/lfD1N22yBkXYkp712/builds/HNrVdh6ZjnjhXF2Xx/openapi.json
