# LinkedIn Ad Library Scraper - B2B Ads Spy (`elliotpadfield/linkedin-ad-library-scraper`) Actor

Scrape LinkedIn Ad Library ads for competitor research, B2B ad intelligence, agency prospecting, and paid social monitoring. Search by keyword, advertiser, payer, country, date range, or direct ad URL and export structured ad copy, creative URLs, advertiser metadata, payer names, and detail links.

- **URL**: https://apify.com/elliotpadfield/linkedin-ad-library-scraper.md
- **Developed by:** [Elliot Padfield](https://apify.com/elliotpadfield) (community)
- **Categories:** Social media, Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 51.5% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.75 / 1,000 saved 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## LinkedIn Ad Library Scraper

Scrape public ads from the [LinkedIn Ad Library](https://www.linkedin.com/ad-library/) by keyword, advertiser, payer, country, date range, or direct ad URL. This Actor extracts B2B ad copy, creatives, advertiser names, payer names, LinkedIn detail URLs, media URLs, and full ad text without requiring LinkedIn login cookies.

Use it to monitor competitor LinkedIn ads, collect B2B ad examples, research SaaS positioning, audit paid social activity, and build ad intelligence datasets that can be exported to CSV, JSON, Excel, Google Sheets, Make, Zapier, or your own API workflow.

### What can this LinkedIn Ads scraper do?

- Search LinkedIn ads by keyword or phrase
- Search by company / advertiser name
- Search by payer name
- Enrich direct LinkedIn Ad Library detail URLs or numeric ad IDs
- Filter by one or more countries
- Pass LinkedIn date-range filters
- Extract paginated search results using LinkedIn's public pagination endpoint
- Fetch detail pages for full ad copy and advertiser metadata
- Export structured ad data to Apify datasets
- Run on schedules for competitor ad monitoring
- Use Apify residential proxies on every run for production reliability

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

| Field | Description |
|---|---|
| `adId` | LinkedIn Ad Library ad ID |
| `adUrl` | Direct LinkedIn Ad Library detail URL |
| `advertiserName` | Advertiser shown by LinkedIn |
| `advertiserUrl` | LinkedIn company or profile URL when available |
| `payerName` | Entity shown as paying for the ad |
| `adFormat` | Visible format, such as Single Image Ad or Video Ad |
| `creativeType` | LinkedIn creative type code |
| `adText` | Full body copy from the ad detail page |
| `previewText` | Search-card preview text |
| `headline` | Sponsored content headline when available |
| `imageUrls` | Creative image URLs |
| `videoThumbnailUrls` | Video thumbnail URLs |
| `linkedInUrls` | LinkedIn URLs linked from the ad |
| `resultPosition` | Position in search results |
| `countries` | Country filters used for the run |
| `scrapedAt` | Timestamp when the row was saved |

### How to scrape LinkedIn ads

1. Choose your search method: keywords, advertiser names, payer names, or direct ad URLs.
2. Add one or more country codes such as `US`, `GB`, `CA`, `DE`, or `FR`.
3. Set `maxAds` and `maxPages` to control result size.
4. Keep `includeDetails` enabled if you want full ad copy and richer advertiser metadata.
5. Run the Actor and export the dataset in JSON, CSV, Excel, XML, RSS, or HTML from Apify.

### Input examples

#### Search competitor ads by keyword

```json
{
  "keywords": ["notion", "crm software"],
  "countries": ["US"],
  "maxAds": 100,
  "maxPages": 5,
  "includeDetails": true
}
```

#### Search by advertiser or payer

```json
{
  "companyOrAdvertiserNames": ["Salesforce", "HubSpot"],
  "payerNames": ["Microsoft"],
  "countries": ["US", "GB"],
  "maxAds": 250,
  "includeDetails": true
}
```

#### Enrich specific LinkedIn Ad Library URLs

```json
{
  "adUrls": [
    "https://www.linkedin.com/ad-library/detail/1271387083",
    "1420600056"
  ],
  "includeDetails": true
}
```

### Output example

```json
{
  "sourceType": "search",
  "query": "notion",
  "keyword": "notion",
  "countries": ["US"],
  "resultPosition": 1,
  "adId": "1271387083",
  "adUrl": "https://www.linkedin.com/ad-library/detail/1271387083",
  "creativeType": "SPONSORED_STATUS_UPDATE",
  "adFormat": "Single Image Ad",
  "advertiserName": "Veth Group",
  "advertiserUrl": "https://www.linkedin.com/company/11761155",
  "payerName": "Veth Group",
  "previewAuthorName": "Miles Veth",
  "previewAuthorHeadline": "$800/mo done for you LinkedIn content and ads management",
  "adText": "Full ad copy from the detail page...",
  "imageUrls": ["https://media.licdn.com/..."],
  "linkedInUrls": [
    "https://www.linkedin.com/company/11761155",
    "https://www.linkedin.com/company/notionhq"
  ],
  "detailFetched": true,
  "scrapedAt": "2026-05-27T21:56:02.374Z"
}
```

### Search methods and filters

| Capability | Supported |
|---|---|
| Keyword search | Yes |
| Company / advertiser search | Yes |
| Payer search | Yes |
| Direct ad URL enrichment | Yes |
| Numeric ad ID enrichment | Yes |
| Country filters | Yes |
| Date range filters | Yes |
| Creative type post-filter | Yes |
| Visible ad format post-filter | Yes |
| Search pagination | Yes |
| Full detail-page enrichment | Yes |
| No-login operation | Yes |
| Forced Apify Residential Proxy | Yes |

### Pricing and cost expectations

This Actor is designed for pay-per-result pricing. A typical run can scrape the first 100 fully enriched LinkedIn ads for a keyword or advertiser in a few minutes. Detail enrichment makes one extra request per ad, so disabling `includeDetails` can make preview-only runs faster and cheaper.

The Actor always uses Apify residential proxies. For small tests, you can lower `maxAds` to 10 or 25. For scheduled monitoring, run daily with the same keyword or advertiser inputs and deduplicate by `adId` in your downstream workflow.

### Why use this Actor?

LinkedIn is one of the highest-intent B2B ad channels. This scraper gives growth teams, agencies, founders, analysts, and sales teams a structured way to answer questions like:

- What ads are competitors running on LinkedIn?
- Which messages, hooks, and offers are repeated across B2B campaigns?
- Which companies are actively advertising in my category?
- Which agencies or payers appear behind campaigns?
- What creative formats are common in my market?

Because it runs on Apify, you also get scheduling, API access, datasets, webhooks, proxy rotation, and integrations without maintaining your own server.

# Actor input Schema

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

Search ad text and advertiser content by one or more words or phrases, such as competitor names, product categories, or campaign themes.

## `queries` (type: `array`):

Alias for Keywords. Useful when triggering the Actor from API clients that use a generic queries field.

## `companyOrAdvertiserNames` (type: `array`):

Search by advertiser or company name as shown in LinkedIn Ad Library.

## `payerNames` (type: `array`):

Search by the entity that paid for the ad. This is useful for agency, brand, and compliance research.

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

Paste LinkedIn Ad Library detail URLs or numeric ad IDs to enrich specific ads directly.

## `detailUrls` (type: `array`):

Alias for Direct Ad URLs or IDs. Kept for integration compatibility.

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

LinkedIn country codes to search. Common values: US, GB, CA, AU, DE, FR, NL, ES, IT, IN, BR. Defaults to US.

## `dateFrom` (type: `string`):

Optional start date passed to LinkedIn's Ad Library date filter. Use YYYY-MM-DD.

## `dateTo` (type: `string`):

Optional end date passed to LinkedIn's Ad Library date filter. Use YYYY-MM-DD.

## `creativeTypes` (type: `array`):

Optional post-filter for LinkedIn creative type codes found in the HTML, such as SPONSORED\_STATUS\_UPDATE.

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

Optional post-filter for visible ad formats such as Single Image Ad or Video Ad.

## `maxAds` (type: `integer`):

Maximum number of unique ads to save across all search sources and direct ad URLs.

## `maxPages` (type: `integer`):

Maximum pagination pages to fetch per search source. Each page normally contains around 24 ads.

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

Fetch each LinkedIn Ad Library detail page to get full ad copy, advertiser URL, payer name, and additional media/link metadata. Disable for faster preview-only runs.

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

Number of ad detail pages to fetch in parallel.

## `requestDelayMs` (type: `integer`):

Base delay in milliseconds between retry attempts after transient failures.

## `maxRetries` (type: `integer`):

Number of retries for transient HTTP, timeout, or proxy failures.

## Actor input object example

```json
{
  "keywords": [
    "notion"
  ],
  "countries": [
    "US"
  ],
  "dateFrom": "2026-01-01",
  "dateTo": "2026-05-27",
  "maxAds": 100,
  "maxPages": 5,
  "includeDetails": true,
  "maxConcurrency": 5,
  "requestDelayMs": 500,
  "maxRetries": 3
}
```

# Actor output Schema

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

Public LinkedIn Ad Library ads with advertiser, payer, creative, copy, media, and detail metadata stored in the default dataset.

# 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 = {
    "keywords": [
        "notion"
    ],
    "countries": [
        "US"
    ],
    "maxAds": 100,
    "maxPages": 5,
    "includeDetails": true,
    "maxConcurrency": 5,
    "requestDelayMs": 500,
    "maxRetries": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("elliotpadfield/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 = {
    "keywords": ["notion"],
    "countries": ["US"],
    "maxAds": 100,
    "maxPages": 5,
    "includeDetails": True,
    "maxConcurrency": 5,
    "requestDelayMs": 500,
    "maxRetries": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("elliotpadfield/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 '{
  "keywords": [
    "notion"
  ],
  "countries": [
    "US"
  ],
  "maxAds": 100,
  "maxPages": 5,
  "includeDetails": true,
  "maxConcurrency": 5,
  "requestDelayMs": 500,
  "maxRetries": 3
}' |
apify call elliotpadfield/linkedin-ad-library-scraper --silent --output-dataset

```

## MCP server setup

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