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

Returns every ad an advertiser is running on LinkedIn, or every ad matching a keyword, straight from LinkedIn's own public Ad Library.

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

## Pricing

from $2.00 / 1,000 ad returneds

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

![LinkedIn Ad Library Scraper — see every ad an advertiser is running on LinkedIn, or search by keyword](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/linkedin-ad-library-scraper--hero.png)

### What does LinkedIn Ad Library Scraper do?

LinkedIn Ad Library Scraper returns every ad an advertiser is currently running on LinkedIn -
or every ad matching a keyword across all advertisers - as clean structured data. For each ad
you get the headline, full ad text, creative image, format and call-to-action, and optionally
who actually paid for it (often an ad agency, not the brand itself). No login, no LinkedIn
account needed.

### Why use LinkedIn Ad Library Scraper?

- **No LinkedIn account needed** - works fully logged out, every run.
- **Full ad content, not a summary** - headline, complete body text and creative for every ad.
- **Two ways in** - look up one advertiser by their LinkedIn company, or search by keyword to
  find ads from any advertiser running on that topic.
- **See who's paying** - optionally reveal the actual payer behind each ad, which is frequently
  a media/creative agency rather than the brand it's promoting - a real B2B intelligence signal
  LinkedIn discloses but doesn't make easy to collect at scale.
- **B2B-focused** - a distinct audience and ad style from consumer platforms, useful for
  recruiting, SaaS, and professional-services competitive research.

### What makes this different

Most ad-library lookups make you click through one advertiser's ads by hand, one at a time.
This Actor pulls every one of an advertiser's current ads - or every ad matching a keyword -
directly into structured rows, so you can review a competitor's entire current LinkedIn ad
activity, including who's actually funding it, in a spreadsheet in one pass.

### Who uses LinkedIn Ad Library Scraper?

- **B2B marketers and demand-gen teams** - see exactly what messaging and offers a competitor
  is running on LinkedIn right now.
- **Recruitment and employer-branding teams** - track how competitors are advertising open
  roles and employer brand campaigns.
- **Agencies and consultants** - identify which agency is behind a competitor's or a
  prospective client's current LinkedIn campaigns.
- **Market researchers** - pull a structured record of B2B advertising activity in a given
  topic or industry for a client report.

### How it works

![How LinkedIn Ad Library Scraper turns your input into ad data](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/linkedin-ad-library-scraper--how-it-works.png)

1. **Your input** - an advertiser's LinkedIn company, or a brand/keyword to search.
2. **The Actor collects it** - it reads LinkedIn's own public Ad Library for that advertiser
   or keyword, works fully logged out, and keeps going until it has every ad, up to your limit.
3. **Your output** - one structured record per ad, with its full text, creative and format,
   ready for a spreadsheet, dashboard or report.

### What data can you extract?

| Field | Description |
|---|---|
| `advertiserName` | The advertiser's display name on LinkedIn |
| `advertiserCompanyUrl` | Link to the advertiser's LinkedIn company page |
| `adFormat` | The ad's format (e.g. Single Image Ad, Video Ad) |
| `headline` | The ad's headline |
| `bodyText` | The ad's full body text |
| `ctaText` | The call-to-action button text (requires `fetchPayerInfo`) |
| `imageUrl` | The ad's creative image, or video cover image |
| `payerName` | Who actually paid for the ad, often an agency (requires `fetchPayerInfo`) |
| `country` | The country filter applied to this run, when one was given |
| `searchedBy` / `searchTerm` | Whether this run searched by `companyId` or `keyword`, and the value used |
| `adDetailUrl` | Direct link to view this ad on LinkedIn's own Ad Library |
| `scrapedAt` | When this record was collected (ISO timestamp) |

### How to use LinkedIn Ad Library Scraper

1. Open the Actor and go to the **Input** tab.
2. Enter an **Advertiser's LinkedIn company ID** (a number, or a company URL containing one),
   or leave it empty and use **Keyword** instead (see the screenshot below).
3. Optionally turn on **Fetch payer name for each ad** to also capture the CTA text and who
   actually paid for each ad.
4. Optionally set **Max results**.
5. Click **Start**.
6. Open the **Dataset** tab, or pull results via the API, once the run finishes.

![LinkedIn Ad Library Scraper input form with company ID, keyword and options](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/linkedin-ad-library-scraper--input.png)

### Input Parameters

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `companyId` | String | No\* | - | An advertiser's LinkedIn company ID, or a URL containing one |
| `keyword` | String | No\* | `"cloud computing"` | A word/phrase to search, used when `companyId` is empty |
| `country` | String | No | - | Limit results to one country (2-letter code), e.g. `"US"`, `"GB"` |
| `fetchPayerInfo` | Boolean | No | `false` | Also fetch each ad's CTA text and actual payer name |
| `maxItems` | Integer | No | `30` | Maximum number of ads to return |
| `proxyConfiguration` | Object | No | Residential Apify Proxy | Advanced - a residential proxy is required; leave as default unless you have a reason to change it |

\*Provide either `companyId` or `keyword` - if both are empty the run has nothing to search for.

### Output Data

Each ad produces one dataset record. Example:

```json
{
    "adId": "1566774223",
    "advertiserName": "Goldman Sachs",
    "advertiserCompanyUrl": "https://www.linkedin.com/company/1382",
    "adFormat": "Single Image Ad",
    "headline": "Small businesses deserve a seat at the table in Washington.",
    "bodyText": "Jill Bommarito knows that small businesses like hers are essential to local economies...",
    "ctaText": "Learn more",
    "imageUrl": "https://media.licdn.com/dms/image/v2/...",
    "payerName": "Carat Usa, Inc.",
    "searchedBy": "companyId",
    "searchTerm": "1382",
    "adDetailUrl": "https://www.linkedin.com/ad-library/detail/1566774223",
    "scrapedAt": "2026-10-21T09:46:53.000Z"
}
```

![Sample dataset table from LinkedIn Ad Library Scraper](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/linkedin-ad-library-scraper--output.png)
![Every output field labelled on one example record](https://api.apify.com/v2/key-value-stores/kE36venAoVchGsE6b/records/linkedin-ad-library-scraper--fields.png)

### Usage Examples

- **Competitor audit** - set `companyId` to a competitor's LinkedIn company ID to see every
  ad they're currently running.
- **Topic research** - set `keyword` to a product category or industry term to see which
  advertisers are active in that space on LinkedIn right now.
- **Agency intelligence** - turn on `fetchPayerInfo` to see which media/creative agency is
  actually behind a set of campaigns, not just the brand name shown.
- **Ongoing tracking** - schedule the same `companyId` on a recurring run to catch new ads as
  an advertiser launches them.

### Tips for Best Results

- Use `companyId` whenever you know it - it's more precise than a keyword search and returns
  only that advertiser's own ads.
- Only turn on `fetchPayerInfo` when you need it - it adds one extra page load per ad, so
  it's slower and costs more than the default fast path.
- A keyword search can match ads from many different advertisers across industries - combine
  it with a specific product or topic term to narrow results.

### Known Limitations

- Returns the ads LinkedIn's own public Ad Library currently discloses for the given
  advertiser or keyword, not a full historical archive.
- This Actor cannot surface view/impression/spend numbers - LinkedIn's public Ad Library
  doesn't publish those figures for ordinary ads.
- Creative image URLs are served from LinkedIn's own CDN and may expire after some time;
  download or re-host them promptly if you need to keep a copy.

### Integrations

Connect LinkedIn Ad Library Scraper to the rest of your stack via the [Apify API](https://docs.apify.com/api/v2),
[webhooks](https://docs.apify.com/platform/integrations/webhooks), scheduled runs, or directly
to Google Sheets, Make, and Zapier through Apify's built-in integrations.

### Export Formats

Download results as **JSON, CSV, Excel, or XML** from the Dataset tab, or fetch them
programmatically via the Apify API.

### Frequently Asked Questions

#### Do I need a LinkedIn account or to log in?

No. Every run works fully logged out.

#### How do I find an advertiser's company ID?

Search for the advertiser directly on LinkedIn's own Ad Library site, click their name in the
results, and copy the numeric ID from the resulting URL - or paste that same URL straight into
the `companyId` field; this Actor extracts the number for you.

#### Why is `payerName` empty by default?

Getting it requires visiting each ad's own detail page, which is slower and costs more per ad.
Turn on `fetchPayerInfo` when you specifically need it.

#### Can I schedule this to run automatically?

Yes, use Apify's built-in [Scheduler](https://docs.apify.com/platform/schedules) to re-check an
advertiser or keyword on any interval you choose.

### Support

Found an issue or have a request? Open it on the Actor's **Issues** tab in the Apify Console.

### Legal / Responsible Use

You're responsible for using this Actor in compliance with applicable laws and the target
platform's terms of service. This Actor retrieves publicly viewable ad information only; it
does not collect personal data.

# Actor input Schema

## `companyId` (type: `string`):

A LinkedIn company's numeric ID, or a company URL containing one (e.g. "1382" or "https://www.linkedin.com/company/1382"). Returns every ad from that one advertiser. Leave empty to use Keyword instead.

## `keyword` (type: `string`):

A word or phrase to search ad text for, across all advertisers. Used only when Advertiser's LinkedIn company ID is empty.

## `country` (type: `string`):

Optional - limit results to ads targeted/shown in one country (2-letter code, e.g. "US", "GB"). Leave empty for every country.

## `fetchPayerInfo` (type: `boolean`):

Also visit each ad's own detail page to capture who actually paid for it (often an ad agency, not the brand) and its exact CTA text. This adds one extra page load per ad.

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

Maximum number of ads to return.

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

A residential proxy is required - LinkedIn blocks datacenter IPs for this page.

## Actor input object example

```json
{
  "keyword": "cloud computing",
  "fetchPayerInfo": false,
  "maxItems": 30,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# 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 = {
    "keyword": "cloud computing",
    "maxItems": 30
};

// Run the Actor and wait for it to finish
const run = await client.actor("mrdoe/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 = {
    "keyword": "cloud computing",
    "maxItems": 30,
}

# Run the Actor and wait for it to finish
run = client.actor("mrdoe/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 '{
  "keyword": "cloud computing",
  "maxItems": 30
}' |
apify call mrdoe/linkedin-ad-library-scraper --silent --output-dataset

```

## MCP server setup

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