# LinkedIn Ad Library Scraper (`nice_dev/linkedin-ads-library-scraper`) Actor

Scrape LinkedIn Ad Library ads by keyword, advertiser, company ID, payer or URL: ad text, format, media, plus optional landing URL, run dates, impressions by country and targeting. No login. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/nice_dev/linkedin-ads-library-scraper.md
- **Developed by:** [Nice Dev](https://apify.com/nice_dev) (community)
- **Categories:** Marketing, Lead generation, MCP servers
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.09 / 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.
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 is LinkedIn Ad Library Scraper?

**LinkedIn Ad Library Scraper** extracts **ads from the [LinkedIn Ad Library](https://www.linkedin.com/ad-library)**: **advertiser, ad text, format and main image**, plus optional **videos, landing page with UTM tags, run dates, impressions by country and targeting**, for any keyword, advertiser, company ID, payer or search URL. It works as a **LinkedIn Ad Library API alternative**: run it on a schedule, call it from your code, or plug it into Make, Zapier or n8n.

Type a **keyword** (`software`) or an **advertiser** (`HubSpot`), click **Start**, and download the ads in JSON, CSV or Excel. No login, nothing to set up, and it is **fast: 24 ads come back with each results page**.&#x20;

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

One item per ad, 63 fields:

| Category | What you get |
| --- | --- |
| 📢 **Ad** | link, LinkedIn ad id, format (image, video, carousel, document, event, message, text, spotlight, job…), headline and the start of the text; (paid option) the full text — `[Live event] Meet the EU AI Act.` |
| 🏢 **Advertiser** | company name, logo; (paid option) company id, LinkedIn page, company or member (thought-leader ads), who paid for the ad — `LaunchDarkly`, paid for by `CATAMORPHIC CO.` |
| 🔗 **Landing page** | (paid option) where the ad leads (tracking removed), its domain, UTM tags, call-to-action button, links written in the text with lnkd.in short links decoded — `Register` → `launchdarkly.com` |
| 🎞️ **Media** | the main image; (paid option) every other image, every video file with its bitrate, carousel cards, document title, page count and preview pages |
| 🗣️ **Speech in the videos** | what is said in the ad videos (first 60 seconds) and its language, written down by AI (paid option) |
| 🔤 **Text in the images** | the offer, dates, brand and call to action written in the ad images, read by AI (paid option) — `LIVE WEBINAR 29 OCT 2 PM GMT` |
| 🏷️ **Ad tags** | what the ad asks people to do, what it offers, its stage in the funnel, the job function it speaks to, its language and, for English ads, its sentiment — each with a confidence, tagged by AI (paid option) — `register`, `event`, `finance` |
| 💬 **Event and message ads** | (paid option) event name, time, place and organizer; message sender, text and buttons |
| 📅 **Run dates** | (paid option) first and last day shown, days running, still running or not — `2026-10-19` to `2026-10-21`, 3 days |
| 📊 **Reach** | (paid option) total impressions as a range and as numbers, share and impressions per country, top country — `< 1k`, United Kingdom 58 % |
| 🎯 **Targeting** | (paid option) language, included and excluded locations, which targeting types were used or excluded (audience, company, job, education, demographics, interests) |
| 🔢 **Ad counts** | the number of ads LinkedIn finds for a search, without the ads (What to return = counts) |
| 🧭 **Context** | rank of the ad in its search, the input and the search that found it, extraction time |

Every field, with an example, is listed in the **Output** section below.

The ad card gives the advertiser, the format, the start of the text, the headline and the image. Everything else (full text, landing page, media files, payer, dates, impressions, targeting) is on the ad page: tick **Ad details** to get it. Run dates, impressions and targeting are published by LinkedIn for **ads shown in the EU / EEA** only: add an EU country to **Countries** to get them on (almost) every ad.

### ✅ Why use LinkedIn Ad Library Scraper?

- 🔎 **Every way to search, mixed in one run**: keywords, advertiser names, company IDs, payers, ad IDs and Ad Library URLs, with LinkedIn's own filters (countries, period, impressions, targeting) — one search each, up to 500 per run.
- ♾️ **No 1,000-ad ceiling**: pagination goes to the end of the results (1,458 of 1,460 ads read on one advertiser in our tests).
- 📊 **The EU transparency data as numbers**: impressions as min / max numbers, per country, and a table of the targeting types each ad used or excluded.
- 🎞️ **Every format read in full**: all video files, carousel cards, document pages, event details, message ads (sender, text, buttons), Text Ads, Spotlight Ads and Job Ads (title, text, button, place when the ad shows one).
- 🔗 **Clean landing pages**: tracking removed, UTM tags as an object, lnkd.in short links turned into their real address (free).
- 🔢 **Counts only**: one row per search with the number of ads, to size a market or follow a competitor's volume cheaply.
- 🔔 **Monitoring built in**: tick **Only new ads**, schedule the Actor, and each run returns (and charges) only the ads it has never delivered before.
- 🔌 API, scheduling, integrations (Make, Zapier, n8n, Google Sheets…) and JSON / CSV / Excel export via the Apify platform.

### 🚀 How to scrape the LinkedIn Ad Library

1. Create a free Apify account.
2. Open **LinkedIn Ad Library Scraper** and type a **Search keyword** (e.g. `software`), an **Advertiser name** (e.g. `HubSpot`) or a **Company ID**.
3. Or paste your own Ad Library URLs into **Start URLs**: any search results page (all filters set on the site are kept, pagination is automatic) or single ad pages.
4. Set **Max ads** (100 by default, 0 = no limit) — and **Max ads per search** when you run several searches — tick **Ad details** if you want the ad pages, then click **Start**.
5. Download the dataset in JSON, CSV, Excel or via API.

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

This Actor uses **pay per event** pricing: you pay for what you get, and the price of each event is in the **Pricing** tab.

| Apify plan | Ad | Ad with its ad page | Count row | Image text read | Video speech written down | Ad tags |
| --- | --- | --- | --- | --- | --- | --- |
| Free | **$0.44** | **$0.45** | **$8.99** | **$1.79** | **$17.99** | **$0.63** |
| Bronze | $0.27 | $0.44 | $7.69 | $1.49 | $13.99 | $0.62 |
| Silver | $0.23 | $0.43 | $6.29 | $1.29 | $9.89 | $0.61 |
| Gold | $0.14 | $0.42 | $4.49 | $0.89 | $7.19 | $0.60 |

Prices per 1,000, plus **$0.01 per run start** ($1 per 100 runs). Example on the Free plan: 1,000 ads ≈ $0.45. Example on the Gold plan: 1,000 ads with their ad page ≈ $0.43.

An ad that a filter of the Actor drops is not saved and costs only the filter fee shown in the **Pricing** tab.

What is charged:

- each **ad** saved in the dataset (ad card);
- each **ad with its ad page** instead, when the ad page was read: with **Ad details**, with a filter that reads the ad page (**First shown after / before**, **Min days running**, **Still running only**), and for every ad given by **Ad IDs** or by an ad URL;
- each **count row**, one per search, with **What to return** = `counts`;
- each **image whose text is read**, with **Text in images**, on top of the ad (an image without readable text is free);
- each **video whose speech is written down**, with **Speech in videos**, on top of the ad with its ad page (music only or no sound is free);
- each **ad with at least one tag**, with **Ad tags**, on top of the ad (an ad with no tag is free);
- a small fee per run start, and a small fee for each ad that a filter of the Actor checks and drops (`filter-check` on the ad card, `detail-filter-check` when the filter needs the ad page) — filtering never costs more than taking everything.

Decoding lnkd.in short links is free. Platform usage (compute, proxy) is included in the price.

### ⚙️ Input

```json
{
    "query": "software",
    "countries": ["FR"],
    "maxItems": 200,
    "extractDetails": true
}
```

Several advertisers, a cap per search, only ads still running, only the ones not delivered before:

```json
{
    "companies": ["HubSpot", "Salesforce"],
    "exactAdvertiserMatch": true,
    "countries": ["EU"],
    "maxItems": 200,
    "maxItemsPerQuery": 100,
    "activeOnly": true,
    "onlyNew": true,
    "stateKey": "crm-ads-eu"
}
```

Or with company IDs, single ads and your own URLs:

```json
{
    "companyIds": ["68529"],
    "adIds": ["1649718966"],
    "startUrls": [{ "url": "https://www.linkedin.com/ad-library/search?keyword=crm&countries=DE" }],
    "maxItems": 500
}
```

| Field | Notes |
| --- | --- |
| `query`, `searchQueries` | Words of the ad text or advertiser, as typed in the Ad Library search box (`software`); `searchQueries` adds more keywords, one search each. |
| `companies`, `exactAdvertiserMatch` | Advertiser names, as in the Ad Library "Advertiser" box (`HubSpot`); LinkedIn adds look-alike names, `exactAdvertiserMatch` drops them (free). Every keyword is searched for every advertiser (max 500 searches per run). |
| `companyIds` | LinkedIn company IDs (`68529`) or company URLs with that ID (`https://www.linkedin.com/company/68529`): the exact advertiser. The ID is in `advertiserId` of any ad read with **Ad details** (the ad card does not show it). |
| `payers` | Who paid for the ads ("Paid for by" on LinkedIn, often an agency): one search per payer. |
| `adIds` | Single ads by ID (`1649718966`) or ad URL; read on their ad page and charged as ads with their ad page. |
| `startUrls` | Ad Library search URLs (filters kept, their period held to the days LinkedIn has as for `startDate` / `endDate`, pagination automatic), ad URLs (`https://www.linkedin.com/ad-library/detail/1649718966`) or company pages with a numeric id. |
| `resultType` | `ads` = one row per ad; `counts` = one row per search with the number of ads LinkedIn finds (page 1 only, no ad rows). |
| `maxItems` | Stop after this many ads for the whole run (`0` = unlimited). Not used when **What to return** is counts: one row per search. |
| `maxItemsPerQuery` | Cap for EACH search (keyword, advertiser, company ID, payer or search URL); `0` = no per-search cap. |
| `countries` | Countries where the ads were shown: ISO codes (`FR`, `DE`, `US`), English names (`Germany`, `USA`, `Great Britain`) or the groups `EU`, `EEA`, `DACH`, `NORDICS`. Empty = all countries. |
| `dateOption` | LinkedIn's period filter: `all`, `last-30-days`, `current-month`, `current-year`, `last-year` or `custom`. |
| `startDate`, `endDate` | Custom period (sets the period to custom): a date (`2026-09-01`) or a period before now (`30 days`, `3 months`). LinkedIn has the ads up to yesterday and keeps 12 months: an empty or later end is yesterday, an older start is moved to the oldest day kept. |
| `impressionsMin`, `impressionsMax` | LinkedIn's impression filter, as plain numbers (`1,000`, `100,000`); `0` = no bound. |
| `targetingIncludes`, `targetingExcludes` | Only ads whose advertiser targeted (or excluded) members by these types: `JOB`, `COMPANY`, `LOCATION`, `AUDIENCE`… |
| `adFormats` | Keep only these formats: `image`, `video`, `carousel`, `document`, `event`, `message`, `text`, `spotlight`, `job`… Empty = all. |
| `extractDetails`, `decodeShortLinks` | Open each ad page for the full text, landing page, media files, payer, dates, impressions and targeting (paid option, off by default); with it, lnkd.in short links are decoded for free. |
| `imageText` | Text in images (paid option, off by default): AI reads the text written in the ad images (offer, dates, brand, call to action), Latin-script text only. Charged per image where text is found, on top of the ad; needs 2 GB of memory (Run options), otherwise skipped and not charged. |
| `videoTranscript` | Speech in videos (paid option, off by default): AI writes down what is said in the ad videos (first 60 seconds of sound), with its language. The video files are on the ad page, so this option opens each ad page (charged as an ad with its ad page); charged per video where speech is found, on top of it; needs 2 GB of memory (Run options), otherwise skipped and not charged. |
| `adTags` | Ad tags (paid option, off by default): AI tags each ad (field **adTags**) — call to action (register, book a demo, download…), offer (event, content, free trial, job…), funnel stage, job function targeted, language and, for English ads only, sentiment (positive or neutral). Each tag has a confidence from 0 to 1 and is empty when the Actor is not sure enough. Charged per ad with at least one tag, on top of the ad; needs 2 GB of memory (Run options), otherwise skipped and not charged. |
| `postedAfter`, `postedBefore` | First day shown: a date (`2026-09-01`) or a period before now (`7 days`, `2 weeks`). Read on the ad page, which is then opened for every ad. |
| `minDaysRunning`, `activeOnly` | Ads that ran at least this many days (`30`), or still running; read on the ad page like the date filters. |
| `excludeKeywords` | Drop the ads whose text, headline or advertiser contains one of these words (`hiring`), case and accents ignored. Whole words only: `ai` drops "AI tools for teams" but keeps "retail". Several words in one entry (`hand made`) must appear together, in that order. Chinese, Japanese, Korean, Thai, Lao, Khmer and Burmese words are found anywhere in the text (no spaces there). Without **Ad details**, only the start of the text shown on the ad card (about 120 characters) is read. |
| `onlyNew`, `stateKey`, `resetState` | Monitoring: only the ads never delivered under this memory key (`crm-ads-eu`); `resetState` forgets the memory. |
| Advanced | `proxyConfiguration` (included in the price; the residential Apify proxy is not available), `maxConcurrency`, `maxRequestsPerMinute`, `minRequestIntervalMs`, `maxRequestRetries`, `debugLog`. |

### 📦 Output

A real ad with **Ad details** on (long lists shortened):

```json
{
    "recordType": "ad",
    "id": "1649630546",
    "url": "https://www.linkedin.com/ad-library/detail/1649630546",
    "title": "[Live event] Meet the EU AI Act.",
    "adFormat": "image",
    "formatLabel": "Single Image Ad",
    "creativeType": "SPONSORED_STATUS_UPDATE",
    "advertiserName": "LaunchDarkly",
    "advertiserId": "3749939",
    "advertiserUrl": "https://www.linkedin.com/company/3749939",
    "advertiserType": "company",
    "advertiserHeadline": null,
    "advertiserLogoUrl": "https://media.licdn.com/dms/image/v2/C560BAQFYzutyDFZMfw/company-logo_100_100/company-logo_100_100/0/1656691661998/launchdarkly_logo",
    "memberName": null,
    "memberProfileUrl": null,
    "payer": "CATAMORPHIC CO.",
    "body": "Can you answer what regulators ask? Join this live session and learn how LaunchDarkly can prepare you for the new EU AI Act.",
    "bodyIsTruncated": false,
    "headline": "[Live event] Meet the EU AI Act.",
    "headlineDescription": null,
    "callToAction": "Register",
    "landingUrl": "https://LaunchDarkly.com",
    "landingDomain": "launchdarkly.com",
    "utmParameters": {},
    "linksInText": [],
    "imageUrl": "https://media.licdn.com/dms/image/v2/D5610AQFrpdN54u26AQ/image-shrink_1280/B56aEzJsRIIQAc-/0/1791859541370",
    "imageUrls": ["https://media.licdn.com/dms/image/v2/D5610AQFrpdN54u26AQ/image-shrink_1280/B56aEzJsRIIQAc-/0/1791859541370"],
    "imageText": null,
    "imageTexts": [],
    "videoUrl": null,
    "videoFiles": [],
    "videoTranscript": null,
    "videoLanguage": null,
    "adTags": null,
    "carouselCards": [],
    "documentTitle": null,
    "documentPageCount": null,
    "documentPageImageUrls": [],
    "hashtags": [],
    "event": null,
    "message": null,
    "firstShown": "2026-10-19",
    "lastShown": "2026-10-21",
    "publishedAt": "2026-10-19",
    "daysRunning": 3,
    "isActive": true,
    "hasEuData": true,
    "impressions": "< 1k",
    "impressionsMin": 0,
    "impressionsMax": 1000,
    "impressionsByCountry": [
        { "country": "United Kingdom", "countryCode": "GB", "share": 58, "impressionsMin": 0, "impressionsMax": 580 },
        { "country": "Germany", "countryCode": "DE", "share": 16, "impressionsMin": 0, "impressionsMax": 160 },
        { "country": "France", "countryCode": "FR", "share": 8, "impressionsMin": 0, "impressionsMax": 80 }
    ],
    "topCountry": "GB",
    "targetingLanguage": "English",
    "targetingLocations": ["Germany", "Switzerland", "Netherlands", "France", "Israel", "Sweden", "Norway", "United Kingdom"],
    "targetingExcludedLocations": [],
    "targetingParameters": [
        { "parameter": "Audience", "targeted": true, "excluded": false },
        { "parameter": "Company", "targeted": false, "excluded": false },
        { "parameter": "Job", "targeted": true, "excluded": true }
    ],
    "variantCount": 1,
    "detailsScraped": true,
    "adCount": null,
    "position": 3,
    "searchQuery": "software",
    "searchUrl": "https://www.linkedin.com/ad-library/search?keyword=software&countries=FR",
    "scrapedAt": "2026-10-21T15:07:03.823Z"
}
```

You can download the dataset in various formats such as JSON, HTML, CSV or Excel. With **What to return** = `counts`, each row is one search: `recordType` `count`, `adCount`, `searchQuery`, `searchUrl`.

#### All 63 fields

| Fields | What you get |
| --- | --- |
| `recordType`, `id`, `url` | `ad` (or `count`), the LinkedIn ad id, its Ad Library page |
| `title`, `adFormat`, `formatLabel`, `creativeType` | headline (or start of the text), `image` / `video` / `carousel`…, LinkedIn's own format names |
| `advertiserName`, `advertiserId`, `advertiserUrl`, `advertiserType`, `advertiserHeadline`, `advertiserLogoUrl` | **Advertiser**: `LaunchDarkly`, `3749939`, its LinkedIn page, `company` or `member`, the member's headline, logo |
| `memberName`, `memberProfileUrl` | **Member**: the person who posted the ad when a company paid for it (`Michael Sakowski`, his LinkedIn profile); `null` for an ad of a company or of a member who is the advertiser. The profile link comes with Ad details |
| `payer` | "Paid for by" — `CATAMORPHIC CO.` |
| `body`, `bodyIsTruncated`, `headline`, `headlineDescription`, `callToAction` | full text (or the card's start of it, then `bodyIsTruncated` is true), headline, text under it, button |
| `landingUrl`, `landingDomain`, `utmParameters`, `linksInText` | **Landing page**: URL without LinkedIn tracking, `launchdarkly.com`, `{"utm_source": "linkedin"}`, links of the text (lnkd.in decoded) |
| `videoTranscript`, `videoLanguage` | **Speech in the videos**: what is said in the first 60 seconds of the video, its language code (`en`) |
| `imageText`, `imageTexts` | **Text in the images**: text of the main image, text of every image in the order of `imageUrls` (`null` for an image without text) |
| `adTags` | **Ad tags**: `language`, `ctaIntent`, `offerType`, `funnelStage`, `targetFunction`, `sentiment`, each `{"value": "register", "confidence": 0.88}` (both `null` when not sure enough); `null` when the option is off |
| `imageUrl`, `imageUrls`, `videoUrl`, `videoFiles`, `carouselCards` | **Media**: main image, every image, best MP4, every MP4 with its bitrate, carousel cards (title, image, link) |
| `documentTitle`, `documentPageCount`, `documentPageImageUrls` | document ads: title, `19` pages, preview page images |
| `hashtags`, `event`, `message` | hashtags of the text; event (name, time, location, organizer); message ad (sender, picture, text, buttons) |
| `firstShown`, `lastShown`, `publishedAt`, `daysRunning`, `isActive` | **Run dates**: `2026-10-19`, `2026-10-21`, same as `firstShown`, `3`, still running |
| `hasEuData`, `impressions`, `impressionsMin`, `impressionsMax` | **Reach**: EU data published, `< 1k`, `0`, `1000` |
| `impressionsByCountry`, `topCountry` | share of impressions per country (min / max = share × total range; a country LinkedIn shows as "< 1 %" has `share` 1 and counts from 0 to 1 % of the top of the range), `GB` |
| `targetingLanguage`, `targetingLocations`, `targetingExcludedLocations`, `targetingParameters` | **Targeting**: `English`, included and excluded locations, each targeting type targeted / excluded |
| `variantCount`, `detailsScraped` | versions of the ad on its page, whether the ad page was read |
| `adCount` | count rows: number of ads LinkedIn finds for the search |
| `position`, `searchQuery`, `searchUrl`, `scrapedAt` | rank in its search (newest first), the input that found it, the search URL, ISO timestamp |

### 💡 Tips

#### How to get more results

Set `maxItems` to `0` and leave **Countries** empty: LinkedIn then returns every ad of the search, newest first, and the Actor reads every page. An advertiser's company ID (`advertiserId` of any of its ads, read with **Ad details**) is more precise than its name, which LinkedIn matches loosely.

#### How to reduce costs

The price is per ad, so the levers are `maxItems`, `maxItemsPerQuery`, the filters and `onlyNew` for recurring runs (you never pay twice for the same ad). Tick **Ad details** only when you need what is on the ad page. To follow how many ads an advertiser runs, `resultType` = `counts` reads one page per search and returns a single row. LinkedIn's own filters (**Countries**, **Period**, impressions, targeting) are free: prefer them to the Actor's filters.

#### Several searches in one run

Fill `searchQueries`, `companies`, `companyIds` and / or `payers`: the Actor runs one search per keyword × advertiser, an advertiser being one name, one company ID or one payer, each searched on its own (2 keywords × 1 name, 1 company ID and 1 payer = 6 searches, up to 500 per run). A search URL pasted in `startUrls` is a search of its own. An ad found by several searches is saved — and charged — once. Set `maxItemsPerQuery` to give every search its own cap: without it the first searches can use up the whole `maxItems` budget.

#### Monitoring: only the new ads

Tick **Only new ads** (`onlyNew`) and schedule the Actor. The first run returns everything; each later run skips the ads already delivered: they are not saved, not charged, and their ad page is not even opened (an ad given by **Ad IDs** included). The memory lives in a named key-value store of your account (`linkedin-ads-library-scraper-seen`, up to 150,000 ads per key) and is only updated with ads that really reached the dataset, so a failed run never hides anything. Give each schedule its own `stateKey` (two schedules sharing a key would hide each other's ads), and tick `resetState` once to start over. LinkedIn lists the newest ads first, so a search stops once it meets 120 ads in a row that you already have.

#### Filter by run dates

LinkedIn's **Period** (`dateOption`, `startDate`, `endDate`) filters on its side, for free. The Actor's `postedAfter`, `postedBefore`, `minDaysRunning` and `activeOnly` read the exact run dates on each ad page: each ad page is opened, and a kept ad comes with all its details (charged as an ad with its ad page). Run dates are published for EU-shown ads only, so ads without dates are dropped. Combine both: the period cuts what is read, the Actor's filter keeps the exact days.

### 🔌 Integrations and API

Call the Actor via the Apify API, the JavaScript or Python clients, or connect it with integrations and webhooks (Make, Zapier, n8n, Google Sheets, Slack, Airtable…). The dataset can be fetched as JSON or CSV from any tool.

### 🤖 Use with AI agents (MCP)

AI agents (Claude, ChatGPT, Cursor…) can find and run this Actor through the [Apify MCP server](https://mcp.apify.com), billed to their Apify account like any run. It returns one item per LinkedIn ad (or one count per search). Actor id: `nice_dev/linkedin-ads-library-scraper`; MCP server with this Actor only: `https://mcp.apify.com/?tools=fetch-actor-details,nice_dev/linkedin-ads-library-scraper`.

Smallest input, for a cheap first call:

```json
{
    "companies": ["HubSpot"],
    "maxItems": 10
}
```

Key output fields: `url`, `advertiserName`, `adFormat`, `body`, `imageUrl`, and with `extractDetails`: `landingUrl`, `firstShown`, `impressions`, `impressionsByCountry`, `targetingParameters`.

Cost: pay per event, per ad saved (from $0.14 per 1,000 ads on the Gold plan to $0.44 on the Free plan, $0.42 to $0.45 with the ad page) plus $0.01 per run start, see the pricing section above and the **Pricing** tab. Cap each call with `maxItems` and, through the API, with the run option `maxTotalChargeUsd`.

### ❓ FAQ

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

The Actor only reads what the LinkedIn Ad Library shows publicly to any anonymous visitor: ads LinkedIn publishes for transparency. It logs in to nothing and needs no LinkedIn account. Results can contain personal data (the names of members who run thought-leader ads or send message ads), which is protected by GDPR: do not store it without a legitimate reason. You are responsible for using the data in compliance with LinkedIn's Terms of Use and applicable law. This Actor is not affiliated with LinkedIn.

#### Does it need a login or a proxy?

No login. The proxy is included in the price: leave the default setting (the residential Apify proxy is not available). A request the site turns away is retried at once on a new proxy session, up to 10 times on top of the retries (without a proxy, after a pause of 5 seconds, doubled at each retry up to 60 seconds). A page the site turns away on our default proxy is retried at once through a residential proxy of ours, at no extra cost to you.

#### Why do some ads have no dates, impressions or targeting?

LinkedIn publishes them only for ads shown in the EU / EEA (`hasEuData`). Add an EU country (`FR`, `DE`, or the group `EU`) to **Countries** to get them on almost every ad; with US-only ads they are mostly empty.

#### Is the data safe to open in Excel or to show on a web page?

Ad texts are the advertisers' own words, copied as they are. A text can begin with `-`, `+`, `=` or `@` (a headline such as `+30% leads`): Excel and Google Sheets may read such a cell of a CSV file as a formula or as a number. The Actor leaves the text as it is, so that the JSON and the API give the real value: when you open a CSV, import these columns as text. On a web page, escape every field like any text written by a stranger.

#### Known limitations

- Company details (industry, size, website, followers) are not in the Ad Library: the Actor returns the advertiser's name, ID, LinkedIn page and logo.
- Fields of the ad page are `null` (or `[]`) when **Ad details** is off and no date filter is set; `detailsScraped` says which.
- With **Ad details** every ad is one more request to LinkedIn, so such a run is several times slower than a run on the ad cards alone (LinkedIn answers a burst with HTTP 429: the Actor waits and tries again, nothing is lost).
- With **Ad details** and several requests in parallel, rows are saved in the order the ad pages arrive, not in LinkedIn's order: sort by `position` (rank in the search, 1 = newest) to get it back. The ads kept are always the first ones of the search.
- Many ads outside the EU / EEA have no run dates, impressions or targeting: those fields stay `null` (on a large run of mostly US ads, more than half of the rows).
- `onlyNew` remembers ad ids, not their content: an ad whose impressions grew is not returned again.
- Two runs sharing the same `stateKey` at the same time may both return the same new ad.
- Site filters that are not in the input can still be used by pasting a filtered Ad Library URL into `startUrls`.
- **Ad tags** are read from the words of the ad (its text, headline, button, and the text of its images or the speech of its video when those options are on): an ad with very little text gets few tags, and the sentiment is given for English ads only. A tag the Actor is not sure about stays `null` rather than a guess.

**A run that reaches its timeout** stops itself about 45 seconds before it: no new page is asked, what it read is saved and, with `onlyNew`, remembered, and the run ends *Succeeded* with "Stopped before the run's timeout". Resurrect it to go on from there, or give the next run a longer timeout (Run options).

**A run the platform stops without warning** (out of memory)

- Resurrect it: it goes on from where it stood at most a minute before the stop. What it had read since is read again, and the ads already saved are skipped: none is delivered or charged twice, and `maxItems` still counts them.
- With `onlyNew`, the memory is saved after each write (at most once every 2 seconds): resurrect the stopped run and the ads it had saved meanwhile join the memory; leave it stopped for good, and the next run may return the ads of its last 2 seconds once more.

#### Something doesn't work?

The last line of the log counts the ads saved, filtered out and no longer in the Ad Library (removed while the run was reading them), and the requests that failed after every retry. Those requests and the removed ads are listed, with the reason, in the `FAILED_REQUESTS` record of the run's key-value store. A run that saved nothing and had failed requests fails, and its last message gives the cause.

If LinkedIn changes its pages, you are told instead of paying for blank rows. A results page that counts ads but gives none the Actor can read is an error (listed in `FAILED_REQUESTS`), never a quiet "No ads found". If the first 20 ads read all lack their headline or advertiser — or, with the ad page, their payer, or the run date of an EU-shown ad — the run saves nothing more, stops and fails, and its last message names the missing field: at most those first ads are charged. An ad that **First shown after** / **before** drops because it has no date at all counts among those 20. A run of fewer ads (a scheduled `onlyNew` run that finds a few new ones, a small **Max ads**) is checked at its end, from 5 ads: its ads are already saved, and the run fails with the missing field instead of ending green.

### 🛟 Support

Open an issue in the **Issues** tab with a link to your run: the run log and the `FAILED_REQUESTS` record of the key-value store show exactly which URLs failed and why.

# Actor input Schema

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

LinkedIn Ad Library links: search-result URLs (`https://www.linkedin.com/ad-library/search?...`, every filter set on the site is kept, pagination is automatic), single ad URLs (`https://www.linkedin.com/ad-library/detail/1649718966`) or company pages with a numeric id (`https://www.linkedin.com/company/2802`). Added to the searches of the fields below: a search URL keeps its own LinkedIn filters, while the Actor's filters, caps and monitoring apply to every ad. Max 1 000 URLs.

## `query` (type: `string`):

Words found in the ad text or advertiser, exactly as typed in the Ad Library search box (e.g. `software`). Empty = no keyword (then give an advertiser, a company ID or a payer).

## `searchQueries` (type: `array`):

Several keywords in one run: one search per keyword. Added to **Search keyword**; ads found by several searches are saved once. All search fields together give at most 500 searches (max 500 searches per run).

## `companies` (type: `array`):

Advertiser (company page) names, as in the Ad Library "Advertiser" box (e.g. `HubSpot`): one search per name. LinkedIn matches loosely (similar names come too): tick **Exact advertiser name** to keep only this advertiser, or use **Company IDs**. With a keyword, every keyword is searched for every advertiser. All search fields together give at most 500 searches (max 500 searches per run).

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

LinkedIn company IDs (`68529`) or company URLs with that ID (`https://www.linkedin.com/company/68529`): exact advertiser, no look-alikes. The ID is in the advertiser link of any ad (`advertiserId` in the results, filled with **Ad details**). With keywords, each one is searched for every keyword. All search fields together give at most 500 searches (max 500 searches per run).

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

Who paid for the ads ("Paid for by" on LinkedIn, e.g. an agency): one search per payer. With keywords, each one is searched for every keyword. All search fields together give at most 500 searches (max 500 searches per run).

## `adIds` (type: `array`):

Single ads by ID (`1649718966`) or ad URL. Each one is read on its ad page and charged as a result with details.

## `resultType` (type: `string`):

`ads` = one row per ad. `counts` = one row per search with the number of ads LinkedIn finds (1 request per search, no ad rows, charged per search): to size a market or follow an advertiser's volume over time.

## `maxItems` (type: `integer`):

Maximum number of ads to save for the whole run (after deduplication and filters). 0 = no limit. Not used with **What to return** = counts (one row per search).

## `maxItemsPerQuery` (type: `integer`):

Cap for EACH search (keyword, advertiser, company ID, payer or search URL), so that the first search cannot use up the whole **Max ads** budget. 0 = no per-search cap.

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

Countries where the ads were shown: ISO codes (`FR`, `DE`, `US`) or English names, plus the groups `EU` (27 EU countries), `EEA`, `DACH`, `NORDICS`. Empty = all countries. Impressions, run dates and targeting are only published for ads shown in the EU / EEA: add an EU country to get them on (almost) every ad.

## `dateOption` (type: `string`):

When the ads ran (LinkedIn filter). `Custom` uses **Ran after** / **Ran before** below. The Ad Library keeps the last 12 months.

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

First day of a custom period (LinkedIn filter): `2026-09-01`, or a period before now such as `30 days`, `3 months`. Filling it sets **Period** to custom. LinkedIn keeps 12 months: an older day is moved to the oldest day kept.

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

Last day of a custom period (included), or a period before now such as `7 days`. Empty = yesterday: LinkedIn has the ads up to yesterday, a later day is moved back to it.

## `impressionsMin` (type: `integer`):

Only ads with at least this many impressions (LinkedIn filter on its impression ranges, e.g. `1000`, `100000`). 0 = no minimum. Impressions exist for EU-shown ads only.

## `impressionsMax` (type: `integer`):

Only ads with at most this many impressions (LinkedIn filter). 0 = no maximum.

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

Only ads whose advertiser targeted members with these parameter types (LinkedIn filter).

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

Only ads whose advertiser excluded members with these parameter types (LinkedIn filter).

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

Keep only these formats (read on the ad card; a dropped ad is not saved and not charged as a result). Empty = all formats.

## `extractDetails` (type: `boolean`):

Open each ad page (1 extra request per ad) for what LinkedIn shows only there: full text, landing URL with UTM tags, call to action, all images / video files / carousel cards / document / event / message content, payer, run dates, total impressions (range + min / max numbers), impressions by country, targeting (language, locations, targeted / excluded parameter types). Charged as a result with details instead of a result (see Pricing). Off = ad-card fields only (advertiser, format, start of the text, headline, image).

## `decodeShortLinks` (type: `boolean`):

With **Ad details**: turn the lnkd.in short links of the ad text into their real address (1 small extra request per link, free). Off = short links as written.

## `imageText` (type: `boolean`):

AI reads the text written in the ad images (offer, dates, brand, call to action): fields **imageText** (main image) and **imageTexts** (every image, up to 10 per ad). Latin-script text only (English, French, German, Spanish, Italian, Portuguese...). Charged per image where text is found, on top of the result (see Pricing); an image without readable text is free. Needs 2 GB of memory (Run options): with less the option is skipped and not charged.

## `videoTranscript` (type: `boolean`):

AI writes down what is said in the ad videos (first 60 seconds of sound) into **videoTranscript**, with the language in **videoLanguage**. Charged per video where speech is found, on top of the result with details (see Pricing); music only or no sound = empty and free. The video files are on the ad page, so this option opens each ad page (charged as a result with details). Needs 2 GB of memory (Run options): with less the option is skipped and not charged.

## `adTags` (type: `boolean`):

AI tags each ad in the field **adTags**: language (ISO 639-1 code), ctaIntent (learn_more, register, download, sign_up, book_demo, contact, buy, apply), offerType (event, content, free_trial, demo, discount, product, job, course), funnelStage (awareness, consideration, conversion), targetFunction (the job the ad speaks to: marketing, sales, engineering, it, hr, finance, executive, operations, legal, customer_service, healthcare, education) and sentiment (English ads only: positive or neutral). Each tag comes with a confidence from 0 to 1, and is null when the Actor is not sure enough. The tags also read the text in images and the speech in videos when those options are on. Charged per ad with at least one tag, on top of the result (see Pricing); an ad with no tag is free. Needs 2 GB of memory (Run options): with less the option is skipped and not charged.

## `exactAdvertiserMatch` (type: `boolean`):

With **Advertiser names**: drop the look-alike advertisers LinkedIn adds (names compared without case or accents). Free.

## `postedAfter` (type: `string`):

Only ads first shown on or after this date: `2026-09-01`, or a period before now such as `7 days`, `2 weeks`. Read on the ad page (run dates are published for EU-shown ads only): with this filter each ad page is opened, so a kept ad comes with all its details and is charged as a result with details (see Pricing); ads without dates are dropped. To filter on LinkedIn's side instead, use **Period**.

## `postedBefore` (type: `string`):

Only ads first shown on or before this date (the whole day is included), or older than a period such as `30 days`.

## `excludeKeywords` (type: `array`):

Drop the ads whose text, headline or advertiser name contains one of these WHOLE words (case and accents ignored): `ai` drops "AI tools for teams" but keeps "retail". Several words in one entry (`hand made`) must appear together, in that order. Chinese, Japanese, Korean, Thai, Lao, Khmer and Burmese words are found anywhere in the text (no spaces there). Without **Ad details**, only the start of the text shown on the ad card (about 120 characters) is read.

## `minDaysRunning` (type: `integer`):

Only ads that ran for at least this many days (run dates of the ad page: each page is opened, so a kept ad comes with all its details and is charged as a result with details; ads without dates are dropped). 0 = off.

## `activeOnly` (type: `boolean`):

Only ads whose last run day is today or yesterday (run dates of the ad page: each page is opened, so a kept ad comes with all its details and is charged as a result with details; ads without dates are dropped).

## `onlyNew` (type: `boolean`):

Skip the ads that a previous run (same **Memory key**) already delivered: they are not saved and not charged, and their page is not even opened (an ad given by **Ad IDs** included). First run = everything is new.

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

Name of the memory used by **Only new ads**. Give each schedule / task its own key (e.g. `hubspot-ads`) so that they do not share their memory. Letters, digits, `-` and `_`.

## `resetState` (type: `boolean`):

Forget everything remembered under this **Memory key** before the run: this run returns (and charges) every ad again. Untick it afterwards.

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

Apify Proxy or your own proxies. Keep the default: it is included in the price. The residential Apify proxy is not available in this Actor.

## `maxConcurrency` (type: `integer`):

Maximum number of requests processed in parallel.

## `maxRequestsPerMinute` (type: `integer`):

Most requests to the site in any 60 seconds, all of them counted: results pages and ad pages. A budget, not an even pace: up to this many can leave at once when the minute starts (spread them with the minimum delay below). Lower it if the site answers HTTP 429 / 403 in the log.

## `minRequestIntervalMs` (type: `integer`):

Smallest gap between two requests, in milliseconds. Unlike the per-minute rate, this spreads the requests evenly instead of letting them go out in a burst. 0 = no gap.

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

Retries per request before it is marked as failed. Behind a proxy, a request the site turns away is also retried on a new proxy session up to 10 times without using up these retries.

## `debugLog` (type: `boolean`):

Include debug messages in the run log.

## Actor input object example

```json
{
  "startUrls": [],
  "query": "software",
  "searchQueries": [],
  "companies": [],
  "companyIds": [],
  "payers": [],
  "adIds": [],
  "resultType": "ads",
  "maxItems": 100,
  "maxItemsPerQuery": 0,
  "countries": [],
  "dateOption": "all",
  "impressionsMin": 0,
  "impressionsMax": 0,
  "targetingIncludes": [],
  "targetingExcludes": [],
  "adFormats": [],
  "extractDetails": false,
  "decodeShortLinks": true,
  "imageText": false,
  "videoTranscript": false,
  "adTags": false,
  "exactAdvertiserMatch": false,
  "excludeKeywords": [],
  "minDaysRunning": 0,
  "activeOnly": false,
  "onlyNew": false,
  "stateKey": "default",
  "resetState": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "maxConcurrency": 4,
  "maxRequestsPerMinute": 60,
  "minRequestIntervalMs": 1000,
  "maxRequestRetries": 5,
  "debugLog": false
}
```

# Actor output Schema

## `results` (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 = {
    "query": "software",
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("nice_dev/linkedin-ads-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 = {
    "query": "software",
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("nice_dev/linkedin-ads-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 '{
  "query": "software",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call nice_dev/linkedin-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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