# LinkedIn Ad Library: B2B Competitor Ad Spy (`dltik/linkedin-ad-library`) Actor

Scrape LinkedIn's public Ad Library: every B2B ad an advertiser runs. Search by company or keyword. Get creatives, copy, formats, dates, impressions per country and the advertiser targeting breakdown (job title, seniority, company size, industry). For competitor spy, sales intel, agencies.

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

## Pricing

$2.00 / 1,000 ad scrapeds

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 — B2B Competitor Ad Spy

**LinkedIn Ad Library Scraper** extracts B2B ads from LinkedIn's **official public Ad Library** — the only DSA-mandated public source of B2B competitor advertising. Search by company (advertiser) or keyword, optionally enrich each ad with **DSA premium data**: impressions per country, total impressions, and the full **advertiser targeting breakdown** — job title, seniority, company size, industry, location, language. No login, no cookies, no Chromium — pure HTTP, ~7 seconds per query.

> 🎯 **The B2B signal no other ad library exposes:** who an advertiser *targeted* — by **job title, seniority, company size and industry**. Facebook and Google ad libraries have no equivalent. This is how you reverse-engineer a competitor's ICP straight from their LinkedIn ads.

> ⭐ **Found this useful?** Click the **Bookmark** button at the top of [this page](https://apify.com/dltik/linkedin-ad-library) — it's the single strongest signal that keeps this actor visible to others. One click. No signup beyond your existing Apify account.

***

### What can LinkedIn Ad Library Scraper do?

- 🏢 **Search by advertiser company** (e.g. `Salesforce`, `HubSpot`, `Microsoft`)
- 🔍 **Search by keyword** — find ads containing a specific phrase in their copy
- 🌍 **Filter by countries** — ISO 2-letter codes, multi-select supported
- 📅 **Date range** — last month / 3 months / 6 months / year / all time
- 🎬 **All ad formats** — Sponsored Status Updates, Sponsored Videos, Sponsored InMails, Native Documents
- 📊 **DSA enrichment** (opt-in) — total impressions, impressions per country, targeting filters (language, location)
- ⚡ **Pure HTTP** — no browser, no cookies, no auth. 24 ads in ~7s at 512 MB.

***

### What data can you extract from LinkedIn Ads?

| Field | Description |
|-------|-------------|
| `ad_id` | LinkedIn's internal ad ID |
| `advertiser_name` | Company name running the ad |
| `advertiser_logo` | Company logo URL |
| `creative_type` | `SPONSORED_STATUS_UPDATE`, `SPONSORED_VIDEO`, `SPONSORED_INMAILS`, `SPONSORED_UPDATE_NATIVE_DOCUMENT`, `FOLLOW_COMPANY_V2` |
| `headline` | Ad headline / primary copy |
| `ad_text` | Full body text of the ad |
| `image_url` | Creative image URL (when applicable) |
| `detail_url` | Direct link to the ad's transparency page |
| `impressions_by_country` | (with `enrichDetails`) Per-country impression %, DSA-compliant |
| `total_impressions` | (with `enrichDetails`) Estimated total impressions |
| `targeting` | (with `enrichDetails`) **Advertiser targeting breakdown** — `job_title`, `job_seniority`, `company_size`, `industry`, `location`, `language` |

***

### How to spy on LinkedIn ads

1. **[Create a free Apify account](https://apify.com/sign-up)** — no credit card required
2. **Open [LinkedIn Ad Library Scraper](https://apify.com/dltik/linkedin-ad-library)** in Apify Store
3. **Enter a company name** in `accountOwner` (e.g. `Salesforce`) — or a keyword
4. **Pick countries** (optional) and a **date range** (default: last year)
5. **Click Start** — ads stream in within seconds
6. **Optionally** enable `enrichDetails` to add DSA impressions + targeting

***

### How much does it cost to spy on LinkedIn ads?

**$0.002 per ad** ($2 per 1,000 ads). HTTP-only — no Chromium, no proxy, no surprise compute charges.

| Run size | Ads | Apify cost | Time |
|----------|-----|------------|------|
| Quick test | 5 | ~$0.01 | ~7s |
| Per query | 24 | ~$0.05 | ~7s |
| 10 companies | 240 | ~$0.48 | ~1min |
| With DSA enrichment (24 ads) | 24 | ~$0.05 | ~30s |

***

### Input parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `accountOwner` | string | ❌\* | — | Company name to search (e.g. `Salesforce`) |
| `keyword` | string | ❌\* | — | Keyword to find in ad copy |
| `countries` | array | ❌ | `[]` | ISO 2-letter codes (e.g. `["US","GB","FR"]`) |
| `dateOption` | string | ❌ | `last-year` | `last-month`, `last-3-months`, `last-6-months`, `last-year`, `all-time` |
| `maxResults` | integer | ❌ | `24` | Cap per query (LinkedIn serves ~24 ads per anonymous query) |
| `enrichDetails` | boolean | ❌ | `false` | Fetch DSA detail page per ad: impressions per country + targeting |
| `useResidentialProxy` | boolean | ❌ | `false` | Enable only if you hit rate limits on large runs |

> \*Provide at least one of `accountOwner` or `keyword`.

***

### Output example

```json
{
  "ad_id": "998775576",
  "advertiser_name": "Salesforce",
  "advertiser_logo": "https://media.licdn.com/dms/image/.../salesforce_logo.png",
  "creative_type": "SPONSORED_UPDATE_NATIVE_DOCUMENT",
  "headline": "A future-ready CRM needs continuous evolution.",
  "ad_text": "A future-ready CRM needs continuous evolution. Avanza's managed services keep your Salesforce…",
  "image_url": "https://media.licdn.com/.../ad-creative.jpg",
  "detail_url": "https://www.linkedin.com/ad-library/detail/998775576",
  "impressions_by_country": [
    { "country": "United States", "percent": "65%" },
    { "country": "United Kingdom", "percent": "12%" }
  ],
  "total_impressions": null,
  "targeting": {
    "language": "English",
    "location": "United States, United Kingdom",
    "job_title": "IT Manager, CTO, VP Engineering",
    "job_seniority": "Director, VP, CXO",
    "company_size": "1,001-5,000 employees",
    "industry": "Software Development"
  }
}
```

***

### Use cases

- **B2B competitor ad spy** — see every LinkedIn ad your competitors are running
- **Agency reporting** — track competitor B2B ad strategies over time
- **Sales intelligence** — discover what messaging high-growth B2B brands use
- **DSA compliance research** — pull the official transparency record for any advertiser
- **Creative inspiration** — browse a curated feed of polished B2B ad copy

***

### Use the actor via API

**Python:**

```python
import requests

run = requests.post(
    "https://api.apify.com/v2/acts/dltik~linkedin-ad-library/runs",
    headers={"Authorization": "Bearer YOUR_APIFY_TOKEN"},
    json={
        "accountOwner": "Salesforce",
        "countries": ["US"],
        "dateOption": "last-year",
        "enrichDetails": True
    }
).json()
print("Run started:", run["data"]["id"])
```

**curl:**

```bash
curl -X POST "https://api.apify.com/v2/acts/dltik~linkedin-ad-library/runs" \
  -H "Authorization: Bearer YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"accountOwner":"Salesforce","countries":["US"],"enrichDetails":true}'
```

***

### FAQ

**Do I need a LinkedIn account or session cookie?**
No. LinkedIn's Ad Library is a public DSA transparency tool — the scraper hits it cold without any auth or cookies.

**Why does it return at most 24 ads per query?**
LinkedIn's public Ad Library serves about 24 ads per search; deeper pagination relies on an in-page XHR that isn't exposed publicly. To broaden coverage, stack multiple queries (different companies, keywords, countries, date ranges) — each one is a separate run.

**What does the DSA enrichment add?**
For each ad, the actor fetches the detail page and parses the EU DSA-mandated transparency fields: total impressions, impressions per country, and the full advertiser **targeting breakdown** (job title, seniority, company size, industry, location, language). Premium B2B intelligence you can't get from the list view alone.

**Can I see who a competitor is targeting on LinkedIn?**
Yes. With `enrichDetails` on, the `targeting` object returns the advertiser's disclosed audience parameters — job title, seniority, company size, and industry. It's the fastest way to reverse-engineer a competitor's ideal customer profile (ICP) and ad strategy straight from their live campaigns.

**Does it need a proxy?**
No, datacenter IPs work fine for the public Ad Library. The residential-proxy toggle is only for very large or repeated runs.

**Is this only B2B ads?**
LinkedIn's audience is overwhelmingly professional / B2B — most ads in the library are B2B (SaaS, agencies, consulting, recruitment, enterprise software). That's exactly the differentiator vs Facebook or Google ad libraries.

***

### Connect with Make, Zapier & n8n

This actor integrates with any automation platform via the Apify API.

#### Make (Integromat)

1. Add an **Apify module** in your Make scenario
2. Select **Run Actor** → choose this actor
3. Configure the input (paste your JSON)
4. Add a **Get Dataset Items** module to retrieve results
5. Send ads to Google Sheets, HubSpot, Slack, or any downstream app

#### Zapier

1. Use the **Apify integration** on Zapier
2. Trigger: **Actor Run Finished**
3. Action: **Get Dataset Items**
4. Pipe results into your CRM, email tool, or spreadsheet

#### n8n

1. Add an **HTTP Request** node to call the Apify API
2. POST to `https://api.apify.com/v2/acts/dltik~linkedin-ad-library/runs`
3. Wait for completion, then fetch dataset items
4. Route results into any n8n node

***

⭐ **Found this LinkedIn Ad Library Scraper useful? Bookmark it** — Apify ranks actors by bookmarks, so it's the strongest single signal for Store visibility. One click = directly helps this actor stay surfaced.

### Other scrapers by dltik

| Actor | What it does | Price |
|-------|-------------|-------|
| [Facebook Ads Library Scraper](https://apify.com/dltik/facebook-ads-scraper) | Meta (Facebook + Instagram) ad library spy with DSA detail enrichment | $0.75/1K |
| [Google Ads Transparency Scraper](https://apify.com/dltik/google-ads-transparency) | Google Search, YouTube, Display ad spy via official Ad Transparency Center | $1/1K |
| [TikTok Scraper](https://apify.com/dltik/tiktok-scraper) | Profiles, videos, hashtags, search, trending | $8/1K |
| [Trustpilot Scraper](https://apify.com/dltik/trustpilot-scraper) | Reviews, ratings, company profiles with sentiment | $0.50/1K |

# Actor input Schema

## `accountOwner` (type: `string`):

Company / advertiser name to search (e.g. 'Salesforce', 'Nike'). Combine with keyword for finer search.

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

Search ads containing this keyword in their copy.

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

ISO 2-letter country codes to filter ads by where they were shown (e.g. \['US','GB','FR']). Empty = all countries.

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

How far back to search.

## `maxResults` (type: `integer`):

Cap on ads returned per query. LinkedIn's public Ad Library serves ~24 ads per search; the in-page 'load more' is an XHR that isn't exposed here. Broaden coverage by running multiple queries (different keywords, countries, date ranges) rather than chasing a deeper cap.

## `enrichDetails` (type: `boolean`):

For each ad, fetch the detail page to extract DSA premium fields: impressions per country, total impressions, targeting filters. Slower (~1s/ad) but unlocks the most valuable data.

## `useResidentialProxy` (type: `boolean`):

Enable only if you hit rate limits on large runs — datacenter IPs work fine for the public Ad Library.

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

Advanced: override the proxy. Only honored when 'Use residential proxy' is enabled.

## Actor input object example

```json
{
  "accountOwner": "Salesforce",
  "dateOption": "last-year",
  "maxResults": 24,
  "enrichDetails": false,
  "useResidentialProxy": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

List of LinkedIn ads with advertiser, creative type, copy, image and detail URL.

# 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 = {
    "accountOwner": "Salesforce"
};

// Run the Actor and wait for it to finish
const run = await client.actor("dltik/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 = { "accountOwner": "Salesforce" }

# Run the Actor and wait for it to finish
run = client.actor("dltik/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 '{
  "accountOwner": "Salesforce"
}' |
apify call dltik/linkedin-ad-library --silent --output-dataset

```

## MCP server setup

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