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

Collect ads from the public LinkedIn Ad Library by company name, keyword, or URL. Extracts ad text, MP4 video links, UTM destination URLs, paying entities, EU impressions, and targeting settings without login.

- **URL**: https://apify.com/gutacker/linkedin-ad-library.md
- **Developed by:** [Frank-Ringo Gutacker](https://apify.com/gutacker) (community)
- **Categories:** Marketing, Social media, Agents
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 92.9% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 linkedin ad results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## LinkedIn Ad Library Scraper

<p align="center">
  <img src="https://api.apify.com/v2/key-value-stores/6QYUU1aPOYtTzoLON/records/linkedin-ad-library-pro-512.png" alt="LinkedIn Ad Library Scraper" width="128" />
</p>

Scrape ads from the public LinkedIn Ad Library by company name, keyword, or Ad Library URL, without a LinkedIn login. For each ad you get the advertiser, ad format, headline and ad copy, and with detail pages switched on also the destination URL with its UTM parameters, video links, the paying legal entity, run dates, and EU impression and targeting disclosures. Export the results as JSON, CSV, or Excel, or call the Actor through the Apify API.

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

| Data | Fields | Needs `fetchAdDetails` |
| :--- | :--- | :--- |
| Ad identity | `adId`, `adLibraryUrl`, `query`, `queryType`, `scrapedAt` | No |
| Advertiser | `advertiserName`, `advertiserLogoUrl` | No |
| Advertiser (detail page) | `advertiserCompanyId`, `advertiserLinkedinUrl`, `paidForBy` (legal entity paying for the ad) | Yes |
| Creative | `format`, `formatLabel`, `adHeadline`, `adBodyText`, `previewImageUrl`, `imageUrls` | No (ad copy is complete only with details) |
| Video | `videoUrl`, `videoStreams` (MP4 links with bitrate, when LinkedIn exposes them) | Partly; full list needs details |
| Call to action and destination | `ctaText`, `landingPageUrl` (full `utm_*` and `hsa_*` parameters), `landingDomain` | Yes |
| Run dates | `firstShownDate`, `lastShownDate`, `daysActive`, `isActive` (`null` when LinkedIn shows no dates) | Yes |
| EU Digital Services Act data | `impressionsRange`, `impressionsMin`, `impressionsMax`, `countryImpressions`, `targetingSegments`, `targetingFacets` | Yes |

A full record is shown under [Sample Output](#sample-output).

### Why scrape LinkedIn ads? Use cases

- **Competitor ad monitoring:** collect the ads a competitor currently runs on LinkedIn, with headline, copy, format, and landing page.
- **Campaign and UTM research:** read the destination URLs and tracking parameters to see which landing pages and campaign naming schemes an advertiser uses.
- **Long-running ads:** set `minDaysActive` to keep only ads that have run for at least that many days, a rough signal of ads an advertiser keeps paying for.
- **Creative swipe files:** gather image, video, carousel, and document ads by keyword or format for design and copy inspiration.
- **EU transparency analysis:** for ads shown in the EU, read the disclosed impression ranges, country shares, and targeting settings.
- **Lead research:** see which companies advertise a topic (for example a keyword such as `SOC2`) and which entity pays for the ads.

### How to scrape the LinkedIn Ad Library

1. Open the Actor on Apify and go to the **Input** tab.
2. Enter at least one company name in **Company / Advertiser Names**, a search term in **Keywords**, or an Ad Library URL in **Direct LinkedIn Ad Library URLs**.
3. Optionally set a country (`DE` or `DE,FR,NL`), ad format, date window, **Max Ads per Query**, and **Fetch Ad Detail Pages** (needed for destination URLs, run dates, and EU data).
4. Start the run. The default proxy is Apify Residential (see the cost section below).
5. Open the **Output** tab and download the dataset as JSON, CSV, Excel, or HTML, or read it through the API.

To run it regularly, create a Schedule in Apify Console, or call it from n8n, Make, Python, or an MCP client (see [Integrations](#integrations-n8n-make-mcp--python)).

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

You pay per returned ad, with no start fee: `ad` costs $0.002 per ad ($2.00 per 1,000), and `ad-detail` costs another $0.002 per ad ($2.00 per 1,000) when the ad's detail page was loaded.

| Run | Calculation | Event cost |
| :--- | :--- | :--- |
| 1,000 ads, search results only (`fetchAdDetails` off) | 1,000 x $0.002 | $2.00 |
| 1,000 ads with detail data (`fetchAdDetails` on) | 1,000 x $0.002 + 1,000 x $0.002 | $4.00 |
| 24 ads (the default `maxAdsPerQuery`) with detail data | 24 x $0.004 | $0.096 |

These figures assume every detail page loads successfully. They are the full price: platform usage, including the Apify Residential proxy traffic that platform runs use, is paid by the Actor owner and not charged to you. Ads that are inspected but filtered out (for example by `minDaysActive`) are not billed. The billing rules are listed in full under [Pricing](#pricing).

### How it works

This scraper reads ads from the public LinkedIn Ad Library (`linkedin.com/ad-library`) by company name, keyword, or direct URL. It uses plain HTTP/2 requests without a LinkedIn login or browser automation, so your LinkedIn account is never involved and runs stay within 256 MB RAM. The HTTP client keeps an in-memory cookie jar for the anonymous session cookies LinkedIn sets during the run; nothing is stored between runs.

Search results give you the ad ID, company name, ad format, headline, body preview, and image thumbnail. Turning on `fetchAdDetails` loads each ad's detail page as well. That fills in untruncated ad copy, click-through URLs with their full `utm_*` and `hsa_*` query parameters, progressive MP4 video links sorted by bitrate, the legal entity paying for the ad, first and last shown dates, and EU Digital Services Act data (impression ranges, country shares, and whether job, company, or retargeting lists were targeted or excluded).

If you only want long-running ads, set `minDaysActive` to a threshold such as `30` or `60`. Shorter campaigns are filtered out before being written to the dataset. Each inspected ad needs its own detail-page request, and ads that are filtered out are not billed, so scanning is bounded: a query stops after 50 consecutive inspected ads without a match (hit rate below roughly 6%), and in any case after 5 x `maxAdsPerQuery` inspected ads (at most 5,000). The same stop rule applies to the `adFormat` and advertiser-name filters. When a scan is stopped, the log states the numbers (`inspected`, `collected`, detail fetches) and `RUN_SUMMARY.inspectionStops` counts it. If that stops a query too early for you, raise `maxAdsPerQuery` or narrow the search with `countries` and `dateOption`. LinkedIn shows no run dates ("Ran from") for some ads, mostly new ones. `minDaysActive` skips those ads because their age is unknown; they count as non-matches for the scan stop above and are reported in `RUN_SUMMARY.undatedAdsSkipped` and in the log, so a query that ends empty tells you why. The detail requests for skipped ads are made but not billed to you; without `minDaysActive`, such ads are delivered with `firstShownDate`, `lastShownDate`, `daysActive` and `isActive` set to `null`.

### Input Example

```json
{
  "advertisers": ["HubSpot", "Personio"],
  "countries": "DE",
  "adFormat": "ALL",
  "maxAdsPerQuery": 24,
  "fetchAdDetails": true,
  "minDaysActive": 14
}
```

### Input Fields

| Field | Type | Default | Notes |
| :--- | :--- | :--- | :--- |
| `advertisers` | `string[]` | `[]` | Company or advertiser names (provide at least one of `advertisers`, `keywords`, or `adUrls`; single-field `query`, `company`, or `advertiser` also accepted). LinkedIn matches the name anywhere inside an advertiser's name, so only ads whose advertiser name equals the requested name or starts with it (ignoring case, punctuation and legal forms such as Inc./GmbH) are kept: `HubSpot` keeps "HubSpot, Inc." and "HubSpot for Developers" but drops "IXTENSA HubSpot". An advertiser whose LinkedIn name puts something in front of the brand (for example "DB Deutsche Bahn") is only kept if you enter that exact displayed name. Dropped ads are not charged and are counted in `RUN_SUMMARY.advertiserMismatchDropped`. Use `keywords` to search without this filter. |
| `keywords` | `string[]` | `[]` | Search terms across all LinkedIn ads |
| `adUrls` | `string[]` | `[]` | Direct `/ad-library/search` or `/ad-library/detail/<id>` URLs. Only `https://www.linkedin.com/ad-library/...` (or `linkedin.com`) URLs are accepted; anything else is listed as a failed input in `RUN_SUMMARY` and is never fetched. Duplicate inputs (same advertiser or keyword ignoring case, same URL) are processed once. Direct detail URLs are processed before all search inputs, so an ad you request by its detail URL is delivered with its detail data even when a search in the same run would also find it (every ad is delivered at most once per run; the search then skips it as a duplicate). |
| `countries` | `string` | `"ALL"` | `"ALL"` or ISO-2 codes like `"DE"` or `"DE,FR,NL"` |
| `adFormat` | `string` | `"ALL"` | `ALL`, `IMAGE`, `VIDEO`, `CAROUSEL`, `DOCUMENT`, `EVENT`, `TEXT` |
| `dateOption` | `string` | `"ALL"` | `ALL`, `last-30-days`, `current-month`, `current-year`, `last-year`, `custom-date-range` |
| `startDate` | `string` | `""` | Start date `YYYY-MM-DD` when `dateOption` is `custom-date-range` (LinkedIn allows the past 12 months) |
| `endDate` | `string` | `""` | End date `YYYY-MM-DD` when `dateOption` is `custom-date-range` |
| `maxAdsPerQuery` | `integer` | `24` | Max ads per query (`1` to `5000`) |
| `fetchAdDetails` | `boolean` | `false` | Load detail pages for UTM links, MP4 streams, dates, and EU disclosures |
| `minDaysActive` | `integer` | `0` | Minimum run length in days (`0` disables filtering; `> 0` automatically enables `fetchAdDetails`). Scanning stops after 50 consecutive ads without a match. |
| `concurrency` | `integer` | `8` | Parallel detail-page requests (`1` to `20`); only used when detail pages are loaded |
| `proxyConfiguration` | `object` | `{"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}` | Platform runs default to Apify `RESIDENTIAL` proxies because LinkedIn blocks cloud/AWS datacenter IPs (`HTTP 403`) and Apify Proxy restricts `linkedin.com` on datacenter pools (`HTTP 597`). You can also supply custom external residential/ISP `proxyUrls` (`{"useApifyProxy": false, "proxyUrls": ["http://user:pass@host:port"]}`). Local runs (`apify run`) automatically skip Apify Proxy unless `APIFY_USE_PROXY_LOCALLY=1`, and accounts without `RESIDENTIAL` access fall back to direct HTTP/2 (expect `HTTP 403` there). A proxy connection error is retried on a fresh proxy session. The run switches to direct requests only when one request has failed on 3 different proxy sessions in a row while no other request got a response through the proxy in the meantime; a short proxy outage that hits several parallel requests at once does not switch it. The switch is logged as a warning and counted in `RUN_SUMMARY` (`proxyErrors`, `proxyFallbackActivations`). |

### Sample Output

```json
{
  "query": "HubSpot",
  "queryType": "advertiser",
  "adId": "1638499894",
  "adLibraryUrl": "https://www.linkedin.com/ad-library/detail/1638499894",
  "advertiserName": "HubSpot",
  "advertiserCompanyId": "68529",
  "advertiserLinkedinUrl": "https://www.linkedin.com/company/68529",
  "paidForBy": "HubSpot, Inc.",
  "format": "VIDEO",
  "formatLabel": "Video Ad",
  "creativeTypeRaw": "SPONSORED_VIDEO",
  "adHeadline": "Mehr starke Kampagnen an den Start bringen.",
  "adBodyText": "Gutes Marketing braucht Gespür. Marketing-Studio automatisiert die Kampagnenverwaltung, damit Sie sich darauf konzentrieren können, Ihre Ideen umzusetzen.",
  "ctaText": "Learn more",
  "landingPageUrl": "https://www.hubspot.de/products/marketing/studio?utm_source=linkedin&utm_medium=paid_brandstrategy&utm_campaign=BrandStrategy_VideoViews_DE_EMEA_DACH_MarketingStudio_AnnoyinglyGood-Q4-2026_InFeed-LAN_MarketingGabby_MarketingStudio-PP-15&trk=ad_library_ad_preview_headline_content",
  "landingDomain": "www.hubspot.de",
  "previewImageUrl": "https://media.licdn.com/dms/image/v2/D4E10AQFxQp_K5Eleow/videocover-high/B4EaHErJvwIgBI-/0/1794301011337?e=2147483647&v=beta&t=pvxBt-xelw93p75Z2m_Z7XUZMETnaQYsWbgagBrP5h8",
  "videoUrl": "https://dms.licdn.com/playlist/vid/v2/D4E10AQFxQp_K5Eleow/progressive-servable-video/B4EaHErJvwIgAY-/0/1794301010627?e=2147483647&v=beta&t=eF7PSnFZjj-kuMYg-yZjr9wwo6IgpRlrtnJbk1B3o3c",
  "firstShownDate": "2026-11-11",
  "lastShownDate": "2026-11-13",
  "daysActive": 3,
  "isActive": true,
  "impressionsRange": "20k-30k",
  "impressionsMin": 20000,
  "impressionsMax": 30000,
  "countryImpressions": [
    { "country": "Germany", "sharePercent": 99.0 }
  ],
  "targetingSegments": {
    "Language": "Targeting includes English",
    "Location": "Targeting includes Germany"
  },
  "targetingFacets": {
    "Audience": { "targeted": false, "excluded": true },
    "Demographic": { "targeted": false, "excluded": false },
    "Company": { "targeted": true, "excluded": true },
    "Education": { "targeted": false, "excluded": false },
    "Job": { "targeted": true, "excluded": false },
    "Member Interests and Traits": { "targeted": false, "excluded": false }
  },
  "detailsFetched": true,
  "scrapedAt": "2026-11-13T12:51:32Z"
}
```

Date fields (`firstShownDate`, `lastShownDate`, `daysActive`, `isActive`): LinkedIn shows no run dates for some ads, mostly new ones. For those ads the four fields are `null`, even when `detailsFetched` is `true` (the detail page loaded and `ad-detail` is charged). They are also `null` when the detail page was not loaded. Treat `null` as "unknown", not as "not active".

### Pricing

Pay-Per-Event with no start fee. Every returned ad triggers `ad` ($2.00 per 1,000 ads). When `fetchAdDetails` is enabled—or when `minDaysActive > 0`, which requires loading each ad's detail page to read `firstShownDate` and `lastShownDate`—returned ads whose detail page succeeded (`detailsFetched: true`) also trigger `ad-detail` ($2.00 per 1,000 ads). A direct `/ad-library/detail/<id>` URL in `adUrls` always loads the detail page, so a successful one is charged `ad` plus `ad-detail`, even with `fetchAdDetails` off. The `ad` event is charged when the record is written; `ad-detail` is charged only after that, and never for a record that was not written (for example when your spending limit is reached). Ads filtered out before dataset output are not billed, and query diagnostics are written free of charge to `RUN_SUMMARY` in the Key-Value Store.

**Proxy traffic is not charged to you.** Platform runs fetch LinkedIn through Apify `RESIDENTIAL` proxies. With pay-per-event pricing, that traffic and all other platform usage are paid by the Actor owner, so you pay only the events above. We have not measured the traffic per 1,000 ads; it depends on how many search pages and detail pages a run loads. Search pages are requested once per page of results. Detail pages (`fetchAdDetails`, `minDaysActive > 0`, or detail URLs) add one extra request per inspected ad, and ads that are inspected but then filtered out (`minDaysActive`, `adFormat`, advertiser-name filter, duplicates) cause that request without producing a billed event. The scan limits described above bound this, but a narrow filter on a large advertiser can still load many detail pages for few results. If you pass your own `proxyUrls`, your proxy provider bills you for that traffic.

### Run Diagnostics (`RUN_SUMMARY`)

Every run writes `RUN_SUMMARY` to the Key-Value Store, even when it crashes or is aborted. It counts inputs as `succeeded` (at least one ad delivered, or all of its ads were already delivered by an earlier input), `empty` (LinkedIn answered with its "No results found" page, or every ad was filtered out) and `failed`, with `errorType`, `httpStatus` and a message per failed input in `failedInputs`. An HTTP 200 page that has neither ad cards nor the "No results found" marker (soft block, login wall, layout change) is a failed input (`UnexpectedPage`), not an empty one. With `minDaysActive` set, an input whose detail pages all failed is reported as failed (`DetailFetchFailed`) instead of empty. `detailFetchFailures` counts detail pages that could not be loaded; those ads are delivered without detail data and without the `ad-detail` charge (or skipped when `minDaysActive` could not be verified). If every input fails, the run is marked as failed. `duplicatesSkipped` counts ads that were found by more than one input. `undatedAdsSkipped` counts ads skipped by `minDaysActive` because LinkedIn shows no run dates for them, and `belowMinDaysActiveSkipped` counts ads skipped because they ran for fewer than `minDaysActive` days. `budgetStopped` counts inputs that were cut short (or never started) because your spending limit was reached or the run was aborted or migrated; they are neither `succeeded` nor `empty`, and after a restart they are run again from their saved progress, so every input is counted exactly once in the end. `addonChargeErrors` counts `ad-detail` charges that the platform rejected or that failed; the ad is still delivered (and never pushed again by a later input), only the add-on charge for it is missing, and a warning with the ad ID is logged. The counters that come from scanning result pages (`detailFetchFailures`, `duplicatesSkipped`, `undatedAdsSkipped`, `belowMinDaysActiveSkipped`, `inspectionStops`, `advertiserMismatchDropped`) are kept per input: when a cut-short input is rescanned after a restart its numbers replace the earlier ones instead of being added, and `proxyErrors` and `proxyFallbackActivations` are carried across restarts. An input that ran to its natural end is `succeeded` or `empty` even if an abort or migration was announced at the same moment. `baseChargeErrors` counts ads whose `ad` charge failed after the ad had already been written to the dataset (the SDK writes first, then charges); such an ad is delivered and counted in `itemsPushed`, is never pushed again, no `ad-detail` is charged for it, and a warning with the ad ID is logged. If the `ad` charge fails 3 times in a row (the charging API is unavailable), the Actor stops starting deliveries so no further ads are handed out unpaid: `stoppedForChargeErrors` is `true` in `RUN_SUMMARY`, the run is marked as failed with the message "Charging is unavailable; stopped to avoid delivering unpaid results", and delivered ads are kept. Resurrect the run to continue with the unfinished inputs; delivered ads are not pushed again. A successful charge resets the count.

Each ad is delivered and charged at most once per run: duplicates across advertisers, keywords and URLs are skipped before any detail request, and the delivered ad IDs and finished inputs are persisted (`LINKEDIN_RUN_STATE`), so a planned platform migration neither re-pushes nor re-charges ads: when the platform announces a migration, the Actor starts no further push or charge, saves its state immediately and continues in the new container with the remaining inputs. After an unplanned crash or resurrection, ads pushed after the most recent state save (the state is saved about every minute, so up to roughly a minute of deliveries) can be delivered and charged again; the Actor cannot rule that out.

### Integrations (n8n, Make, MCP & Python)

#### n8n / Make / REST API (`run-sync-get-dataset-items`)

Use a standard **HTTP Request** node (`POST`, Authentication: **Bearer Auth** with your `APIFY_TOKEN`) to run this Actor and receive the extracted ads directly as JSON items:

```bash
curl -X POST "https://api.apify.com/v2/acts/gutacker~linkedin-ad-library/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "advertisers": ["HubSpot", "Salesforce"],
    "countries": "DE",
    "maxAdsPerQuery": 15,
    "minDaysActive": 7,
    "fetchAdDetails": true
  }'
```

#### AI Agents & Model Context Protocol (Claude, Cursor, n8n AI Agent)

Expose this Actor as a live tool to any MCP-compatible agent via the official Apify MCP Server:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?actors=gutacker/linkedin-ad-library,gutacker/google-ads-transparency",
      "headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
    }
  }
}
```

#### Python (`apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("gutacker/linkedin-ad-library").call(run_input={
    "advertisers": ["HubSpot"],
    "countries": "DE",
    "maxAdsPerQuery": 15,
    "fetchAdDetails": True,
})
items = list(client.dataset(run["defaultDatasetId"]).iterate_items())
```

### FAQ

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

This Actor reads the public LinkedIn Ad Library pages, which do not require a login, and it does not use a LinkedIn account. This is not legal advice. Whether your use is allowed depends on your jurisdiction, LinkedIn's terms, and what you do with the data. Ad copy and advertiser fields can include names of companies and, for some ads, a person's profile, so handle the data according to the data-protection rules that apply to you, and consult a lawyer about your own use case.

#### Do I need a LinkedIn login or cookies?

No. The Actor makes anonymous HTTP requests and does not accept a LinkedIn account or cookies as input. Your LinkedIn account is never involved.

#### Can I use it with n8n, Make, or Claude via MCP?

Yes. Call the Apify API (for example the `run-sync-get-dataset-items` endpoint from an HTTP Request node in n8n or Make), use `apify-client` in Python, or add the Actor to the Apify MCP server for Claude, Cursor, or other MCP clients. Examples are in [Integrations](#integrations-n8n-make-mcp--python).

#### Why did my run return 0 results?

Open the `RUN_SUMMARY` record in the run's Key-Value Store. Common causes:

- LinkedIn answered "No results found" for that advertiser or keyword (counted as `empty`).
- With `minDaysActive`, ads were skipped because they ran fewer days, or because LinkedIn shows no run dates for them (`belowMinDaysActiveSkipped`, `undatedAdsSkipped`).
- With `advertisers`, ads from advertisers whose name does not equal or start with your input were dropped (`advertiserMismatchDropped`). Use `keywords` to search without that filter, or enter the exact name shown on LinkedIn.
- The `adFormat`, `countries`, or `dateOption` filters were too narrow.
- LinkedIn blocked the request. HTTP 403 usually means LinkedIn blocked the IP, for example when no working Residential proxy was available; see `failedInputs` for the error type and status.

If you gave no advertiser, keyword, or URL, the run fails right away with a message saying so.

#### How many ads can I get per run?

`maxAdsPerQuery` accepts 1 to 5,000 and applies to each advertiser, keyword, or URL separately. The default is 24. Scanning also stops early when many inspected ads in a row do not match your filters; the stop rules are described under [How it works](#how-it-works).

#### Which ad data is only available with detail pages?

Destination URLs with UTM parameters, call-to-action text, run dates, the paying legal entity, advertiser company ID and profile URL, and EU impression and targeting data come from each ad's detail page. Turn on `fetchAdDetails` (or set `minDaysActive` above 0, which turns it on) to get them. Impression and targeting data are disclosed by LinkedIn for EU ads, so other ads may have these fields empty.

#### Which proxy does it use, and can I use my own?

On the Apify platform the default is Residential proxy, because LinkedIn blocks datacenter IPs. The Apify proxy traffic is paid by the Actor owner, not charged to you. You can pass your own residential or ISP `proxyUrls` instead; your proxy provider then bills you for that traffic.

### Other Scrapers by gutacker

Also available: [Google Ads Transparency Scraper](https://apify.com/gutacker/google-ads-transparency) for Google Search and YouTube ads, [EU Public Tenders & Winner Company Enricher](https://apify.com/gutacker/eu-public-tenders) for European procurement leads, [Company KYB, DNS Tech Stack & NIS2 Readiness Check](https://apify.com/gutacker/company-kyb-compliance) for GLEIF LEI and security verification, [Career Site Jobs Scraper](https://apify.com/gutacker/career-site-jobs) for Greenhouse/Ashby/Lever/Personio job boards, [Shopify Store Spy](https://apify.com/gutacker/shopify-store-spy) for Shopify products and store contacts, and [App Store & Google Play Reviews](https://apify.com/gutacker/app-store-reviews) for mobile app reviews.

# Actor input Schema

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

Company names to look up, such as 'HubSpot', 'Salesforce', 'Personio', or 'Stripe' (single-field 'query', 'company', or 'advertiser' is also accepted). Only ads whose advertiser name equals the requested name or starts with it (ignoring case, punctuation and legal forms like Inc./GmbH) are returned; LinkedIn also lists ads of unrelated advertisers whose name merely contains the text. Use Keywords to search without this filter.

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

Optional search terms across LinkedIn ads, e.g. 'SOC2', 'CRM', or 'Kubernetes'.

## `adUrls` (type: `array`):

Optional https://www.linkedin.com/ad-library/search or /ad-library/detail/<id> URLs. Only https URLs on linkedin.com / www.linkedin.com with a path starting /ad-library/ are accepted; any other URL is reported as a failed input in RUN_SUMMARY and never fetched. A /ad-library/detail/<id> URL always loads the detail page and is billed 'ad' plus 'ad-detail'. Duplicate URLs (and duplicate advertisers/keywords) are processed once. Detail URLs are processed before the searches, so the detailed record wins when a search finds the same ad.

## `countries` (type: `string`):

Use 'ALL' or comma-separated ISO-2 country codes like 'DE', 'US', 'GB', or 'DE,FR,NL'. EU countries include impression and targeting disclosures in detail mode.

## `adFormat` (type: `string`):

Filter returned ads to one format or keep all.

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

Time range supported by LinkedIn Ad Library.

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

Start date when Date Window is set to 'custom-date-range' (within the past 12 months).

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

End date when Date Window is set to 'custom-date-range'.

## `maxAdsPerQuery` (type: `integer`):

Maximum ads returned per advertiser, keyword, or URL.

## `fetchAdDetails` (type: `boolean`):

Loads each ad's detail page to get full text, destination URLs with UTM parameters, MP4 video streams, legal payer, run dates, EU impression numbers, and targeting settings. Billed via 'ad-detail'.

## `minDaysActive` (type: `integer`):

Keep only ads active for at least this many days. Automatically turns on Fetch Ad Detail Pages when greater than 0. Every inspected ad needs its own detail request, so a query stops scanning after 50 consecutive ads without a match (and after at most 5 x Max Ads per Query inspected ads); inspected ads that are filtered out are not billed. LinkedIn shows no run dates for some ads (mostly new ones); with this filter above 0 those ads are skipped because their age is unknown, and they are counted in RUN_SUMMARY.undatedAdsSkipped.

## `concurrency` (type: `integer`):

Number of concurrent HTTP/2 detail requests.

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

LinkedIn blocks cloud/AWS datacenter IPs (HTTP 403) and Apify Proxy restricts linkedin.com on datacenter pools (HTTP 597). Platform runs default to Apify RESIDENTIAL proxies. Traffic per 1,000 ads has not been measured: every search page is one request, and detail pages (Fetch Ad Detail Pages, Minimum Days Active, detail URLs) add one request per inspected ad, including ads that are filtered out afterwards. You can also pass custom residential/ISP proxyUrls ({"useApifyProxy": false, "proxyUrls": \["http://user:pass@host:port"]}) or run locally via CLI without a proxy.

## Actor input object example

```json
{
  "advertisers": [
    "HubSpot",
    "Salesforce"
  ],
  "keywords": [],
  "adUrls": [],
  "countries": "DE",
  "adFormat": "ALL",
  "dateOption": "ALL",
  "startDate": "",
  "endDate": "",
  "maxAdsPerQuery": 24,
  "fetchAdDetails": true,
  "minDaysActive": 0,
  "concurrency": 8,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

No description

## `runSummary` (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",
        "Salesforce"
    ],
    "countries": "DE",
    "maxAdsPerQuery": 24,
    "fetchAdDetails": true,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("gutacker/linkedin-ad-library").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",
        "Salesforce",
    ],
    "countries": "DE",
    "maxAdsPerQuery": 24,
    "fetchAdDetails": True,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("gutacker/linkedin-ad-library").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",
    "Salesforce"
  ],
  "countries": "DE",
  "maxAdsPerQuery": 24,
  "fetchAdDetails": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call gutacker/linkedin-ad-library --silent --output-dataset

```

## MCP server setup

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

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/ZBsdsqxvke57oUHNe/builds/GPf2PnJ8e1oCj8osS/openapi.json
