# LinkedIn Ad Library Scraper - Competitor Ads by Company (`swerve/linkedin-ad-library-scraper`) Actor

See every ad a company runs on LinkedIn: search the public LinkedIn Ad Library by company or keyword and get the full ad copy, headline, format, image, payer and, for EU ads, run dates, impressions by country and targeting. No login, no cookies.

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

## Pricing

$2.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

## LinkedIn Ad Library Scraper - Competitor Ads by Company

See **every ad a company runs on LinkedIn**. Type a company name or a keyword and get one row per ad from the public LinkedIn Ad Library: the full ad copy, headline, format, image, who paid for it and, for ads shown in the EU, the dates it ran, impressions, impressions by country and targeting. **No login, no cookies.**

### Why this scraper

- **Type a name, not a URL.** Search by company, by a keyword inside the ad, or paste a search URL you already built in the Ad Library.
- **The full ad, not the preview.** The library's cards cut the text after two lines; this actor opens every ad and returns the complete copy.
- **The numbers LinkedIn publishes.** For ads shown in the EU: first and last day, the impressions range, the share of impressions per country, and the targeting language and location.
- **Filters applied by LinkedIn.** Countries and a date range (last 30 days, this month, this year, last year or custom) go into the search itself.
- **To the last page.** A company with 2,000 ads returns 2,000 rows unless you set a cap.

### Use cases

- B2B competitor research: what rivals promote, to whom and for how long
- Swipe files of LinkedIn ad copy and creatives by industry keyword
- Agency pitches: audit a prospect's LinkedIn advertising in minutes
- Monitoring: schedule it with "Last 30 days" to catch new campaigns
- Market signals: which companies advertise around a topic (hiring, webinars, product launches)

### Input

| Field | What it does | Example |
|-------|--------------|---------|
| **Company or advertiser names** | One search per name. | `HubSpot` |
| **Keywords in the ad** | Ads from any advertiser containing the phrase. | `CRM software` |
| **Ad Library search URLs** | A URL copied from linkedin.com/ad-library. | |
| **Countries** | Two-letter codes; empty = all. | `US`, `DE` |
| **Ran during** | Any time, last 30 days, this month, this year, last year, custom. | `last-30-days` |
| **Max ads per company / keyword** | Blank = all. | `100` |
| **Include ad details** | Full text, payer and the EU transparency numbers. On by default. | on |

### Output

One row per ad:

```json
{
  "adId": "1615887163",
  "adUrl": "https://www.linkedin.com/ad-library/detail/1615887163",
  "advertiserName": "made2GROW GmbH | HubSpot Platin Partner",
  "advertiserLogo": "https://media.licdn.com/dms/image/v2/C4D0BAQGgCvj2iDADxQ/company-logo_100_100/...",
  "paidBy": "made2GROW GmbH",
  "format": "Single Image Ad",
  "creativeType": "SPONSORED_STATUS_UPDATE",
  "headline": "Let's fix that. HUG Berlin · Nov 24",
  "text": "Sales: \"These leads are useless.\"\nMarketing: \"Sales never follows up.\"\nSound familiar? ...",
  "imageUrl": "https://media.licdn.com/dms/image/v2/D4D10AQHUONSba7CRQg/image-shrink_800/...",
  "isVideo": false,
  "ranFrom": "2026-11-12",
  "ranTo": "2026-11-18",
  "totalImpressions": "1k-5k",
  "impressionsByCountry": [{ "country": "Germany", "share": "100%" }],
  "targetingLanguage": "Deutsch",
  "targetingLocation": "Deutschland",
  "searchedFor": "HubSpot",
  "totalAdsForSearch": 204,
  "scrapedAt": "2026-11-22T10:05:00.000Z"
}
```

### How it works

The actor reads the LinkedIn Ad Library the way a visitor does: the search results for your company or keyword with your filters, every following page, and each ad's own page for the details. LinkedIn refuses most proxy addresses and throttles the rest after a few dozen requests, so the actor draws addresses until LinkedIn accepts one, reuses it for a batch of requests, and moves on.

### Limits

- Run dates, impressions and targeting exist only for ads shown in the EU (LinkedIn publishes them under the Digital Services Act). Other ads return format, advertiser, payer, copy and creative.
- LinkedIn keeps roughly one year of ads in the library.
- Impressions are LinkedIn's ranges (for example `1k-5k`), not exact counts.
- A company name search matches advertisers whose name contains it, so "HubSpot" also returns HubSpot partners; use `advertiserName` to filter.

### Export formats

Download results as JSON, CSV, Excel or XML, or pull them through the Apify API into your own app, spreadsheet, database or MCP client.

### Frequently asked questions

**Do I need a LinkedIn account or cookies?** No. The Ad Library is public and the actor uses no login.

**Can I see how much a competitor spends?** No. LinkedIn publishes impression ranges for EU ads, not spend.

**Can I get the ads of several companies at once?** Yes, list as many names as you like; each row says which search it came from.

**Is scraping it legal?** The Ad Library is public transparency data. You are responsible for how you use it; review LinkedIn's terms and your local laws before large-scale use.

### Pricing

Pay per ad returned, details included.

# Actor input Schema

## `companies` (type: `array`):

The advertiser as it appears on LinkedIn. Each name is one search. Examples: HubSpot, Salesforce, monday.com

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

Find ads from any advertiser that contain a word or phrase, e.g. CRM software, webinar, hiring.

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

A search URL copied from linkedin.com/ad-library, with whatever filters you set there.

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

Two-letter country codes the ads were shown in, e.g. US, GB, DE, IL. Leave empty for all countries.

## `dateRange` (type: `string`):

LinkedIn keeps about one year of ads. Pick a preset or 'Custom' and fill the two dates below.

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

YYYY-MM-DD, used with 'Custom dates'.

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

YYYY-MM-DD, used with 'Custom dates'.

## `maxAdsPerSearch` (type: `integer`):

Leave blank to take every ad the search returns.

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

Optional overall cap for the run. Leave blank for everything.

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

Opens each ad's page for the complete ad text and who paid for it and, for ads shown in the EU, the dates it ran, total impressions, impressions by country and the targeting language and location. One extra request per ad. On by default; off returns the search cards only (faster).

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

LinkedIn refuses most proxy addresses and keeps answering the ones it accepts, so the actor draws addresses until one works and then reuses it. The Apify datacenter pool is the default and works best.

## Actor input object example

```json
{
  "companies": [
    "HubSpot"
  ],
  "keywords": [],
  "startUrls": [],
  "countries": [],
  "dateRange": "any",
  "maxAdsPerSearch": 100,
  "includeDetails": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `ads` (type: `string`):

All ad rows (JSON). Append ?format=csv for CSV.

# 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 = {
    "companies": [
        "HubSpot"
    ],
    "keywords": [],
    "startUrls": [],
    "countries": [],
    "maxAdsPerSearch": 100,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("swerve/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 = {
    "companies": ["HubSpot"],
    "keywords": [],
    "startUrls": [],
    "countries": [],
    "maxAdsPerSearch": 100,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("swerve/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 '{
  "companies": [
    "HubSpot"
  ],
  "keywords": [],
  "startUrls": [],
  "countries": [],
  "maxAdsPerSearch": 100,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call swerve/linkedin-ad-library-scraper --silent --output-dataset

```

## MCP server setup

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