# LinkedIn Ad Library Scraper (`workstream/linkedin-ad-library-scraper`) Actor

Scrape the public LinkedIn Ad Library by advertiser, keyword, country and date. Ad text, creatives and formats; optional details for full text, paid-by, run dates, impressions and targeting. No LinkedIn login.

- **URL**: https://apify.com/workstream/linkedin-ad-library-scraper.md
- **Developed by:** [Ahmad Shaaban](https://apify.com/workstream) (community)
- **Categories:** Social media, Lead generation, Marketing
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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 Ad Library Scraper — Ads, Creatives & Details

Export ads from the public **LinkedIn Ad Library**: every ad a company runs, or every ad that mentions a keyword, filtered by country and date. Optional details include full text, paid-by, run dates, impressions and targeting. No LinkedIn login.

### Who this is for

- Competitive advertising intelligence
- B2B marketing and demand-gen teams
- Agencies auditing LinkedIn creatives
- Ad libraries and research datasets

### What you get

| Field | Example |
|---|---|
| adId, adUrl, advertiser | 1637315156, Microsoft |
| adType, adFormat | SPONSORED_UPDATE, Single Image Ad |
| text, headline, imageUrls, videoUrl | creative assets |
| With details | fullText, paidBy, ranFrom/ranTo, impressions, targeting, CTA, landingUrl |

### Input example

```json
{
  "advertisers": ["hubspot", "1035"],
  "keywords": ["cybersecurity"],
  "countries": ["US", "DE"],
  "dateRange": "last-30-days",
  "maxAdsPerSearch": 100,
  "includeDetails": true
}
```

Advertisers accept names, company IDs or Ad Library URLs.

### Pricing

- **$0.001 per ad** from search results
- **$0.002 per ad with details**
  No start fee.

### FAQ

**Impressions / targeting?** Only where LinkedIn publishes them (mainly EU ads).
**Exact company match?** Use the numeric company ID; name search follows LinkedIn's own matcher.

# Actor input Schema

## `advertisers` (type: `array`):

Advertiser names (e.g. microsoft), LinkedIn company IDs (1035) or Ad Library search URLs with companyIds.

## `keywords` (type: `array`):

Search ads containing these words (one search per keyword).

## `startUrls` (type: `array`):

Paste any linkedin.com/ad-library/search?... URL with filters already set.

## `countries` (type: `array`):

2-letter codes where the ad ran, e.g. US, DE, FR. Empty = all.

## `dateRange` (type: `string`):

When the ad ran.

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

Overrides date range.

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

Used with custom start date.

## `maxAdsPerSearch` (type: `integer`):

Pagination continues until this limit or the last page.

## `includeDetails` (type: `boolean`):

Open each ad: full text, paid-by entity, run dates, impressions and targeting (where LinkedIn shows them, mainly EU ads), CTA and landing URL. Priced as ad-details.

## Actor input object example

```json
{
  "advertisers": [
    "microsoft",
    "hubspot"
  ],
  "dateRange": "",
  "maxAdsPerSearch": 50,
  "includeDetails": false
}
```

# Actor output Schema

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

Scraped items

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

Counts and errors per input

# 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 = {
    "advertisers": [
        "microsoft",
        "hubspot"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("workstream/linkedin-ad-library-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 = { "advertisers": [
        "microsoft",
        "hubspot",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("workstream/linkedin-ad-library-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 '{
  "advertisers": [
    "microsoft",
    "hubspot"
  ]
}' |
apify call workstream/linkedin-ad-library-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,workstream/linkedin-ad-library-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/VVoDa5kU1JsOhfN6p/builds/1Fa2Z02Hl0uxMAhsd/openapi.json
