# LinkedIn Ads Library Scraper (`muhammadafzal/linkedin-ads-library-scraper`) Actor

Collect public LinkedIn ads by keyword, advertiser, or ad URL using ScrapeCreators. Export ad copy, creative media, advertiser details, and formats.

- **URL**: https://apify.com/muhammadafzal/linkedin-ads-library-scraper.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 1 monthly users, 66.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 linkedin ad records

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 Ads Library Scraper

Collect public LinkedIn ads by keyword, advertiser name, or ad detail URL. This Actor uses the owner's configured **ScrapeCreators API** after direct HTTP, Chrome, Apify proxies, and DataImpulse returned HTTP 403. No LinkedIn login, user cookies, browser, or proxy configuration is required from buyers.

### Input

| Field | Use |
| --- | --- |
| `keyword` | Search public ad copy, for example `marketing automation`. |
| `advertiser` | Search advertiser names, for example `Microsoft`. Matches similarly named companies too; it is not an exact company ID filter. |
| `adUrls` | Direct public `https://www.linkedin.com/ad-library/detail/<ID>` URLs. Overrides search fields; maximum 100 URLs. |
| `maxResults` | 1–100 unique ads, default 10. Verified free-plan runs stop at five. |
| `includeDetails` | Retained for compatibility. Search responses already include enriched fields; true and false return the same fields without extra detail requests. |

Provide a keyword, advertiser name, or ad URL. Search pages are capped at five provider pages, with at most two HTTP attempts per page. Direct URLs are bounded by the effective result limit. Invalid input is rejected before provider calls. A nonexistent ad or no-match query returns an explicit empty summary rather than fabricated rows.

```json
{"keyword":"marketing automation","maxResults":10}
```

```json
{"advertiser":"Microsoft","maxResults":5}
```

```json
{"adUrls":["https://www.linkedin.com/ad-library/detail/1569053494"],"maxResults":1}
```

### Extracted fields

| Field | Meaning |
| --- | --- |
| `adId`, `adUrl` | Stable Library ID and public detail link. |
| `advertiserName`, `advertiserUrl` | Displayed advertiser and LinkedIn organization link. |
| `adType` | Source ad format, for example Single Image Ad or Video Ad. |
| `text`, `headline` | Public ad copy and creative headline. |
| `imageUrl`, `videoUrl` | Public creative media when available. |
| `paidForBy` | Source payer disclosure when available; otherwise null. |
| `searchUrl` | Source search URL; null for direct ad requests. |

Optional source fields are explicit nulls. Media URLs may expire. The Actor does not estimate spend, reach, conversions, or campaign performance. It deduplicates IDs before writing or billing.

```json
{
  "adId":"1569053494",
  "adUrl":"https://www.linkedin.com/ad-library/detail/1569053494",
  "advertiserName":"Microsoft",
  "advertiserUrl":"https://www.linkedin.com/company/1035",
  "adType":"Single Image Ad",
  "text":"The hardest part of a good idea? Starting it.",
  "headline":"From Idea to First Commit",
  "imageUrl":null,
  "videoUrl":null,
  "paidForBy":null,
  "searchUrl":"https://www.linkedin.com/ad-library/search?accountOwner=Microsoft"
}
```

`SUMMARY` records outcome, delivered ads, provider requests, provider-reported credits, charged result/start events, stop reason, and warnings. Outcomes distinguish data, empty, rejected input, partial data, and provider failure. Failed provider authentication, exhausted credits, timeouts, or invalid provider responses are reported as failures rather than silent zero-result success. `STATE` contains a compact cursor and IDs for graceful resume.

### Pricing

Current private live base pricing is $0.01 per start and $0.005 per delivered ad. Synthetic events are charged by Apify, with no manual duplicate charging. Empty/failed runs produce no result events; the start event still applies. The proposed tier table below awaits owner approval and live verification:

| Event | FREE | BRONZE (2.5%) | SILVER (5%) | GOLD/PLATINUM/DIAMOND (20%) |
| --- | ---: | ---: | ---: | ---: |
| Start | $0.010000 | $0.009750 | $0.009500 | $0.008000 |
| Ad record | $0.005000 | $0.004875 | $0.004750 | $0.004000 |

At base rates, one ad is $0.015, ten ads are $0.060, and 100 ads are $0.510. Charge limits are checked before provider work and before writes. A verified free-plan run delivers at most five business results and tells the user to upgrade for more.

ScrapeCreators search and detail endpoints each cost one provider credit per successful request. A search page may include up to 24 ads, while a direct lookup costs one credit per ad. External provider costs are covered by the Actor owner and remain separate from Apify usage measurements.

### Setup and limits

The owner must configure `SCRAPECREATORS_API_KEY` as a private Actor-version environment secret. The repository contains no keys. `scripts/configure-provider.py` accepts the key only from the environment and configures it without printing it.

Search returns the public Library corpus exposed by the provider, which changes over time. Results and optional fields vary by ad format and region. The Actor makes no completeness guarantee for all ads ever run. Use it for public ad research and comply with source terms and applicable laws; avoid unnecessary collection or republication of personal data.

Provider references: [Search ads](https://docs.scrapecreators.com/v1/linkedin/ads/search/) and [Ad details](https://docs.scrapecreators.com/v1/linkedin/ad/).

# Actor input Schema

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

Search ad text for a word or phrase, for example marketing automation. Combine with advertiser to narrow results.

## `advertiser` (type: `string`):

Search company or advertiser name, for example Microsoft. This is a name search and can also match similarly named advertisers.

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

Optional direct public LinkedIn Ad Library detail URLs, for example https://www.linkedin.com/ad-library/detail/1558793543. When provided, search fields are ignored.

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

Stop after this many unique ads. Allowed 1–100. Verified free-plan runs are capped at five.

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

Compatibility setting: ScrapeCreators search already returns enriched ad details, so both true and false return the same structured fields without additional detail requests.

## Actor input object example

```json
{
  "keyword": "marketing automation",
  "maxResults": 10,
  "includeDetails": true
}
```

# Actor output Schema

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

Unique ad records.

## `summary` (type: `string`):

Outcome and warnings.

# 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": "marketing automation",
    "maxResults": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/linkedin-ads-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": "marketing automation",
    "maxResults": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/linkedin-ads-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": "marketing automation",
  "maxResults": 10
}' |
apify call muhammadafzal/linkedin-ads-library-scraper --silent --output-dataset

```

## MCP server setup

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