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

Scrapes ads from the LinkedIn Ad Library by advertiser, keyword or link: full ad copy, headline, button, landing page, images, videos, carousels, payer, and for EU ads run dates, impressions by country and targeting. No login.

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

## Pricing

from $1.00 / 1,000 ads

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

Learn more: https://docs.apify.com/actors/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

**Scrape the LinkedIn Ad Library by advertiser, keyword or link.** Paste any search from the [LinkedIn Ad Library](https://www.linkedin.com/ad-library) and get every ad behind it as clean, structured data: **full ad text, headline, call-to-action button, landing page, image and video URLs, carousel cards, advertiser page and who paid for the ad**. For ads shown in the EU or Brazil you also get **run dates, impression ranges, impressions by country and the targeting the advertiser chose**. No LinkedIn account, login or cookies needed.

### What does LinkedIn Ad Library Scraper do?

LinkedIn Ad Library Scraper collects ads from LinkedIn's public Ad Library, the transparency archive of every ad that ran on LinkedIn in the last 12 months. It works from the inputs you already have:

- **Advertiser searches**: every ad a company has run, for example all of HubSpot's ads.
- **Keyword searches**: every ad that mentions a word or phrase, for example "cybersecurity webinar".
- **Payer searches and filters**: anything you can set in the Ad Library (countries, date range, impressions, targeting) is kept, because you paste the link itself.
- **Single ads**: an ad's own "View details" page.

It runs on the Apify platform, so you get API access, scheduling, integrations (Make, Zapier, Google Sheets, webhooks), run monitoring and exports to JSON, CSV, Excel or HTML.

It is one of three ad-library scrapers that share the same style of output: see also the [Facebook Ads Library Scraper](https://apify.com/mina_safwat/facebook-ads-library-scraper) and the [Google Ads Transparency Scraper](https://apify.com/mina_safwat/google-ads-transparency-scraper).

### Why use LinkedIn Ad Library Scraper?

- **B2B competitor research**: see every creative, offer and landing page a competitor runs on LinkedIn, and how long each ad stays live.
- **Creative inspiration**: collect headlines, hooks, buttons, carousels, document ads and video ads across a whole niche in minutes.
- **Audience insight**: for EU-served ads, read which languages, locations and targeting types (company, job, audience, interests) advertisers use.
- **Market monitoring**: schedule a weekly run on a list of advertisers or keywords and spot new campaigns as they launch.
- **Agency reporting and research**: export a brand's LinkedIn ad history to a spreadsheet for audits, pitches or journalism.

### How to scrape the LinkedIn Ad Library

1. Open the [LinkedIn Ad Library](https://www.linkedin.com/ad-library) in your browser.
2. Search by company/advertiser name, payer or keyword.
3. Set any filters you want: countries, date range, and under "More filters" impressions and targeting.
4. Copy the address from your browser's address bar.
5. Paste it into **Ad Library links**, add more links, names or keywords if you like, and click **Start**.
6. Download your ads from the **Output** tab when the run finishes.

No link at hand? Type company names into **Advertiser names** or words into **Keywords** instead. They search all countries over the last 12 months; use a link when you need filters.

### Input

| Field | What it does |
|---|---|
| **Ad Library links** (`startUrls`) | Ad Library search links (`/ad-library/search?...`) or single-ad links (`/ad-library/detail/...`), one per line. Every filter in a search link is kept. Links pasted without `https://` work too. |
| **Advertiser names** (`advertisers`) | Company names, searched like the Ad Library's "company/advertiser name" box. |
| **Keywords** (`keywords`) | Words or phrases, searched like the Ad Library's keyword box. |
| **Max ads per input** (`maxAdsPerUrl`) | Stops after this many ads for each link, name or keyword. Default: 100. |
| **Include ad details** (`includeDetails`) | On by default. Opens each ad's own page for the full text, button, landing page, advertiser page, payer and, for EU and Brazil ads, dates, impressions and targeting. Billed as an extra event per ad. Turn it off for a fast list of ads with shortened text. Single-ad links always include details. |
| **Proxy** (`proxyConfiguration`) | Keep the default Apify residential proxy. LinkedIn turns away direct and data-center connections. |

Example input:

```json
{
    "startUrls": [
        "https://www.linkedin.com/ad-library/search?accountOwner=hubspot",
        "https://www.linkedin.com/ad-library/search?keyword=cybersecurity&countries=DE&dateOption=last-30-days",
        "https://www.linkedin.com/ad-library/detail/1634600163"
    ],
    "advertisers": ["Gartner"],
    "keywords": ["sales webinar"],
    "maxAdsPerUrl": 100,
    "includeDetails": true
}
```

Links that are not Ad Library links (a company page, another website) are skipped and listed with the reason in the `FAILED_INPUTS` record of the run's key-value store, and so are searches that match no ads. You are never charged for them.

### Output

Each ad is one row. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel. A real ad with details, from a run on the Salesforce advertiser search (image link shortened):

```json
{
    "adId": "1634329123",
    "adLibraryUrl": "https://www.linkedin.com/ad-library/detail/1634329123",
    "advertiserName": "Ailo-IT | Salesforce Partner",
    "advertiserUrl": "https://www.linkedin.com/company/13008823",
    "advertiserLogoUrl": "https://media.licdn.com/dms/image/v2/C4D0BAQHFYtV-w3DbZw/company-logo_100_100/...",
    "postedBy": null,
    "paidBy": "Ailo-IT GmbH",
    "format": "SINGLE_IMAGE",
    "bodyText": "Wenn bei deinem Bestandskunden aus der Financial Services Industry das Renewal wackelt, übernehmen wir bis 31. Januar den Health Check kostenlos (Wert 2.000 €). ...",
    "headline": "Kostenloser Health Check bis 31.1.",
    "description": null,
    "ctaText": "Learn more",
    "linkUrl": "https://ailo-it.de/salesforce-ae?utm_source=linkedin&utm_medium=paid-social&utm_campaign=ae-fs-q4&utm_content=renewal",
    "imageUrl": "https://media.licdn.com/dms/image/v2/D4D10AQHYuhj2kl721w/image-shrink_1280/...",
    "videoUrl": null,
    "carouselCards": [],
    "firstShown": "2026-11-19",
    "lastShown": "2026-11-23",
    "daysShown": 5,
    "impressions": "< 1k",
    "impressionsMin": 0,
    "impressionsMax": 1000,
    "impressionsByCountry": [
        { "country": "Germany", "share": "73%", "percent": 73, "belowOnePercent": false },
        { "country": "Switzerland", "share": "20%", "percent": 20, "belowOnePercent": false },
        { "country": "Austria", "share": "5%", "percent": 5, "belowOnePercent": false },
        { "country": "United Kingdom", "share": "< 1%", "percent": null, "belowOnePercent": true }
    ],
    "targeting": [
        { "parameter": "Language", "included": "English", "excluded": null },
        { "parameter": "Location", "included": "Germany, Switzerland, Austria", "excluded": null }
    ],
    "targetingCriteria": ["Company", "Job"],
    "targetingExclusions": ["Company"],
    "isDeleted": false,
    "position": 27,
    "searchTotal": 9292,
    "input": "https://www.linkedin.com/ad-library/search?accountOwner=salesforce"
}
```

With **Include ad details** off, a row has the same creative fields, but `bodyText` is the shortened preview from the search results (ending in "…"), and the fields marked "details" below are left out.

The Output tab has three views: **Ads** (text, button, landing page, dates), **Impressions and targeting** and **Creatives** (images, videos, carousels, documents, events).

### Data fields

| Field | Description |
|---|---|
| `adId`, `adLibraryUrl` | The ad's ID and its page in the Ad Library |
| `advertiserName` | The company the ad runs for. For thought-leader ads, the company named in "Promoted by" |
| `postedBy` | For thought-leader ads, the member whose post is promoted; otherwise empty |
| `advertiserLogoUrl` | The advertiser's logo |
| `advertiserUrl` | Details: the advertiser's LinkedIn page |
| `paidBy` | Details: the paying entity ("Paid for by"), where LinkedIn shows one |
| `format` | `SINGLE_IMAGE`, `VIDEO`, `CAROUSEL`, `DOCUMENT`, `ARTICLE`, `EVENT`, `MESSAGE`, `SPOTLIGHT`, `FOLLOW_COMPANY` and other LinkedIn ad formats |
| `bodyText` | The ad text (the message body for message ads). Full text with details, a shortened preview without |
| `headline`, `description` | The headline under the image and its description line, an article's title and snippet, or a Spotlight or Follow Company ad's headline and tagline |
| `ctaText` | The call-to-action button, such as "Register" or "Learn more" (details) |
| `linkUrl` | The landing page the ad links to, without LinkedIn's tracking parameter (details) |
| `imageUrl` | The ad's main picture: its image, video cover, first carousel card or first document page |
| `videoUrl` | Video ads (details): the highest-quality MP4 |
| `carouselCards` | Carousel ads: each card's `title`, `imageUrl` and, with details, `linkUrl` |
| `documentTitle`, `documentPageCount`, `documentPageImages` | Document ads: the file's title, its page count and the preview pages |
| `eventStartsAt`, `eventEndsAt`, `eventOrganizer`, `eventLocation`, `eventUrl` | Event ads: start and end time (ISO, UTC), organizer, "Online" or the place, and the event page (details) |
| `firstShown`, `lastShown`, `daysShown` | Details, EU and Brazil ads: first and last day the ad ran (`YYYY-MM-DD`, as LinkedIn shows them) and the number of days, counting both |
| `impressions`, `impressionsMin`, `impressionsMax` | Details, EU and Brazil ads: total impressions as LinkedIn shows the range ("1k-5k", "< 1k") and as numbers |
| `impressionsByCountry` | Details, EU and Brazil ads: each country's `share` as LinkedIn shows it, as a number (`percent`), and `belowOnePercent`, which is true for LinkedIn's "< 1%" (its `percent` is then empty) |
| `targeting` | Details, EU and Brazil ads: the languages and locations included and excluded, as one text each, exactly as LinkedIn lists them. LinkedIn writes the names as a single comma-separated text and place names can contain commas ("McLean, VA"), so the text is not split into names |
| `targetingCriteria`, `targetingExclusions` | Details, EU and Brazil ads: which kinds of targeting were used to include or exclude people: Audience, Demographic, Company, Education, Job, Member Interests and Traits |
| `isDeleted` | True for an ad the advertiser has deleted (LinkedIn blurs its image) |
| `position` | The ad's position in the search results |
| `searchTotal` | How many ads match the search, as the Ad Library counts them |
| `input` | The link, name or keyword the ad was found through |

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

The Actor uses **pay-per-event** pricing, so you pay only for results (see the **Pricing** tab for the exact prices):

- a small fee for each ad saved to the dataset, and
- an extra fee for each ad completed with its details, charged only when **Include ad details** is on (or for single-ad links).

Searches and links that return no ads are never charged. If you set a maximum cost for a run, the Actor stops cleanly as soon as it is reached and keeps everything collected so far. The prefilled input (10 HubSpot ads with details) finishes in well under a minute.

### Tips for scraping the LinkedIn Ad Library

- **Filter in the Ad Library, not afterwards.** Countries, date range and impressions filters shrink the result set before you pay for it.
- **Several countries in one link:** pick them in the Ad Library's country filter, which writes `countries=DE%2CFR`. LinkedIn reads only the first country of a hand-written `countries=DE&countries=FR`. The Actor keeps either form exactly as given.
- **Turn details off for big lists.** Without details the Actor reads 24 ads per request and runs several times faster (about 500 ads in three minutes); turn details on for the ads you want to study.
- **Dates, impressions and targeting exist only for ads shown in the EU or Brazil.** LinkedIn publishes them under the EU's Digital Services Act; for other ads those fields stay empty. Add an EU country to the search to focus on such ads.
- **Advertiser names search by name**, so "Salesforce" also finds Salesforce partners whose page names contain it. Use a more specific name, or keep only the rows whose `advertiserUrl` is the company you want.
- **Media links may expire.** Image and video URLs are signed by LinkedIn; download any creatives you want to keep soon after the run.
- **Schedule it.** Run the same searches weekly and compare `adId`s to spot new ads.

### Related scrapers

See it on real data: [HubSpot ads in the LinkedIn Ad Library](https://apify.com/mina_safwat/linkedin-ad-library-scraper/examples/hubspot-ads-linkedin-ad-library).

- [Facebook Ads Library Scraper](https://apify.com/mina_safwat/facebook-ads-library-scraper): the same competitor's ads on Facebook and Instagram.
- [Google Ads Transparency Scraper](https://apify.com/mina_safwat/google-ads-transparency-scraper): the same competitor's search, display and YouTube ads.
- [LinkedIn Company Scraper](https://apify.com/mina_safwat/linkedin-company-scraper-no-cookies): the advertiser's company page: size, industry, followers and more.

### FAQ, disclaimers and support

**Do I need a LinkedIn account or cookies?** No. The Ad Library is public, and the Actor reads it without logging in.

**How many ads can I get?** As many as the Ad Library lists for your search, up to your limit. LinkedIn keeps ads from the last 12 months.

**Why are dates and impressions empty for some ads?** LinkedIn shows them only for ads served in the EU or Brazil.

**Why do message ads say %FIRSTNAME%?** That is the advertiser's placeholder for the recipient's name, as LinkedIn shows it in the Ad Library.

**What happens to inputs that return nothing?** They are not saved as rows, so you are not charged for them. Each one is listed with its reason in the `FAILED_INPUTS` record of the run's key-value store, and the run's status message gives the counts. A run fails only when LinkedIn refuses every input.

**Is it legal to scrape the LinkedIn Ad Library?** LinkedIn publishes the Ad Library so the public can see who advertises and how, and the EU's Digital Services Act requires such a repository. The Actor reads only publicly available ad information. Some ads are posted by individual people (thought-leader ads and ads by personal pages), so rows can contain their names as shown on the ad. You are responsible for how you use the data: check LinkedIn's terms and the laws that apply to you, such as GDPR, before using it, especially for personal data. If in doubt, ask a lawyer.

**Something is not working or you need a custom field?** Open an issue on the **Issues** tab and we will look into it. Custom scraping solutions are available on request.

# Actor input Schema

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

Links copied from the LinkedIn Ad Library, one per line. Search by advertiser, payer or keyword, set any filters you like (countries, date range, impressions, targeting), then copy the address bar: every filter in the link is kept. A single ad's "View details" link (https://www.linkedin.com/ad-library/detail/…) works too. Links that are not Ad Library links are skipped and listed in the FAILED_INPUTS record.

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

Company or advertiser names, one per line, such as HubSpot. Each runs the Ad Library's "company/advertiser name" search across all countries and the last 12 months. Use a link instead when you need filters.

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

Words or phrases, one per line, such as cybersecurity webinar. Each runs the Ad Library's keyword search across all countries and the last 12 months.

## `maxAdsPerUrl` (type: `integer`):

Stops after this many ads for each link, advertiser name or keyword, newest first unless the link sorts oldest first. The Ad Library loads 24 ads at a time.

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

Opens each ad's own page for the full ad text (search results cut it short), the button text, landing page, the advertiser's LinkedIn page and who paid for the ad, and for ads shown in the EU or Brazil the run dates, impressions, impressions by country and targeting. Billed as an extra event per ad. Turn it off for a faster, cheaper list of ads. Single-ad links always come with details.

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

Keep Apify's residential proxy on. LinkedIn's Ad Library turns away direct and data-center connections almost every time; a page refused through a residential address is retried at once from a fresh one. With another proxy, or none, the Actor falls back to residential addresses when it is refused.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.linkedin.com/ad-library/search?accountOwner=hubspot"
  ],
  "advertisers": [],
  "keywords": [],
  "maxAdsPerUrl": 10,
  "includeDetails": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset` (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 = {
    "startUrls": [
        "https://www.linkedin.com/ad-library/search?accountOwner=hubspot"
    ],
    "maxAdsPerUrl": 10,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("mina_safwat/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 = {
    "startUrls": ["https://www.linkedin.com/ad-library/search?accountOwner=hubspot"],
    "maxAdsPerUrl": 10,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("mina_safwat/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 '{
  "startUrls": [
    "https://www.linkedin.com/ad-library/search?accountOwner=hubspot"
  ],
  "maxAdsPerUrl": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call mina_safwat/linkedin-ad-library-scraper --silent --output-dataset

```

## MCP server setup

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