# LinkedIn Ad Library Scraper: ads, targeting and impressions (`pikoulas/linkedin-ads`) Actor

Scrape LinkedIn's Ad Library by keyword, advertiser, payer or URL: ad text, headline, call to action, landing page, images, videos, run dates, who paid, impressions by country and targeting (language, location, audience). Any country and date range. No login, no browser.

- **URL**: https://apify.com/pikoulas/linkedin-ads.md
- **Developed by:** [Spyridon Pikoulas](https://apify.com/pikoulas) (community)
- **Categories:** Marketing, Lead generation, Social media
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 ads

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/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

**Retired on 2026-11-06.** LinkedIn's User Agreement bans scraping ([link](https://www.linkedin.com/legal/user-agreement)), so this Actor no longer reads the site. A run reads nothing, charges nothing and ends with this notice.

Scrape LinkedIn's Ad Library, the public archive of the ads run on LinkedIn, without an account or
a browser:

- **Keywords:** the ads whose text contains a word or phrase.
- **Advertisers:** every ad of a company, by name (`HubSpot`, `SAP`).
- **Payer:** the ads paid for by a company or agency.
- **Ad Library URLs:** paste a search from linkedin.com/ad-library with its filters, or an ad
  (`linkedin.com/ad-library/detail/...`) or its ID.
- **Filters:** the countries the ad was shown in, and a period: the last 30 days, this month,
  this year, last year, or your own start and end dates.

Every ad comes with its advertiser, format (single image, video, carousel, document, event or
message) and the start of its text. With details on, the default, it also comes with the
full text, headline, call to action, landing page, images, the video's MP4 and a document's
pages, and what LinkedIn shows about it: **who paid** for it, the **dates it ran**, its
**impressions** in total and by country, and its **targeting**: languages, locations, and which
of audience, company, job, education, demographic and interest targeting it used or excluded.

It costs **$0.80 per 1,000 ads**, details included.

### What people use it for

- **Competitor research:** every ad a competitor runs on LinkedIn, its message, offer and landing
  page, and how long it has run.
- **Creative inspiration:** the videos, documents and images of the B2B ads in a niche.
- **Market and media research:** who advertises on a topic, where, and with how many impressions.
- **Lead generation:** the companies spending on LinkedIn ads in a niche or a country.

### How to scrape the LinkedIn Ad Library

1. Click **Try for free**; Apify's free plan covers a first run.
2. Enter **Keywords**, **Advertisers** or **Ad Library URLs**, and how many ads you want.
3. Click **Start**, then download the results as JSON, CSV, Excel or HTML, or read them through
   the API.

An input with more options:

```json
{
  "searchTerms": ["cloud security", "payroll software"],
  "advertisers": ["HubSpot"],
  "countries": ["US", "DE"],
  "dateRange": "last30Days",
  "maxAdsPerSearch": 200,
  "urls": ["https://www.linkedin.com/ad-library/search?accountOwner=sap&countries=FR"]
}
```

Each keyword and each advertiser is its own search, with the countries and period given; a search
URL keeps its own filters. Turn off `includeDetails` for what the search page shows, about 20
times faster.

### Output

```json
{
  "type": "ad",
  "adId": "1574043074",
  "url": "https://www.linkedin.com/ad-library/detail/1574043074",
  "format": "Single Image Ad",
  "creativeType": "SPONSORED_STATUS_UPDATE",
  "advertiser": "SAP",
  "advertiserId": "1115",
  "advertiserUrl": "https://www.linkedin.com/company/1115",
  "paidBy": "SAP Global Marketing, Inc.",
  "text": "Safeguard your business integrity on your transformation journey with SAP Cloud ERP Private.",
  "headline": "Experience a tailored fit when migrating to SAP Cloud ERP Private",
  "callToAction": "Request Demo",
  "destinationUrl": "https://sap.to/6043BGchjt",
  "imageUrls": ["https://media.licdn.com/dms/image/v2/D5610AQEX5TXEsnOA5A/image-shrink_1280/..."],
  "firstShown": "2026-09-25",
  "lastShown": "2026-09-27",
  "impressions": "1k-5k",
  "impressionsByCountry": [{"country": "India", "percent": 22}, {"country": "Pakistan", "percent": 17}],
  "targetingLanguages": {"included": ["English"], "excluded": []},
  "targetingLocations": {"included": ["Germany", "Switzerland", "Poland"], "excluded": []},
  "targetedBy": ["Audience", "Job"],
  "excludedBy": ["Audience"],
  "searchQuery": "cloud security"
}
```

An ad also has `advertiserLogo`, and where it has them `videoUrl` (the best MP4),
`videoThumbnail` and `documentPages`. A message ad's `text` is the message, with LinkedIn's
`%FIRSTNAME%` placeholder in it.

### Use it as an API

One call runs it and returns the results as JSON (for runs under 5 minutes; longer ones start a
run and read its dataset). Apify's Python and JavaScript clients, and its Make, Zapier and n8n
integrations, work the same way.

```bash
curl -X POST "https://api.apify.com/v2/acts/pikoulas~linkedin-ads/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchTerms": ["cloud security"], "maxAdsPerSearch": 10}'
```

AI agents can call it as a tool through Apify's MCP server: `https://mcp.apify.com?tools=pikoulas/linkedin-ads`.

### How much does it cost to scrape the LinkedIn Ad Library?

You pay **$0.0008 per ad**, which is $0.80 per 1,000 ads, with or without details. Traffic through
Apify's residential proxy is paid as well, at $0.0012 per 100 KB. Ad details always go through it,
since that makes them several times faster, and searches go through it only when LinkedIn refuses
Apify's own IPs. An ad with details is about 13 KB, so about $0.16 per 1,000 ads. There are no
monthly fees.

### Good to know

- LinkedIn shows the run dates, impressions and targeting of the ads shown in the EU. Other ads
  have them as `null` and empty lists; their text, creative and payer are there all the same.
- LinkedIn lets one IP open an ad's page about every 3 seconds, so the details come from many IPs
  at once, 8 at a time: about 2.5 ads a second, where one IP gives one ad every 3 seconds. Search
  pages come 24 ads at a time.
- Searches go as deep as they have ads: 6,000 for "software" in the US came through, and an
  advertiser's whole library to its last page.
- An ad found under several keywords is given once per run.

### FAQ

#### Is it legal to scrape LinkedIn's Ad Library?

It collects only what LinkedIn's Ad Library shows publicly, without logging in. Personal data is protected by laws such as the GDPR and the CCPA. If you're unsure, ask a lawyer;
Apify's [Is web scraping legal?](https://blog.apify.com/is-web-scraping-legal/) is a good start.

#### Something missing or not working?

Open an issue on the **Issues** tab with the input you used, or ask there for a field you need.

# Actor input Schema

## `searchTerms` (type: `array`):

Words in the ads, searched as on linkedin.com/ad-library. Each is its own search, with the filters below.

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

Company or advertiser names (Microsoft, HubSpot). Each is its own search for the ads of the pages that match it.

## `urls` (type: `array`):

Searches copied from linkedin.com/ad-library/search, with the filters set there, and ad URLs (linkedin.com/ad-library/detail/...) or IDs.

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

How many ads to take from each keyword, advertiser or search URL.

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

The full text, headline, call to action, landing page, video, payer, run dates, impressions and targeting. One more request per ad, so slower; off gives what the search page shows.

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

Two-letter country codes (US, DE, GB): only ads shown there. Empty for all countries.

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

Only ads shown in this period. Start and end dates below take its place.

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

Only ads shown on or after this date.

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

Only ads shown on or before this date.

## `payer` (type: `string`):

Only ads paid for by this payer (SAP SE). Alone, it is a search of its own.

## `proxyConfiguration` (type: `object`):

Not needed for most runs. On the Apify platform, a run LinkedIn refuses switches to residential proxy by itself.

## Actor input object example

```json
{
  "searchTerms": [
    "cloud security"
  ],
  "maxAdsPerSearch": 20,
  "includeDetails": true,
  "dateRange": "any",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `ads` (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 = {
    "searchTerms": [
        "cloud security"
    ],
    "maxAdsPerSearch": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("pikoulas/linkedin-ads").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 = {
    "searchTerms": ["cloud security"],
    "maxAdsPerSearch": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("pikoulas/linkedin-ads").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 '{
  "searchTerms": [
    "cloud security"
  ],
  "maxAdsPerSearch": 20
}' |
apify call pikoulas/linkedin-ads --silent --output-dataset

```

## MCP server setup

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

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/fgRv95unL8d8HxQ2C/builds/e2Tmx3vtZmo2Zp8c7/openapi.json
