# LinkedIn Ad Library Scraper | EU Impressions & Targeting (`corvuslab/linkedin-ad-library-scraper`) Actor

Scrape the LinkedIn Ad Library by company, keyword, payer or link in 249 countries. Get ad copy, creatives, CTA, landing pages with parsed UTM tags, payer, run dates, EU impressions by country and targeting. Filter by what advertisers target. New-ad alerts. No login.

- **URL**: https://apify.com/corvuslab/linkedin-ad-library-scraper.md
- **Developed by:** [Corvuslab](https://apify.com/corvuslab) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.80 / 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.
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

### What does LinkedIn Ad Library Scraper do?

LinkedIn Ad Library Scraper pulls **every LinkedIn ad an advertiser runs** out of the public [LinkedIn Ad Library](https://www.linkedin.com/ad-library/home), with the **EU transparency data** LinkedIn publishes: **impressions by country** and the **targeting the advertiser chose**. You get the copy, creative, call to action, landing page with its **UTM tags already parsed**, who paid for it and how long it ran. It's no-code and exports to JSON, CSV, Excel, the API or an AI agent.

Search by **company name** (`HubSpot`) or exact **company ID**, **keywords** in the ad text, the **"Paid for by"** entity or **links pasted from the Ad Library**, and narrow it by country, date, format or **what the advertiser targets**. Schedule it to get only the ads you haven't seen yet.

> New to Apify? Sign up free and use the included monthly platform credit to try this Actor — no credit card needed.

**Why this scraper**

- 🇪🇺 **Transparency data included** — impressions, run dates and targeting on every EU-shown ad, at one per-ad price.
- 🧾 **Rich, typed records** — 63 fields per ad, impression ranges as numbers too.
- 🔓 **No login** — no LinkedIn account, cookies or API token.
- 🔔 **Alerts built in** — Telegram, Slack, Discord or any webhook.

Watching the same advertisers elsewhere? Our [Facebook Ads Library Scraper](https://apify.com/corvuslab/facebook-ads-library-scraper) returns Meta ads with EU reach by country, age and gender, and our [Google Ads Scraper — Ads Transparency Center](https://apify.com/corvuslab/google-ads-transparency-scraper) Google ads with per-country reach.

***

### What data can you extract from the LinkedIn Ad Library?

Every record carries **63 fields** grouped like this:

| Group | What you get |
|---|---|
| **Ad copy & creative** | Ad ID and link, format (12 kinds), creative type, headline, full ad text, hashtags, links and mentions, call to action, image and alt text, video and thumbnail, carousel cards |
| **Landing page & campaign tags** | Landing page URL and domain, **every UTM tag parsed out** |
| **Format-specific details** | Document title, pages and cover; article link, newsletter, title and summary; **event link, time, organiser and location**; message-ad sender and buttons |
| **Advertiser & payer** | Name, LinkedIn page, company ID, type (company or member), logo, member headline, **"Paid for by" entity** |
| **Run dates & EU impressions** | First and last shown dates, **days running**, running flag, total impressions as text **plus numeric min/max**, **impressions by country** with share and estimated min/max |
| **Targeting** | Language, **target and excluded locations kept apart**, what the advertiser **targets by** and **excludes by**, the targeting table and clauses, EU-transparency flag |
| **Run context & monitoring** | How the ad was found, search term, countries and link, scrape time, content fingerprint, `changeType` (NEW / UPDATED / UNCHANGED / EXPIRED), first-seen date |

***

### Key features

- 🔎 **Five ways to search, combined** — company names or IDs, keywords, payers and pasted Ad Library links in one run, every ad returned once. A company ID returns only that company's ads; a name also matches other advertisers whose name contains it.
- 🎯 **Filter by what the advertiser targets** — keep only ads that **target by** or **exclude by** Job, Company, Audience, Education, Demographic or Interests. Pick "Job" for ads aimed at job titles.
- 🌍 **Every country an ad reached** — `impressionsByCountry` lists each country with its share, down to those under 1%, with estimated impressions.
- 🏷️ **UTM tags parsed** — `utmParameters` splits source, medium and campaign out of every landing page.
- 📍 **Included and excluded locations kept apart** — including the ones LinkedIn hides behind "+N others".
- 📅 **Newest or oldest first** — oldest first surfaces the longest-running ads.
- 🖼️ **Ad-format filter that costs nothing** — 12 formats; the others are skipped and not charged.
- ♻️ **New-ads-only monitoring** — ads you already have are recognised before their details are opened, so they cost nothing.

***

### 🚀 How to scrape the LinkedIn Ad Library

1. Enter **company names** (e.g. `HubSpot`), **keywords** or **"Paid for by"** names, or paste a link from `linkedin.com/ad-library`.
2. Pick **filters**: countries, dates, formats, sort order, targeting.
3. Set **Max ads per search** and keep **Full ad details** on.
4. Click **Start** and download **JSON, CSV or Excel**, or use the **API**.

An empty run returns the latest 50 HubSpot ads, so you can see the output first.

#### Quick-start example input

```json
{
  "advertisers": ["HubSpot", "Salesforce"],
  "countries": ["DE", "FR"],
  "dateRange": "last-30-days",
  "targetingIncludes": ["JOB"],
  "maxResults": 100
}
```

This returns up to 100 ads per company that HubSpot and Salesforce ran in Germany or France in the last 30 days aimed at job titles or functions, each with its impressions by country and full targeting table.

***

### Input

Configure it in the visual editor — no code needed — or pass JSON via the API.
**30 inputs** are available, in six groups that match the editor.

#### 🔎 What to search

You can combine all five. Each name, keyword or link runs as its own search, and every ad is returned once.

| Field | Type | What it does |
|---|---|---|
| `advertisers` | array | Company names as they appear on LinkedIn, e.g. `HubSpot`. |
| `searchKeywords` | array | Words or phrases in the ad text, e.g. `webinar`. |
| `payers` | array | The "Paid for by" entity, often an agency or legal entity. |
| `companyIds` | array | LinkedIn company page IDs (e.g. `68529`) or `linkedin.com/company/68529` links. Exact, unlike a name. |
| `startUrls` | array | Ad Library search links (with their filters) or single-ad links. |
| `maxResults` | integer | Ads per search. Default `50`; `0` = every ad listed. |

#### 🎚️ Filters

The Ad Library applies these itself, so you're never charged for ads they exclude.

| Field | Type | What it does |
|---|---|---|
| `countries` | array | Only ads shown in these countries (the library's list of 249). Empty = all. |
| `dateRange` | enum | `all-time`, `last-30-days`, `current-month`, `current-year`, `last-year` or `custom`. |
| `startDate` / `endDate` | string | Custom range, `YYYY-MM-DD`, within about the last year. |
| `sortOrder` | enum | `newest` (default) or `oldest`. |
| `adFormats` | array | Any of the 12 formats (`image`, `video`, `carousel`, `document`, `article`, `message`, `event`, `job`, `spotlight`, `follower`, `text`, `ctv`). |
| `targetingIncludes` | array | Ads that **target by** any of `LANGUAGE`, `LOCATION`, `AUDIENCE`, `DEMOGRAPHIC`, `COMPANY`, `EDUCATION`, `JOB`, `INTERESTS_AND_TRAITS`. Nearly every ad targets by language and location, so those two barely narrow it. |
| `targetingExcludes` | array | Ads that **exclude by** any of the same eight. |

#### 📄 Output

| Field | Type | What it does |
|---|---|---|
| `includeDetails` | boolean | On by default: opens every ad for the fields listed under *Data fields* below. Off = results-list fields only (faster). |
| `compact` | boolean | 18 core fields, for spreadsheets and AI agents. |
| `excludeEmptyFields` | boolean | Drop fields with no value. |

#### ♻️ Monitoring

| Field | Type | What it does |
|---|---|---|
| `incrementalMode` | boolean | Only ads new or changed since earlier runs; seen ads cost nothing. |
| `stateKey` | string | Optional monitor name, to keep two monitors of one search apart. |
| `emitUnchanged` | boolean | Also return seen ads (UNCHANGED, charged). |
| `emitExpired` | boolean | A record for each remembered ad no longer found (EXPIRED, charged). Only on runs that read the whole search. |

#### 🔔 Notifications

Each channel fires only when filled in. The Telegram token and Slack/Discord URLs are secret inputs, masked and never logged.

| Field | Type | What it does |
|---|---|---|
| `telegramToken` + `telegramChatId` | string | Bot token from @BotFather and the chat to post to. |
| `slackWebhookUrl` / `discordWebhookUrl` | string | A channel's incoming-webhook URL. |
| `webhookUrl` + `webhookHeaders` | string / object | POSTs the run's new ads (up to 100) as JSON, with optional headers. |
| `notificationLimit` | integer | Ads listed per chat message (1–50, default 5). |

#### ⚙️ Advanced

| Field | Type | What it does |
|---|---|---|
| `proxyConfiguration` | object | Connection settings. Off by default, which is the most reliable way to read the library; a run that is turned away finds another way in by itself. |
| `maxRequestRetries` | integer | Retries for a page that fails to load (1–10, default 5). |

#### More example inputs

Video ads about a topic, oldest first:

```json
{
  "searchKeywords": ["AI agents"],
  "adFormats": ["video"],
  "sortOrder": "oldest",
  "maxResults": 200
}
```

A daily competitor monitor that posts new ads to Slack:

```json
{
  "advertisers": ["HubSpot", "Salesforce", "Pipedrive"],
  "maxResults": 0,
  "incrementalMode": true,
  "emitExpired": true,
  "slackWebhookUrl": "https://hooks.slack.com/services/…"
}
```

***

### Output

Each dataset item is one LinkedIn ad. A real record, trimmed to the fields that sell:

```json
{
  "id": "1638561844",
  "adUrl": "https://www.linkedin.com/ad-library/detail/1638561844",
  "format": "Video Ad",
  "creativeType": "SPONSORED_VIDEO",
  "advertiserName": "HubSpot",
  "advertiserUrl": "https://www.linkedin.com/company/68529",
  "advertiserId": "68529",
  "advertiserType": "company",
  "paidBy": "HubSpot, Inc.",
  "headline": "Multipliez vos meilleures campagnes.",
  "body": "Le grand marketing est affaire de goût. Marketing Studio automatise les tâches administratives des campagnes pour vous laisser donner vie à vos idées.",
  "ctaText": "Learn more",
  "landingPageUrl": "https://www.hubspot.fr/products/marketing/studio?utm_source=linkedin&utm_medium=paid_brandstrategy&utm_campaign=BrandStrategy_VideoViews_FR_EMEA_FRANCE_MarketingStudio_AnnoyinglyGood-Q4-2026_InFeed-LAN_MarketingGabby_MarketingStudio-PP-15",
  "landingPageDomain": "hubspot.fr",
  "utmParameters": {
    "source": "linkedin",
    "medium": "paid_brandstrategy",
    "campaign": "BrandStrategy_VideoViews_FR_EMEA_FRANCE_MarketingStudio_AnnoyinglyGood-Q4-2026_InFeed-LAN_MarketingGabby_MarketingStudio-PP-15"
  },
  "startDate": "2026-11-11",
  "endDate": "2026-11-14",
  "daysRunning": 4,
  "isActive": true,
  "impressions": "50k-100k",
  "impressionsMin": 50000,
  "impressionsMax": 100000,
  "impressionsByCountry": [
    { "country": "France", "share": 100, "shareText": "100%", "impressionsMin": 50000, "impressionsMax": 100000 },
    { "country": "India", "share": null, "shareText": "<1%", "impressionsMin": null, "impressionsMax": null },
    { "country": "Morocco", "share": null, "shareText": "<1%", "impressionsMin": null, "impressionsMax": null }
  ],
  "targetingLanguage": "English",
  "targetingLocations": ["France"],
  "targetingExcludedLocations": [],
  "targetedFacets": ["Language", "Location", "Company", "Job"],
  "excludedFacets": ["Audience", "Company"],
  "targetingParameters": [
    { "parameter": "Audience", "targeted": false, "excluded": true },
    { "parameter": "Company", "targeted": true, "excluded": true },
    { "parameter": "Job", "targeted": true, "excluded": false }
  ],
  "hasEuTransparency": true,
  "detailFetched": true,
  "searchType": "advertiser",
  "searchTerm": "HubSpot",
  "source": "linkedin.com/ad-library",
  "scrapedAt": "2026-11-14T22:44:38.834745+00:00"
}
```

The full record lists 54 countries for this ad, most under 1%, and the campaign tag alone gives the objective, region, product, creative concept and quarter.

#### Data fields

- **Always** — ad ID and link, format, creative type, advertiser name and logo, headline, the first lines of the ad text, image, and how the ad was found.
- **With `includeDetails`** (default) — full text, hashtags and links, advertiser page, ID and type, call to action, landing page and `utmParameters`, video, carousel, document / article / event / message fields, payer, run dates.
- **With `includeDetails`, EU-shown ads only** — impressions (total and by country) and all targeting fields.
- **With `incrementalMode`** — `changeType` and `firstSeenAt`.

Missing values are `null`. The Output tab has a ready-made **Overview** table.

***

### 🔔 How to monitor the LinkedIn Ad Library and get alerts on new ads

Turn on **Only new ads** and schedule the same input. Each run returns only **NEW** and **UPDATED** ads, and ads you already have are recognised *before* their details are opened, so they cost nothing.

| | First run (baseline) | Next run (nothing changed) |
|---|---|---|
| Ads found in the library | all | all |
| Ad details opened | all | **none** |
| Records returned & billed | all | **none** |

After the baseline, you pay for the ads advertisers actually launch, not for the ones you watch.

**Report ads that disappeared** adds an EXPIRED record for each remembered ad a full run no longer finds: the campaign was switched off.

#### Setting up scheduled monitoring

1. Enter what to watch and turn on **Only new ads**.
2. Run it once to seed the baseline.
3. In **Schedules**, set a recurring run (e.g. daily at 08:00), and add a notification channel.

#### Getting the alert

Get pinged when a competitor launches a new LinkedIn ad:

| Channel | What to configure |
|---|---|
| ✈️ **Telegram** | `telegramToken` (from @BotFather) + `telegramChatId` |
| 💬 **Slack** | `slackWebhookUrl` (Incoming Webhook URL) |
| 🎮 **Discord** | `discordWebhookUrl` (channel webhook URL) |
| 🪝 **Webhook** | `webhookUrl` receives the new ads as JSON, ideal for n8n / Make / Zapier |

Chat messages list the advertiser, headline, a snippet and the ad link; a broken channel never stops the run.

***

### 💡 What can you do with LinkedIn Ad Library data?

#### Track competitor B2B campaigns

See every ad a rival runs, how long it has been live and its impressions per country. Long-running, high-impression ads are the ones working.

#### Reverse-engineer who competitors are targeting

See whether an advertiser targets by job, company, education, interests or a matched audience, and what it excludes.

#### Decode campaign naming with UTM tags

Campaign names often encode objective, region, product and quarter, so `utmParameters` maps an advertiser's funnel.

#### Build a B2B ad creative swipe file

Collect headlines, copy, calls to action, videos, carousels and documents by format or keyword. Oldest first surfaces the evergreen ads.

#### Find and qualify leads for agencies

Companies running LinkedIn ads have a paid-media budget, and "Paid for by" names the agency or entity behind them.

#### Monitor launches, events and webinars

Watch keywords like `webinar` or event ads, with the event's time, organiser and location.

***

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

This Actor uses Apify's **pay-per-event** model: a small fee when a run starts, plus a fee for each ad returned. The **Pricing** tab shows the current numbers live.

Full details cost the same as a basic record. Three things cut your bill:

- **Library-side filters** — ads they exclude are never returned or billed.
- **Free format filter** — other formats are skipped and not charged.
- **Incremental mode** — after the baseline you pay only for new and changed ads.

You can also set a maximum cost per run; the Actor stops cleanly when it's reached.

***

### 🔌 Integrations & export

Export to **JSON, CSV, Excel** or an HTML table, or pull from the **REST API** and the
**JavaScript / Python** clients. Runs on a **schedule**, connects to **Google Sheets, Slack,
Make, Zapier and n8n**, and works as an **MCP tool** for AI agents — compact mode keeps token
usage small.

***

### 🔗 Using the API

Run this Actor from your own code. Example with the Apify Python client:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")

run_input = {
    "advertisers": ["HubSpot"],
    "countries": ["DE"],
    "targetingIncludes": ["JOB"],
    "maxResults": 50,
}

run = client.actor("corvuslab/linkedin-ad-library-scraper").call(run_input=run_input)

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["advertiserName"], item["headline"], item["impressions"], item["utmParameters"])
```

***

### ❓ FAQ

**Do I need a LinkedIn account or login?** No. The Actor reads the public LinkedIn Ad Library, with no account, cookies or API token.

**Why are impressions, run dates and targeting empty on some ads?** LinkedIn publishes them only for ads **shown in the EU**. Ads shown only elsewhere carry the creative, advertiser and payer, and `null` for the rest; `hasEuTransparency` tells you which kind an ad is. Pick EU countries in `countries` to get the data.

**Why does an ad found with a country filter show impressions mostly elsewhere?** The country filter is LinkedIn's own and matches more broadly than where impressions landed, so a Germany search can return a UK campaign. `impressionsByCountry` shows where each ad was actually seen.

**Why is the ad text cut short?** With **Full ad details** off, only the results list is read, which shows the first ~120 characters. Keep details on for the full text.

**How far back does the LinkedIn Ad Library go?** About a year. `sortOrder: "oldest"` starts from the earliest ads still listed.

**How many ads can I get per advertiser?** All the library lists: set `maxResults` to `0`. We've read over 900 for one advertiser. A run stops at 20,000 ads as a safety net.

**How long does a big run take?** The Actor reads the library at a steady pace, so LinkedIn keeps serving it rather than turning it away: plan on roughly **15–20 ads a minute**. 50 ads take about 3 minutes, 400 about 25. For several hundred ads, raise **Timeout** under **Run options** — the default is 1 hour. A run that reaches its limit still delivers and bills every ad it got, and its status says how many of the ads you asked for that was.

**What do "Targets by" and "Excludes by" mean?** LinkedIn shows which of eight parameters an advertiser used to pick or exclude its audience: language, location, audience, demographic, company, education, job, and member interests and traits. `targetedFacets` and `excludedFacets` list them; `targetingParameters` is LinkedIn's table for the six non-geographic ones. Language and location values come back in `targetingLanguage`, `targetingLocations` and `targetingExcludedLocations`; for the rest LinkedIn publishes only whether they were used. The filters match ads using **any** parameter you pick, and return EU-shown ads, since only those carry targeting.

**When is an ad marked UPDATED in monitoring mode?** When its format, headline or ad text changes. Impressions and the last-shown date move daily on live ads, so they don't count, or every running ad would be billed again each run.

***

### 🧭 More scrapers from us

These pick up where this one stops.

| Scraper | What it adds |
|---|---|
| [Facebook Ads Library Scraper](https://apify.com/corvuslab/facebook-ads-library-scraper) | The same ads on Facebook and Instagram, with EU reach by age and gender |
| [Google Ads Scraper — Ads Transparency Center](https://apify.com/corvuslab/google-ads-transparency-scraper) | Google and YouTube ads, with per-country reach and run dates |
| [Google Trends Scraper](https://apify.com/corvuslab/google-trends-scraper) | Whether the demand behind a campaign is rising or fading |
| [LinkedIn Jobs Scraper](https://apify.com/corvuslab/linkedin-jobs-scraper) | What the same companies are hiring for, from the same site |
| [Glassdoor Reviews Scraper](https://apify.com/corvuslab/glassdoor-reviews-scraper) | How employees rate the advertisers you are tracking |
| [Trustpilot Scraper](https://apify.com/corvuslab/trustpilot-scraper) | Every customer review past the 200 cap, with TrustScore and replies |

***

### ⚖️ Is it legal to scrape the LinkedIn Ad Library?

The LinkedIn Ad Library is a public transparency archive that LinkedIn provides so anyone can see the ads on its platform, and this Actor collects only that **publicly available** data, without logging in. You're responsible for how you use it, in particular any personal information such as the names of members who promote ads, and for complying with LinkedIn's terms and applicable law (including the GDPR/LGPD where they apply). Not affiliated with, endorsed by or sponsored by LinkedIn Corporation or Microsoft.

***

**Keywords:** linkedin ad library scraper · linkedin ads library scraper · linkedin ad library api · linkedin ads scraper · scrape linkedin ads · linkedin competitor ads · linkedin ad targeting data · linkedin ad impressions by country · eu ad transparency · b2b ad intelligence · competitor ad monitoring · ad creative swipe file · linkedin ads spy tool · utm campaign tracking · export to CSV · export to Excel · no-code scraper · MCP tool for AI agents

# Changelog

This Actor's version history is a separate document: https://apify.com/corvuslab/linkedin-ad-library-scraper/changelog.md

# Actor input Schema

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

Company or advertiser names as they appear on LinkedIn, for example HubSpot or Salesforce. Each name is its own search, newest ads first.

## `searchKeywords` (type: `array`):

Words or phrases to find in ad text, for example webinar or AI agents. Each keyword is its own search.

## `payers` (type: `array`):

The entity named under 'Paid for by' — often an agency or legal entity rather than the brand. Each name is its own search.

## `companyIds` (type: `array`):

LinkedIn company page IDs, for example 68529 for HubSpot, or links like linkedin.com/company/68529. Exact: unlike a name search, it never picks up other advertisers whose name contains the same word. Each ID is its own search.

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

Paste results links from linkedin.com/ad-library/search with the filters you set there, or single-ad links (linkedin.com/ad-library/detail/…) to get those ads.

## `maxResults` (type: `integer`):

How many ads to return for each company, keyword, payer, company ID or link. 0 = every ad the library lists.

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

Only ads shown in these countries. Leave empty for all countries.

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

When the ads ran.

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

Custom range start (YYYY-MM-DD). The library keeps about a year of ad history.

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

Custom range end (YYYY-MM-DD).

## `sortOrder` (type: `string`):

Newest first returns the latest campaigns; with a cap it gives you the most recent ads.

## `adFormats` (type: `array`):

Keep only these formats. Ads in other formats are skipped and never charged. Empty = every format.

## `targetingIncludes` (type: `array`):

Only ads whose advertiser targeted any of these parameters, for example Job to find ads aimed at job titles or functions. Almost every ad targets by Language and Location, so those two barely narrow a search. Targeting is published for ads shown in the EU.

## `targetingExcludes` (type: `array`):

Only ads whose advertiser excluded audiences by any of these parameters.

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

Opens every ad: full copy, landing page and UTM tags, call to action, video, carousel cards, payer, run dates, and for EU-shown ads the impressions by country and targeting. Off = only what the results list shows (faster).

## `compact` (type: `boolean`):

Only the core fields — handy for spreadsheets and AI agents.

## `excludeEmptyFields` (type: `boolean`):

Drop fields that have no value for an ad.

## `incrementalMode` (type: `boolean`):

Remembers the ads earlier runs returned and returns only new or changed ones. Ads already seen are skipped and cost nothing.

## `stateKey` (type: `string`):

Optional. Name the memory so different monitors of the same search stay apart. Empty = derived from the search.

## `emitUnchanged` (type: `boolean`):

With monitoring on, also return ads seen before (marked UNCHANGED, and charged).

## `emitExpired` (type: `boolean`):

With monitoring on, add a record for every remembered ad this run no longer found (marked EXPIRED, charged like any ad). Only on runs that read the whole search.

## `telegramToken` (type: `string`):

Token from @BotFather.

## `telegramChatId` (type: `string`):

The chat or channel to post to.

## `slackWebhookUrl` (type: `string`):

Incoming-webhook URL of a Slack channel.

## `discordWebhookUrl` (type: `string`):

Webhook URL of a Discord channel.

## `webhookUrl` (type: `string`):

Any URL that should receive the new ads as JSON (POST): the count and up to 100 ads per run (every ad is in the dataset).

## `webhookHeaders` (type: `object`):

Optional headers for the webhook, for example an Authorization header.

## `notificationLimit` (type: `integer`):

How many ads to list in a chat message.

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

Leave this off unless you have a reason to use it. The Ad Library serves the run's own connection most reliably, and if it ever turns the run away the run finds another way by itself. A proxy makes very large searches somewhat faster, at the cost of more retries.

## `maxRequestRetries` (type: `integer`):

Retries for a page that fails to load.

## Actor input object example

```json
{
  "advertisers": [
    "HubSpot"
  ],
  "maxResults": 50,
  "dateRange": "all-time",
  "sortOrder": "newest",
  "includeDetails": true,
  "compact": false,
  "excludeEmptyFields": false,
  "incrementalMode": false,
  "emitUnchanged": false,
  "emitExpired": false,
  "notificationLimit": 5,
  "proxyConfiguration": {
    "useApifyProxy": false
  },
  "maxRequestRetries": 5
}
```

# Actor output Schema

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

No description

## `allItems` (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 = {
    "advertisers": [
        "HubSpot"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("corvuslab/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": ["HubSpot"] }

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,corvuslab/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/Km8kVB7dHbmJfGXLg/builds/vyynsjjLCx1lGcwMT/openapi.json
