LinkedIn Ad Library with texts, stats and targeting (by H3.0) avatar

LinkedIn Ad Library with texts, stats and targeting (by H3.0)

Pricing

from $0.10 / actor start

Go to Apify Store
LinkedIn Ad Library with texts, stats and targeting (by H3.0)

LinkedIn Ad Library with texts, stats and targeting (by H3.0)

Scrapes the LinkedIn ad Library for detailed information about the ads and gives the data for marketing purposes and Share of Voice based decisions.

Pricing

from $0.10 / actor start

Rating

0.0

(0)

Developer

79cz

79cz

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

19 days ago

Last modified

Share

LinkedIn Ad Library Scraper – API Integration Guide

This document describes the Actor's inputs and outputs for AI agents building API connections to this Actor. Use it to prepare correct request payloads and consume response data.


Overview

Actor name: linkedin-ad-library-scraper
What it does: Searches LinkedIn Ad Library by filters (advertiser, keyword, country, dates) and optionally scrapes each ad's detail page for full metadata (impressions, targeting, country split).

Apify API base: https://api.apify.com/v2


Running the Actor via API

1. Start a run

POST https://api.apify.com/v2/acts/{USERNAME}~linkedin-ad-library-scraper/runs
Authorization: Bearer {APIFY_TOKEN}
Content-Type: application/json
{
"keyword": "JetBrains",
"country": "DE",
"maxResults": 20,
"scrapeAdDetails": true
}

Replace {USERNAME} with the Apify account username and {APIFY_TOKEN} with a valid API token.

2. Poll for completion

GET https://api.apify.com/v2/actor-runs/{runId}
Authorization: Bearer {APIFY_TOKEN}

Response includes status (RUNNING | SUCCEEDED | FAILED | ABORTED). When status is SUCCEEDED, fetch the output.

3. Fetch results

Dataset (scraped ads):

GET https://api.apify.com/v2/datasets/{defaultDatasetId}/items
Authorization: Bearer {APIFY_TOKEN}

Run summary (metadata):

GET https://api.apify.com/v2/key-value-stores/{defaultKeyValueStoreId}/records/OUTPUT
Authorization: Bearer {APIFY_TOKEN}

defaultDatasetId and defaultKeyValueStoreId are in the run response when the run succeeds.


Input Schema

Send a JSON object as the request body. All fields are optional, but at least one of these must be provided: detailUrls, companyOrAdvertiser, payer, or keyword.

Search filters (choose at least one when not using detailUrls)

FieldTypeDescriptionExample
companyOrAdvertiserstringFilter by advertiser or company name"JetBrains"
payerstringFilter by paying organization"Acme Corp"
keywordstringSearch keyword for ads"developer tools"
FieldTypeDescriptionExample
detailUrlsstring[]Scrape these ad detail URLs directly. Bypasses search.["https://www.linkedin.com/ad-library/detail/1191832683"]

Additional search filters

FieldTypeDefaultDescriptionExample
countrystringCountry filter (2-letter code). Used for country-specific impressions."DE"
datePresetstring"this-year"Date range preset. Options: "last-30-days", "this-month", "this-year", "last-year""this-year"
startDatestringCustom start date (YYYY-MM-DD). Overrides datePreset when used with endDate."2025-01-01"
endDatestringCustom end date (YYYY-MM-DD)."2025-12-31"

Scraping options

FieldTypeDefaultDescription
maxResultsinteger10Max number of ads to scrape. Min: 1, Max: 100000.
batchSizeinteger50Number of items to push to dataset before flush. Min: 1, Max: 2000.
scrapeAdDetailsbooleantrueVisit each ad detail page for full metadata (impressions, targeting, country split).
readImagesbooleanfalseUse OCR to extract text from ad images.
useProxybooleanfalseUse Apify proxy. Recommended to reduce LinkedIn blocks (403).

Authentication

FieldTypeDescription
authCookiesobject[]LinkedIn session cookies for authenticated scraping. Each object: { name, value, domain?, path? }.

Input examples

Search by keyword and country:

{
"keyword": "JetBrains",
"country": "DE",
"maxResults": 50,
"scrapeAdDetails": true,
"useProxy": true
}

Direct URLs only (no search):

{
"detailUrls": [
"https://www.linkedin.com/ad-library/detail/1191832683",
"https://www.linkedin.com/ad-library/employer-brand/1234567"
],
"scrapeAdDetails": true
}

Search by advertiser with custom dates:

{
"companyOrAdvertiser": "kt.academy",
"startDate": "2025-01-01",
"endDate": "2025-03-15",
"maxResults": 100
}

Output Schema

Dataset (array of ad objects)

Each dataset item is a flat object with these fields. All fields are strings unless noted. Empty or missing values are often "".

FieldTypeDescriptionExample
adIdstringLinkedIn ad identifier"1191832683"
adDetailUrlstringDirect link to ad in LinkedIn Ad Library"https://www.linkedin.com/ad-library/detail/1191832683"
advertiserNamestringAdvertiser or company name"kt.academy"
advertiserUrlstringLink to advertiser's LinkedIn company page
advertiserLogoUrlstringURL of advertiser logo
adFormatstringAd type"Single Image Ad"
headlinestringAd headline
bodyTextstringMain ad copy from detail page
searchResultsAdTextstringAd text as shown on search results
primaryImageUrlstringURL of main ad image
ctaTextstringCall-to-action button text
startDatestringWhen ad started running"Mar 9, 2026"
endDatestringWhen ad stopped running"Mar 15, 2026"
totalImpressionsIntervalstringImpressions range as shown"1k-5k", "20k-30k"
impressionRangestringSame as totalImpressionsInterval (legacy)
paidBystringOrganization that paid for the ad
targetingLanguagestringTarget language settings
targetingLocationstringTarget location settings
TargetingAudiencestring"Targeted" | "Excluded" | "Targeted and Excluded" | "Not Used"
TargetingDemographicsstringSame enum
TargetingCompanystringSame enum
TargetingEducationstringSame enum
TargetingJobstringSame enum
TargetingInterestsstringSame enum
allCountriesImpressionsLowerBoundinteger | stringNumeric lower bound from interval1000
allCountriesImpressionsUpperBoundinteger | stringNumeric upper bound from interval5000
countrySplitstringCountry and percentage pairs`"Germany
countrySharestringTarget country's percentage when filter used
countryImpressionsLowerBoundstringLower bound for target country
countryImpressionsUpperBoundstringUpper bound for target country
carouselImageUrlsstringCarousel image URLs
documentPageUrlsstringDocument ad page URLs
videoUrlstringVideo ad URL
adTextOcrstringText from ad images via OCR (if readImages enabled)
scrapedAtstringISO 8601 timestamp when item was scraped"2026-03-15T04:30:00.000Z"

Run summary (key-value store record OUTPUT)

{
"totalAds": 20
}

totalAds is the number of unique ads scraped.


Output URLs (from run response)

After a successful run, the run object contains:

  • defaultDatasetId – use to fetch items: GET .../datasets/{defaultDatasetId}/items
  • defaultKeyValueStoreId – use to fetch OUTPUT: GET .../key-value-stores/{defaultKeyValueStoreId}/records/OUTPUT

Or use the output schema templates from the run:

  • Dataset items: {links.apiDefaultDatasetUrl}/items
  • Run summary: {links.apiDefaultKeyValueStoreUrl}/records/OUTPUT

Validation rules (API client)

  1. At least one of: detailUrls (non-empty), companyOrAdvertiser, payer, or keyword must be set.
  2. Dates: If startDate or endDate is set, both should be set. Format: YYYY-MM-DD.
  3. detailUrls: Each URL should be a LinkedIn ad library URL (/ad-library/detail/ or /ad-library/employer-brand/).
  4. authCookies: If provided, each cookie must have name and value.

Error handling

  • Run status: "FAILED" – check run stats and logs for the cause.
  • Empty dataset – no ads matched filters, or LinkedIn returned errors (try useProxy: true or authCookies).
  • ERR_HTTP_RESPONSE_CODE_FAILURE – LinkedIn blocking (403) or ad gone (404). Enable proxy or reduce maxResults.