# LinkedIn Ad Library Scraper – LinkedIn Ads Scraper, No Login (`dheerajitbhu/linkedin-ad-library`) Actor

Fetch public ad creatives from the LinkedIn Ad Library by keyword, advertiser, or pasted search URL. Typed schema and compact JSON for AI agents. A blocked query returns an error row instead of failing the run.

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

## Pricing

from $0.99 / 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 – LinkedIn Ads Scraper, No Login

Fetch public ad creatives from the [LinkedIn Ad Library](https://www.linkedin.com/ad-library) by keyword, advertiser, or pasted search URL. Export structured rows — advertiser, format, headline, body text, image, and a cite-back URL — as JSON, CSV, or compact JSON for AI agents. No login. Creatives only in this version: no impressions, targeting, or landing-page add-on.

**$0.99 per 1,000 ads**, plus $0.001 per run. The US residential proxy the library needs is included — no separate proxy bill, no login. Works on Apify’s Free plan ($5/mo platform usage, no credit card required to try).

### Try it in one click

The input form on this page is prefilled — press **Start** and it returns up to 20 recent creatives for the keyword `crm` in the US. A prefill run costs about **$0.021**.

```json
{ "mode": "ads", "keywords": ["crm"], "country": "us", "maxAds": 20, "maxChargeUsd": 0.10 }
```

### For AI agents

- Call with `mode=ads` and `keywords`, `advertisers`, and/or `startUrls` (Ad Library search or ad URLs). Optional: `country` (default `us`, lowercase ISO 3166-1 alpha-2), `maxAds`, `startDate`, `endDate`, `outputFormat=compact`, `maxChargeUsd`.
- Do not use `mode=selftest` or `mode=probe`.
- Input precedence is fixed: `startUrls` run first, then `advertisers`, then `keywords`, until `maxAds` is reached. If all three are empty, the Actor uses the prefill keyword (`crm`) so an empty run still returns creatives.
- Read the default dataset, or key `OUTPUT_COMPACT` in the key-value store when you asked for compact output (null fields are dropped).
- A blocked or invalid query produces a `type=error` row. The run still succeeds if other queries (or the run as a whole) produced output.
- A well-formed query that matches **zero** ads is billed the start fee only (`$0.001`); no `ad` events.
- Pricing: `apify-actor-start` **$0.001** (per run at the default 1 GB memory) plus `ad` **$0.00099** per delivered creative (**$0.99 per 1,000**). Only `type=item` rows with an `adId` or a stable `sourceUrl`, and a `headline` or `text`, are billed; error rows are free. Set `maxChargeUsd` as a cap. 1,000 ads ≈ **$0.991**. 20 ads (prefill) ≈ **$0.021**. Proxy and compute are included in the event prices.

### Input

- `keywords` — keyword searches. If you leave keywords, advertisers, and startUrls empty, the Actor uses the prefill keyword (`crm`).
- `advertisers` — advertiser or company names.
- `startUrls` — Ad Library search or ad URLs (`linkedin.com/ad-library/…`). These run first.
- `country` (default `us`, lowercase ISO 3166-1 alpha-2).
- `maxAds` — cap on creative rows this run (default 20, maximum 1,000).
- Optional: `startDate` / `endDate` (best-effort filters), `maxChargeUsd`, `outputFormat=compact`, `proxyConfiguration` (default **US residential** — datacenter exits are typically blocked).

### Output

One dataset row per creative, plus an `error` row if a single query fails.

| Field | Meaning |
|---|---|
| `type` | `item` (a creative) or `error` |
| `adId` | Stable ad id when present |
| `advertiserName`, `advertiserUrl` | Advertiser identifiers |
| `format` | Creative format when detected |
| `headline`, `text`, `cta` | Visible copy and call to action |
| `imageUrl` | Preview image when present |
| `country`, `query` | Requested country and the query that produced the row |
| `sourceUrl` | Cite-back URL on the LinkedIn Ad Library |
| `scrapedAt`, `error` | Scrape time; error text on `type=error` rows |

### Pricing

Pay per event:

| Event | Price |
|---|---|
| Actor start (`apify-actor-start`) | **$0.001** per run (at the default 1 GB memory) |
| Ad (`ad`) | **$0.00099** each (**$0.99 per 1,000**) |

Only delivered `type=item` creatives are billed. Error rows are free. Zero matches = start fee only. Proxy and compute are included in the event prices. `maxChargeUsd` stops the run before it would go over. **Works on Apify’s Free plan.**

### Reliability and limits

- There is no official public Ad Library API. Official LinkedIn marketing APIs are not used. The library can change or block anonymous access without notice.
- If one query is blocked or invalid, that query becomes an error row and the run still succeeds. An empty input uses the prefill keyword so a first try always returns creatives (or a single error row).
- Date filters are best-effort. This version returns creatives only — no impressions, targeting, or landing-page enrichment.

### More examples

Several keywords, compact output:

```json
{
  "mode": "ads",
  "keywords": ["crm", "erp"],
  "country": "us",
  "maxAds": 50,
  "outputFormat": "compact",
  "maxChargeUsd": 1
}
```

A pasted Ad Library search URL:

```json
{
  "mode": "ads",
  "startUrls": ["https://www.linkedin.com/ad-library/search?keywords=crm&countries=US"],
  "maxAds": 20,
  "maxChargeUsd": 0.10
}
```

### Run it on a schedule

Suggested frequency: **weekly** to track a competitor's new B2B creatives, **daily** during a launch you are watching. Save your input as a **Task** in Apify Console, then add a **Schedule**. Send results to **Google Sheets**, **Slack**, **webhooks**, **Make / Zapier / n8n**, or an AI agent through the **Apify MCP server**.

### FAQ

**Is there an official LinkedIn Ad Library API?**
No public API. This Actor reads the public LinkedIn Ad Library that any visitor can browse.

**Do I need a LinkedIn account or cookies?**
No. No login, cookies, or session token, so there is no account to get restricted.

**What does a run cost?**
$0.001 to start plus $0.00099 per ad ($0.99 per 1,000). A 20-ad prefill run is about $0.021. Proxy and compute are included in those event prices, so there is no separate proxy bill. Error rows are free.

**What can I search by?**
Keywords, advertiser names, or a pasted Ad Library search URL (`startUrls`). They run in a fixed order until `maxAds` is reached.

**Do I get impressions or targeting?**
Not in this version. Rows are the creatives: advertiser, headline, text, call to action, preview image and source URL.

**Can I use it with AI agents or MCP?**
Yes, through the Apify MCP server or API. `outputFormat: "compact"` writes a token-lean copy (`OUTPUT_COMPACT`) with null fields dropped.

### Feedback

If the data helped, a short rating on the [Reviews tab](https://apify.com/dheerajitbhu/linkedin-ad-library/reviews) helps others find this Actor. Something broke or a field is missing? Open an issue on the [Issues tab](https://apify.com/dheerajitbhu/linkedin-ad-library/issues) — we aim to reply within 24 hours.

### Related actors

- **[Google Ads Transparency Center Scraper](https://apify.com/dheerajitbhu/google-ads-transparency)** — competitor ad creatives by domain or advertiser.
- **[Shopify App Store Scraper](https://apify.com/dheerajitbhu/shopify-app-store)** — Shopify app listings, ratings and pricing by keyword or category.
- **[Google Play Reviews Scraper](https://apify.com/dheerajitbhu/google-play-reviews)** — Android app reviews, ratings and developer replies.

**Keywords:** LinkedIn Ad Library scraper, LinkedIn ads scraper, LinkedIn ads API, B2B competitor ads, LinkedIn ad creatives.

# Actor input Schema

## `mode` (type: `string`):

ads is the default and is what a Try-for-free / empty run uses. selftest is an internal health check — do not use it for regular runs.

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

Keyword searches in the Ad Library. Used when no startUrls or advertisers are given. If everything is empty, the prefill keyword is used so an empty/QA run still exercises the real path.

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

Advertiser or company names to search. Processed after startUrls and before keywords, sharing one maxAds cap. Not required.

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

Pasted Ad Library search or ad URLs. These run first, then advertisers, then keywords, until maxAds is reached. Only linkedin.com/ad-library URLs are fetched.

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

ISO 3166-1 alpha-2 country code, lowercase (same convention as our Play, App Store, and Ads Actors). Converted to the library's country parameter internally (US). Best-effort until a live capture confirms it is applied server-side.

## `startDate` (type: `string`):

Best-effort lower bound on when an ad ran. Documented as client-side until a live capture confirms a server-side parameter. Listings with no parseable date are kept.

## `endDate` (type: `string`):

Best-effort upper bound on when an ad ran. Client-side until confirmed. Listings with no parseable date are kept.

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

Cap on ad rows delivered this run. Default equals prefill (20) so an empty {} run and Store QA stay inside the 5-minute window.

## `outputFormat` (type: `string`):

Compact writes the same billed rows to the key-value store as OUTPUT_COMPACT, a token-efficient copy for LLM/MCP clients.

## `maxChargeUsd` (type: `number`):

Optional spend cap in USD. The run stops delivering further ads once this cap would be exceeded. A run costs $0.001 to start plus $0.00099 per ad ($0.99 per 1,000). Proxy and compute are included in the event prices.

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

Default equals prefill: sticky US residential. Datacenter exits (and a Chrome-like TLS client) 403 on the Ad Library; the confirmed anonymous path is Firefox TLS impersonation plus residential, with no login or cookies. An explicit proxy group or your own proxy URLs are left alone. mode=probe remains as a diagnostic.

## Actor input object example

```json
{
  "mode": "ads",
  "keywords": [
    "crm"
  ],
  "country": "us",
  "maxAds": 20,
  "outputFormat": "standard",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

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

Dataset rows (type item or error).

## `compact` (type: `string`):

Present when outputFormat=compact: same rows as OUTPUT_COMPACT.

# 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 = {
    "mode": "ads",
    "keywords": [
        "crm"
    ],
    "country": "us",
    "maxAds": 20,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("dheerajitbhu/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 = {
    "mode": "ads",
    "keywords": ["crm"],
    "country": "us",
    "maxAds": 20,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("dheerajitbhu/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 '{
  "mode": "ads",
  "keywords": [
    "crm"
  ],
  "country": "us",
  "maxAds": 20,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call dheerajitbhu/linkedin-ad-library --silent --output-dataset

```

## MCP server setup

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