LinkedIn Ad Library search API
Search the LinkedIn Ad Library by company name, company id or keyword (give at least one).
- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
- Status
- Betashape may still gain fields
Custom dates need both start_date and end_date, within the past year and ending yesterday at the latest. countries is a comma-separated list; the cursor is LinkedIn's pagination token.
Request
Send your key in the x-api-key header.
curl -G "https://api.socialscrape.io/v1/linkedin/ad-library/search" \
-H "x-api-key: $SOCIALSCRAPE_API_KEY" \
--data-urlencode 'company=Microsoft'import os
import requests
params = {
"company": "Microsoft",
}
res = requests.get(
"https://api.socialscrape.io/v1/linkedin/ad-library/search",
headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},
params=params,
timeout=60,
)
body = res.json()
if body["ok"]:
print(body["data"])
else:
print(body["error"]["code"], body["error"]["message"])const url = new URL("https://api.socialscrape.io/v1/linkedin/ad-library/search");
url.search = new URLSearchParams({
company: "Microsoft",
}).toString();
const res = await fetch(url, {
headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },
});
const body = await res.json();
if (body.ok) {
console.log(body.data);
} else {
console.error(body.error.code, body.error.message);
}{
"nodes": [
{
"name": "SocialScrape LinkedIn Ad Library search",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
0,
0
],
"parameters": {
"method": "GET",
"url": "https://api.socialscrape.io/v1/linkedin/ad-library/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "company",
"value": "Microsoft"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.SOCIALSCRAPE_API_KEY }}"
}
]
}
}
}
],
"connections": {}
}Parameters
| Name | Type | Required | Description |
|---|---|---|---|
query | string | Keyword to search for. Also accepted as keyword, q. | |
company | string | Advertiser name. Also accepted as company_name. | |
company_id | string | LinkedIn company id: the number in linkedin.com/company/<id>. Also accepted as companyId. | |
countries | string | Comma-separated 2-letter countries, "US,CA,MX". | |
start_date | string | Start date, YYYY-MM-DD. Use with `end_date`. Also accepted as startDate. | |
end_date | string | End date, YYYY-MM-DD. Use with `start_date`. Also accepted as endDate. | |
cursor | string | Opaque cursor from the previous page; pass it back unchanged. Also accepted as continuationToken, continuation_token, next_max_id, max_id, max_cursor, min_time, after, page_token, pageToken, paginationToken, next_page_id, page. | |
region | string | Two-letter country code (ISO 3166-1) for results that vary by country. Also accepted as country, geo. |
Every request also accepts trim, raw and max_age_days.
Response
Sample from a recorded response, shortened. Values are public data, not yours.
{
"ok": true,
"credits_charged": 1,
"credits_remaining": 4999,
"cached": false,
"cached_at": null,
"request_id": "req_f73f6d8a73de5b3aee83485a",
"data": {
"object": "list",
"items": [
{
"object": "ad",
"platform": "linkedin",
"id": "1662766106",
"url": "https://www.linkedin.com/ad-library/detail/1662766106",
"advertiser": {
"object": "advertiser",
"platform": "linkedin",
"id": null,
"name": "Microsoft AI Cloud Partner Program",
"url": null,
"page_id": null,
"country": null,
"verified": null,
"ad_count": null,
"extra": {
"logo_url": "https://media.licdn.com/dms/image/v2/C560BAQF-MwAnNIx7lQ/company-logo_100_100/company-logo_100_100/0/1630621036154/microsoft_partner_network_logo?e=179504640..."
}
},
"status": "unknown",
"started_at": null,
"ended_at": null,
"title": "Make each Microsoft 365 Business Premium opportunity a security conversation",
"body": "Every Microsoft 365 Business Premium opportunity can open a broader security conversation.\n\nIn his latest blog, Diego Be…",
"cta_text": null,
"landing_url": null,
"format": "image",
"media": {
"thumbnail_url": null,
"video_url": null,
"audio_url": null,
"image_urls": [
"https://media.licdn.com/dms/image/v2/D4E10AQHgdQBe1y_lsQ/image-shrink_1280/B4EaF.aXC_HwAc-/0/1793122202032?e=2147483647&v=beta&t=lILQREka0rK8ccXqihFXhxDtktZk..."
],
"width": null,
"height": null
},
"regions": null,
"publisher_platforms": null,
"impressions": null,
"spend": null,
"extra": {
"ad_type": "Single Image Ad",
"body_truncated": true,
"creative_type": "SPONSORED_STATUS_UPDATE",
"label": "Promoted"
}
},
{
"object": "ad",
"platform": "linkedin",
"id": "1662299216",
"url": "https://www.linkedin.com/ad-library/detail/1662299216",
"advertiser": {
"object": "advertiser",
"platform": "linkedin",
"id": null,
"name": "Microsoft Azure",
"url": null,
"page_id": null,
"country": null,
"verified": null,
"ad_count": null,
"extra": {
"logo_url": "https://media.licdn.com/dms/image/v2/D560BAQGtwKUNwBubxg/company-logo_100_100/company-logo_100_100/0/1688144190823/microsoft_azure_logo?e=1795046400&v=beta&t..."
}
},
"status": "unknown",
"started_at": null,
"ended_at": null,
"title": "Empiece su prueba de Azure",
"body": "Conecte dispositivos y datos de forma segura por defecto para que pueda enfocarse en desarrollar, no en defender.",
"cta_text": null,
"landing_url": null,
"format": "video",
"media": {
"thumbnail_url": "https://media.licdn.com/dms/image/v2/D5610AQFGHVj1oGbpFA/videocover-high/B56aF_6GPSIsBI-/0/1793147300503?e=2147483647&v=beta&t=724fZOEjF0sGUm5ArcqSVNjyy4UPDV...",
"video_url": null,
"audio_url": null,
"image_urls": null,
"width": null,
"height": null
},
"regions": null,
"publisher_platforms": null,
"impressions": null,
"spend": null,
"extra": {
"ad_type": "Video Ad",
"creative_type": "SPONSORED_VIDEO",
"label": "Promoted"
}
}
],
"cursor": "eyJrIjoibGlhZHMiLCJ0IjoiMTY2MjEwODk1Ni0xNzkzMTMzODIzOTk4In0",
"has_more": true,
"parent": null
},
"cursor": "eyJrIjoibGlhZHMiLCJ0IjoiMTY2MjEwODk1Ni0xNzkzMTMzODIzOTk4In0",
"has_more": true
}Fields
A page of results. Each entry in items is a Ad. cursor and has_more page through the rest.
A field the platform does not give is null, never made up. Extra platform details are in extra.
| Field | Type | Always | Notes |
|---|---|---|---|
object | "ad" | ||
platform | Platform | yes | the ad library's platform |
id | string | yes | |
url | string or null | ||
advertiser | Advertiser or null | ||
status | "active" or "inactive" or "unknown" | ||
started_at | string (ISO 8601 date-time) or null | ||
ended_at | string (ISO 8601 date-time) or null | ||
title | string or null | ||
body | string or null | ||
cta_text | string or null | ||
landing_url | string or null | ||
format | string or null | "image" | "video" | "carousel" | "text" | platform-specific | |
media | Media |
Show the other 5 fields
Full field list in the reference for this endpoint and the data models. Errors are listed under Errors.
Questions
Which errors can it return?
invalid_params (do not retry), not_found (do not retry), upstream_blocked (retry). Account and platform errors from the errors list can also happen. A failure always costs 0 credits.
How do I get more than one page?
Send the same request with cursor set to the cursor you received, until has_more is false. Each page costs its own price. See pagination.
Is there an SDK call for it?
The preview Python client has client.linkedin.ad_library_search(...) and the TypeScript client client.linkedin.adLibrarySearch(). Both return the same envelope as the HTTP API. The packages are not published yet; plain HTTP works today in any language.
Can an AI agent call it?
Yes. The MCP server reaches every built endpoint, with the same prices.