# LinkedIn Ad Library Scraper - Ads, Advertisers & Impressions (`socialscrapers/linkedin-ad-library-scraper`) Actor

Scrape the LinkedIn Ad Library without login: competitor B2B ads by keyword, advertiser or payer with ad copy, creatives, videos, carousels, CTA, landing page, Paid for by, run dates, impressions by country and targeting. Ad spy tool. $1.42 per 1,000 ads.

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

## Pricing

from $1.14 / 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.
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 Ad Library Scraper

**LinkedIn Ad Library Scraper** extracts ads from the public [LinkedIn Ad Library](https://www.linkedin.com/ad-library) without a LinkedIn account, cookies or login. Search by keyword, advertiser or payer, filter by country and date, and get every ad with its text, headline, call to action, landing page, images, video files, carousel cards, documents and message ads, plus "Paid for by", run dates, impressions by country and the advertiser's targeting. It costs **$1.42 per 1,000 ads**.

> 💡 **Need a feature that isn't here? Just ask.** Open an issue on the **Issues** tab and tell us what you need: a new field, filter, input type or output format. We build requested features fast, usually within 24 hours, at no extra cost.

> ⭐ **Found it useful?** A short review on the **Reviews** tab helps other people find this scraper, and tells us what to build next.

### What does LinkedIn Ad Library Scraper do?

- **Four ways to search.** Keywords in the ads, advertiser (company) names, the "Paid for by" entity, or Ad Library URLs copied from your browser — searches or single ads.
- **Every Ad Library filter.** Countries (one or many) and dates: last 30 days, this month, this year, last year, or a custom range. URLs keep all their own filters.
- **All results.** The Actor pages through the whole search; set `maxAds` to `0` for every ad.
- **The whole creative.** Intro text, headline, description, call to action, landing page, images, video files (best quality first) and cover, carousel cards, document title and pages, and message ads (sender, text, buttons).
- **Transparency data.** "Paid for by", the advertiser's page, first and last day the ad ran, total impressions as a range, the share of impressions per country, and targeting: languages, locations included and excluded, and which targeting parameters (audience, demographic, company, education, job, member interests) were used.
- **Every format.** Single image, video, carousel, document, message, conversation, event, text, spotlight, follower, job and thought-leader ads.
- **Pay only for ads delivered.** The run stops cleanly at the spending limit you set.

### What data can you extract?

One item per ad. Every field is always present; `null` or `[]` means LinkedIn shows nothing for it.

| Field | Description |
|---|---|
| `adId`, `adUrl` | The ad's ID and its page in the Ad Library |
| `advertiserName`, `advertiserUrl`, `advertiserLogoUrl` | The advertiser |
| `promotedMember` | Thought-leader ads: the member whose post is promoted (name, url, headline, imageUrl) |
| `format`, `formatLabel`, `creativeType` | `SINGLE_IMAGE`, `VIDEO`, `CAROUSEL`, `DOCUMENT`, `MESSAGE`, `CONVERSATION`, `EVENT`, `TEXT`, `SPOTLIGHT`, `FOLLOWER`, `JOB`, `ARTICLE`…, LinkedIn's own label and type |
| `introText`, `headline`, `description` | The ad's words |
| `callToAction`, `landingUrl` | The button and where the ad leads |
| `imageUrls`, `videoUrls`, `videoPosterUrl` | Media |
| `carouselCards` | Carousel ads: each card's `title`, `imageUrl`, `landingUrl` |
| `document` | Document ads: `title`, `pageCount`, `coverImageUrls` |
| `message` | Message ads: `senderName`, `senderImageUrl`, `text`, `buttons` |
| `paidBy` | Who paid for the ad |
| `firstShown`, `lastShown`, `runDatesText` | When the ad ran |
| `impressionsText`, `impressionsLow`, `impressionsHigh` | Total impressions as a range (`1k-5k`, `< 1k`) with numbers |
| `impressionsByCountry` | Share of impressions per country (fractions of 1) |
| `targetedLanguages`, `targetedLocations`, `excludedLocations` | Targeting at a glance |
| `targetingSegments`, `targetingParameters` | Every targeting category with its values, and which parameters were targeted or excluded |
| `hasDetails`, `input`, `inputType`, `scrapedAt` | Whether the ad's page was read, where the ad came from, and when |

### How to scrape the LinkedIn Ad Library

1. Open the Actor and add advertisers, keywords, payers or Ad Library URLs.
2. Pick countries and a date range if you need them.
3. Set **Max ads per search** (`0` = all).
4. Click **Start**, then download the ads as JSON, CSV, Excel, XML or HTML, or read them through the API.

### How much does it cost?

You pay per ad delivered to the dataset: **$1.42 per 1,000 ads**, with or without ad details. Apify subscribers pay less: **Silver −10%** ($1.278 per 1,000) and **Gold, Platinum and Diamond −20%** ($1.136 per 1,000). Each run also carries Apify's standard Actor start charge of $0.0005 (one per GB of memory, at least one).

| Job | Ads | Price (no discount) |
|---|---|---|
| The newest 100 ads of 10 competitors | 1,000 | $1.42 |
| Every ad mentioning a keyword (5,000 ads) | 5,000 | $7.10 |
| A weekly check of 20 advertisers, 50 ads each | 1,000 a week | $1.42 a week |

Searches with no results and ads that cannot be found cost nothing. To cap spending, set a **maximum total charge** in the run options: the Actor stops cleanly once it is reached and keeps everything collected so far.

### Input example

```json
{
  "advertisers": ["HubSpot"],
  "searchTerms": ["project management"],
  "payers": [],
  "startUrls": ["https://www.linkedin.com/ad-library/search?keyword=crm&countries=DE"],
  "countries": ["US", "DE"],
  "dateOption": "last-30-days",
  "maxAds": 100,
  "includeAdDetails": true
}
```

The scraper picks Apify Proxy's tier itself: datacenter first, residential only when a request is refused.

### Output example

A real ad from a test run (long links shortened):

```json
{
  "adId": "1631307464",
  "adUrl": "https://www.linkedin.com/ad-library/detail/1631307464",
  "advertiserName": "HubSpot",
  "advertiserUrl": "https://www.linkedin.com/company/68529",
  "advertiserLogoUrl": "https://media.licdn.com/dms/image/v2/C4D0BAQF8H-SLmMDZlA/company-logo_100_100/…",
  "promotedMember": null,
  "format": "VIDEO",
  "formatLabel": "Video Ad",
  "creativeType": "SPONSORED_VIDEO",
  "introText": "La recherche par IA transforme la manière dont les clients découvrent les marques. HubSpot AEO vous indique précisément votre positionnement et les leviers indispensables pour surpasser la concurrence.",
  "headline": "Se démarquer en recherche IA, ça rapporte.",
  "description": null,
  "callToAction": "Learn more",
  "landingUrl": "https://www.hubspot.fr/products/aeo?utm_source=linkedin&utm_medium=paid_brandstrategy&…",
  "imageUrls": [],
  "videoUrls": [
    "https://dms.licdn.com/playlist/vid/v2/D4E10AQEiybKJQl8Bvg/progressive-servable-video/…",
    "https://dms.licdn.com/playlist/vid/v2/D4E10AQEiybKJQl8Bvg/mp4-720p-30fp-crf28/…"
  ],
  "videoPosterUrl": "https://media.licdn.com/dms/image/v2/D4E10AQEiybKJQl8Bvg/videocover-high/…",
  "carouselCards": [],
  "document": null,
  "message": null,
  "paidBy": "HubSpot, Inc.",
  "firstShown": "2026-11-05",
  "lastShown": "2026-11-08",
  "runDatesText": "Ran from Nov 5, 2026 to Nov 8, 2026",
  "impressionsText": "10k-20k",
  "impressionsLow": 10000,
  "impressionsHigh": 20000,
  "impressionsByCountry": [
    { "country": "France", "share": 1 },
    { "country": "United Arab Emirates", "share": 0.005 },
    { "country": "United States", "share": 0.005 }
  ],
  "targetedLanguages": ["English"],
  "targetedLocations": ["France"],
  "excludedLocations": [],
  "targetingSegments": [
    { "category": "Language", "includes": ["English"], "excludes": [] },
    { "category": "Location", "includes": ["France"], "excludes": [] }
  ],
  "targetingParameters": [
    { "name": "Audience", "targeted": true, "excluded": false },
    { "name": "Demographic", "targeted": false, "excluded": false },
    { "name": "Company", "targeted": true, "excluded": true },
    { "name": "Education", "targeted": false, "excluded": false },
    { "name": "Job", "targeted": true, "excluded": true },
    { "name": "Member Interests and Traits", "targeted": false, "excluded": false }
  ],
  "hasDetails": true,
  "input": "HubSpot",
  "inputType": "advertiser",
  "scrapedAt": "2026-11-08T12:29:54.428Z"
}
```

### Use cases

- **Competitor B2B ad research:** every ad a competitor runs on LinkedIn, its message, offer, call to action and landing page.
- **Creative inspiration:** collect hooks, headlines, videos, carousels and documents that work for your audience.
- **Targeting intelligence:** see which countries, languages and targeting parameters advertisers use for ads shown in the EU.
- **Campaign monitoring:** schedule the Actor to follow advertisers or keywords week by week.
- **Market research and datasets:** gather B2B ad copy and media at scale for analysis or training data.

### API, Python, JavaScript & integrations

**JavaScript**

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('socialscrapers/linkedin-ad-library-scraper').call({
    advertisers: ['HubSpot'],
    countries: ['US'],
    maxAds: 100,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("socialscrapers/linkedin-ad-library-scraper").call(run_input={
    "searchTerms": ["project management"],
    "maxAds": 0,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["advertiserName"], item["headline"], item["landingUrl"])
```

Connect it to **Make, Zapier, n8n, Google Sheets** and other tools with [Apify integrations](https://docs.apify.com/platform/integrations), get notified with [webhooks](https://docs.apify.com/platform/integrations/webhooks), run it on a [schedule](https://docs.apify.com/platform/schedules), or call it from AI agents through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp).

### Limits

- **EU transparency data.** LinkedIn publishes run dates, impressions, countries and targeting for ads shown in the European Union. Other ads come with their creative, advertiser and "Paid for by" line.
- **Custom dates.** LinkedIn's custom date range covers the last 12 months, ends yesterday at the latest and spans at least two days; the Actor fits your dates into that window and says so in the log. For older ads, use the "Last year" option.
- **Each search stands alone.** An ad that matches several of your searches is returned once for each of them; `input` says which.
- **Ad versions.** Some ads have several versions; the Ad Library page shows one of them.
- **Media links expire.** Image and video links point to LinkedIn's servers and stop working after some time. Download media promptly if you need it.
- **A run with 0 results still succeeds.** When an advertiser or ad does not exist in the Ad Library, or nothing matches a search and its filters, the run ends as Succeeded with a status message naming each search and why, and nothing is charged. When nothing in the input can be used at all, the run also ends as Succeeded, with a status message that starts "Nothing to scrape:" and says what to fix; no results are charged. A run fails only when LinkedIn refuses every one of 3 or more searches and a well-known public LinkedIn Ad Library search is refused too (the scraper is then blocked; try again later).

### FAQ

**Is it legal to scrape the LinkedIn Ad Library?**
The Actor reads only what the Ad Library shows to every visitor, without logging in. You are responsible for how you use the data, including LinkedIn's terms and data-protection laws.

**Do I need a LinkedIn account or cookies?**
No. The Actor works logged out.

**How many ads can I get?**
All the ads a search finds: set `maxAds` to `0`.

**Why did I get fewer ads than I asked for?**
The search has fewer results under your filters, or the run reached its maximum total charge. The run log says which, for each search.

**Can I get only new ads?**
Run the Actor on a schedule with a recent date range (for example "Last 30 days") and keep the ad IDs you already have; new ads have IDs you have not seen.

**How fast is it?**
In our tests, 500 ads with all details took about two minutes, and 500 ads without details (`includeAdDetails` off) under 30 seconds.

### Other scrapers by Social Scrapers

| Scraper | What it gets |
| --- | --- |
| [TikTok API](https://apify.com/socialscrapers/tiktok-api) | Profiles, Videos and Comments |
| [TikTok Comments Scraper](https://apify.com/socialscrapers/tiktok-comments-scraper) | Comments, Replies and Likes |
| [TikTok Hashtag Scraper](https://apify.com/socialscrapers/tiktok-hashtag-scraper) | Top Videos, Views and Likes |
| [TikTok Profile Scraper](https://apify.com/socialscrapers/tiktok-profile-scraper) | Followers, Bio, Stats and Videos |
| [TikTok Scraper](https://apify.com/socialscrapers/tiktok-scraper) | Videos, Profiles, Hashtags and Comments |
| [TikTok Sound Scraper](https://apify.com/socialscrapers/tiktok-sound-scraper) | Videos Using a Sound and Music Info |
| [TikTok Video Scraper](https://apify.com/socialscrapers/tiktok-video-scraper) | Views, Likes, Captions and Comments |
| [Instagram API](https://apify.com/socialscrapers/instagram-api) | Profiles, Posts, Reels, Comments and Hashtags |
| [Instagram Comments Scraper](https://apify.com/socialscrapers/instagram-comments-scraper) | Comments, Likes and Reply Counts |
| [Instagram Hashtag Scraper](https://apify.com/socialscrapers/instagram-hashtag-scraper) | Reels and Keyword Search |
| [Instagram Post Details Scraper](https://apify.com/socialscrapers/instagram-post-details-scraper) | Likes, Comments, Views and Media |
| [Instagram Post Scraper](https://apify.com/socialscrapers/instagram-post-scraper) | Posts, Reels and Comments |
| [Instagram Profile Scraper](https://apify.com/socialscrapers/instagram-profile-scraper) | Followers, Bio, Posts and Reels |
| [Instagram Reels Scraper](https://apify.com/socialscrapers/instagram-reels-scraper) | Reels, Plays, Likes and Comments |
| [Instagram Reels Transcript Scraper](https://apify.com/socialscrapers/instagram-reels-transcript-scraper) | Speech to Text and Captions |
| [Instagram Scraper](https://apify.com/socialscrapers/instagram-scraper) | Posts, Profiles, Reels, Comments and Hashtags |
| [YouTube API](https://apify.com/socialscrapers/youtube-api) | Videos, Transcripts, Search, Channels and Comments |
| [YouTube Channel Scraper](https://apify.com/socialscrapers/youtube-channel-scraper) | Videos, Shorts, Subscribers and About |
| [YouTube Comments Scraper](https://apify.com/socialscrapers/youtube-comments-scraper) | Comments, Replies and Likes |
| [YouTube Scraper](https://apify.com/socialscrapers/youtube-scraper) | Videos, Shorts, Channels and Comments |
| [YouTube Search Scraper](https://apify.com/socialscrapers/youtube-search-scraper) | Videos, Channels, Views and Filters |
| [YouTube Shorts Scraper](https://apify.com/socialscrapers/youtube-shorts-scraper) | Shorts, Views, Likes and Search |
| [YouTube Transcript Scraper](https://apify.com/socialscrapers/youtube-transcript-scraper) | Subtitles, Captions and SRT |
| [YouTube Video Details Scraper](https://apify.com/socialscrapers/youtube-video-details-scraper) | Stats, Subtitles and Comments |
| [Facebook Ads Library Scraper](https://apify.com/socialscrapers/facebook-ads-library-scraper) | Meta Ad Library and Spend |
| [Facebook Comments Scraper](https://apify.com/socialscrapers/facebook-comments-scraper) | Posts, Reels, Videos and Replies |
| [Facebook Groups Scraper](https://apify.com/socialscrapers/facebook-groups-scraper) | Public Group Posts and Reactions |
| [Facebook Marketplace Scraper](https://apify.com/socialscrapers/facebook-marketplace-scraper) | Prices, Locations and Sellers |
| [Facebook Page Contact Info Scraper](https://apify.com/socialscrapers/facebook-page-contact-scraper) | Email, Phone and WhatsApp |
| [Facebook Posts Scraper](https://apify.com/socialscrapers/facebook-profile-posts-scraper) | Pages, Profiles and Timelines |
| [Facebook Pages Scraper](https://apify.com/socialscrapers/facebook-profile-scraper) | Profiles, Contact Info and Reviews |
| [Facebook Reels Scraper](https://apify.com/socialscrapers/facebook-reels-scraper) | Reels, Videos, Plays and Captions |
| [X (Twitter) Profile Scraper](https://apify.com/socialscrapers/x-profile-scraper) | Followers, Bio and Tweets |
| [X (Twitter) Tweet Scraper](https://apify.com/socialscrapers/x-tweet-scraper) | Latest Posts by Profile |
| [Threads Profile Scraper](https://apify.com/socialscrapers/threads-profile-scraper) | Followers, Bio, Links and Posts |
| [Threads Replies Scraper](https://apify.com/socialscrapers/threads-replies-scraper) | Comments, Authors, Likes and Media |
| [Threads Scraper](https://apify.com/socialscrapers/threads-scraper) | Posts, Profiles, Replies and Search |
| [Threads Search Scraper](https://apify.com/socialscrapers/threads-search-scraper) | Keywords, Hashtags, Top and Recent Posts |
| [Reddit Comments Scraper](https://apify.com/socialscrapers/reddit-comments-scraper) | Threads, Replies, Votes and Authors |
| [Reddit Scraper](https://apify.com/socialscrapers/reddit-scraper) | Posts, Comments, Subreddits, Users and Search |
| [Reddit Search Scraper](https://apify.com/socialscrapers/reddit-search-scraper) | Posts by Keyword, Subreddit and Date |
| [Reddit User Scraper](https://apify.com/socialscrapers/reddit-user-scraper) | Profiles, Karma, Posts and Comments |
| [Subreddit Scraper](https://apify.com/socialscrapers/subreddit-scraper) | Hot, New and Top Posts with Comments |
| [Quora Scraper](https://apify.com/socialscrapers/quora-scraper) | Answers, Questions, Profiles and Topic Search |
| [LinkedIn Job Search Scraper](https://apify.com/socialscrapers/linkedin-job-search-scraper) | Filters, Salaries and New Jobs |
| [LinkedIn Jobs Scraper](https://apify.com/socialscrapers/linkedin-jobs-scraper) | Job Listings, Salaries and Companies |
| [Google Maps Email Extractor](https://apify.com/socialscrapers/google-maps-email-extractor) | Emails, Phones and Social Links |
| [Google Maps Scraper](https://apify.com/socialscrapers/google-maps-scraper) | Places, Phones, Websites, Ratings and Hours |
| [Google News Scraper](https://apify.com/socialscrapers/google-news-scraper) | Headlines, Articles and Search |
| [Google Ads Transparency Scraper](https://apify.com/socialscrapers/google-ads-transparency-scraper) | Ad Creatives and Advertisers |
| [Amazon Product Scraper](https://apify.com/socialscrapers/amazon-product-scraper) | Search Results, Prices, Ratings, ASINs |
| [Indeed Jobs Scraper](https://apify.com/socialscrapers/indeed-jobs-scraper) | Salaries, Full Descriptions, Company Data |
| [Contact Details Scraper](https://apify.com/socialscrapers/contact-details-scraper) | Emails, Phones and Social Links |
| [Telegram Channel Scraper](https://apify.com/socialscrapers/telegram-channel-scraper) | Posts, Views and Media |
| [Doximity Scraper](https://apify.com/socialscrapers/doximity-physician-scraper) | Physician Profiles and Doctor Directory |
| [KevinMD Scraper](https://apify.com/socialscrapers/kevinmd-articles-scraper) | Physician Articles and Author Specialties |
| [Op-Med Scraper](https://apify.com/socialscrapers/opmed-articles-scraper) | Physician Essays and Doctor Profiles |
| [Career Site Jobs Scraper](https://apify.com/socialscrapers/career-site-jobs-scraper) | Greenhouse, Lever, Ashby and Workday |
| [Google Trends Scraper](https://apify.com/socialscrapers/google-trends-scraper) | Interest Over Time, Regions and Queries |

# Actor input Schema

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

Companies whose ads you want, as you would type them into the Ad Library's advertiser box, e.g. <code>HubSpot</code>. LinkedIn matches every advertiser whose name contains the text. One search per entry.

## `searchTerms` (type: `array`):

Words in the ads, as typed into the Ad Library's keyword box, e.g. <code>project management</code>. One search per keyword.

## `payers` (type: `array`):

The legal entity that paid for the ads (the "Paid for by" line), e.g. <code>HubSpot, Inc.</code>. One search per entry.

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

Searches copied from your browser's address bar on <code>https://www.linkedin.com/ad-library</code> (every filter in the URL is kept), or links to single ads (<code>https://www.linkedin.com/ad-library/detail/…</code>).

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

Only ads shown in these countries: two-letter codes such as <code>US</code>, <code>DE</code> or <code>GB</code>. Empty means all countries.

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

When the ads ran. Setting a date below picks a custom range.

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

Only ads that ran on or after this day. Pick a date or an age, or type one: a date (<code>2026-01-31</code>, <code>31/01/2026</code>, <code>Jan 31 2026</code>) or an age such as <code>30 days</code>, <code>7 days</code>, <code>2w</code> or <code>3 months</code>. LinkedIn's custom dates cover the last 12 months up to yesterday.

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

Only ads that ran on or before this day: a date (<code>2026-01-31</code>, <code>31/01/2026</code>, <code>Jan 31 2026</code>) or an age such as <code>7 days</code> or <code>yesterday</code>.

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

How many ads to collect for each advertiser, keyword, payer and URL, newest first. <b>0 means all of them.</b>

## `includeAdDetails` (type: `boolean`):

Open each ad's page for everything beyond the search results: full ad text, call to action, landing page, video files, carousel cards, documents, message ads, "Paid for by", run dates, impressions by country and targeting. Turn off for a faster, lighter run with the search results' fields only; the price per ad is the same.

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

Apify Proxy (the default) is recommended. The scraper picks Apify Proxy's tier itself: datacenter first, residential only when a request is refused. Your own proxy URLs are used as given.

## Actor input object example

```json
{
  "advertisers": [
    "HubSpot"
  ],
  "dateOption": "all",
  "maxAds": 20,
  "includeAdDetails": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

# 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 = {
    "advertisers": [
        "HubSpot"
    ],
    "maxAds": 20,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialscrapers/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 = {
    "advertisers": ["HubSpot"],
    "maxAds": 20,
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

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