- Cost
- 1 credit
- Cached repeats
- 0 creditssend max_age_days, results kept 30 days
- Failed requests
- 0 credits
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.
Part of the LinkedIn Scraper API: 8 LinkedIn endpoints on one key.
Request
Send your key in the x-api-key header.
1curl -G "https://api.socialscrape.dev/v1/linkedin/ad-library/search" \2 -H "x-api-key: $SOCIALSCRAPE_API_KEY" \3 --data-urlencode 'company=Microsoft'1import os2import requests34params = {5 "company": "Microsoft",6}7res = requests.get(8 "https://api.socialscrape.dev/v1/linkedin/ad-library/search",9 headers={"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]},10 params=params,11 timeout=60,12)13body = res.json()1415if body["ok"]:16 print(body["data"])17else:18 print(body["error"]["code"], body["error"]["message"])1const url = new URL("https://api.socialscrape.dev/v1/linkedin/ad-library/search");2url.search = new URLSearchParams({3 company: "Microsoft",4}).toString();5const res = await fetch(url, {6 headers: { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! },7});8const body = await res.json();910if (body.ok) {11 console.log(body.data);12} else {13 console.error(body.error.code, body.error.message);14}1{2 "nodes": [3 {4 "name": "SocialScrape LinkedIn Ad Library search",5 "type": "n8n-nodes-base.httpRequest",6 "typeVersion": 4.2,7 "position": [8 0,9 010 ],11 "parameters": {12 "method": "GET",13 "url": "https://api.socialscrape.dev/v1/linkedin/ad-library/search",14 "sendQuery": true,15 "queryParameters": {16 "parameters": [17 {18 "name": "company",19 "value": "Microsoft"20 }21 ]22 },23 "sendHeaders": true,24 "headerParameters": {25 "parameters": [26 {27 "name": "x-api-key",28 "value": "={{ $env.SOCIALSCRAPE_API_KEY }}"29 }30 ]31 }32 }33 }34 ],35 "connections": {}36}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 examples, not your data.
1{2 "ok": true,3 "credits_charged": 1,4 "credits_remaining": 4999,5 "cached": false,6 "cached_at": null,7 "request_id": "req_f73f6d8a73de5b3aee83485a",8 "data": {9 "object": "list",10 "items": [11 {12 "object": "ad",13 "platform": "linkedin",14 "id": "1662766106",15 "url": "https://www.linkedin.com/ad-library/detail/1662766106",16 "advertiser": {17 "object": "advertiser",18 "platform": "linkedin",19 "id": null,20 "name": "Microsoft AI Cloud Partner Program",21 "url": null,22 "page_id": null,23 "country": null,24 "verified": null,25 "ad_count": null,26 "extra": {27 "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..."28 }29 },30 "status": "unknown",31 "started_at": null,32 "ended_at": null,33 "title": "Make each Microsoft 365 Business Premium opportunity a security conversation",34 "body": "Every Microsoft 365 Business Premium opportunity can open a broader security conversation.\n\nIn his latest blog, Diego Be…",35 "cta_text": null,36 "landing_url": null,37 "format": "image",38 "media": {39 "thumbnail_url": null,40 "video_url": null,41 "audio_url": null,42 "image_urls": [43 "https://media.licdn.com/dms/image/v2/D4E10AQHgdQBe1y_lsQ/image-shrink_1280/B4EaF.aXC_HwAc-/0/1793122202032?e=2147483647&v=beta&t=lILQREka0rK8ccXqihFXhxDtktZk..."44 ],45 "width": null,46 "height": null47 },48 "regions": null,49 "publisher_platforms": null,50 "impressions": null,51 "spend": null,52 "extra": {53 "ad_type": "Single Image Ad",54 "body_truncated": true,55 "creative_type": "SPONSORED_STATUS_UPDATE",56 "label": "Promoted"57 }58 },59 {60 "object": "ad",61 "platform": "linkedin",62 "id": "1662299216",63 "url": "https://www.linkedin.com/ad-library/detail/1662299216",64 "advertiser": {65 "object": "advertiser",66 "platform": "linkedin",67 "id": null,68 "name": "Microsoft Azure",69 "url": null,70 "page_id": null,71 "country": null,72 "verified": null,73 "ad_count": null,74 "extra": {75 "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..."76 }77 },78 "status": "unknown",79 "started_at": null,80 "ended_at": null,81 "title": "Empiece su prueba de Azure",82 "body": "Conecte dispositivos y datos de forma segura por defecto para que pueda enfocarse en desarrollar, no en defender.",83 "cta_text": null,84 "landing_url": null,85 "format": "video",86 "media": {87 "thumbnail_url": "https://media.licdn.com/dms/image/v2/D5610AQFGHVj1oGbpFA/videocover-high/B56aF_6GPSIsBI-/0/1793147300503?e=2147483647&v=beta&t=724fZOEjF0sGUm5ArcqSVNjyy4UPDV...",88 "video_url": null,89 "audio_url": null,90 "image_urls": null,91 "width": null,92 "height": null93 },94 "regions": null,95 "publisher_platforms": null,96 "impressions": null,97 "spend": null,98 "extra": {99 "ad_type": "Video Ad",100 "creative_type": "SPONSORED_VIDEO",101 "label": "Promoted"102 }103 }104 ],105 "cursor": "eyJrIjoibGlhZHMiLCJ0IjoiMTY2MjEwODk1Ni0xNzkzMTMzODIzOTk4In0",106 "has_more": true,107 "parent": null108 },109 "cursor": "eyJrIjoibGlhZHMiLCJ0IjoiMTY2MjEwODk1Ni0xNzkzMTMzODIzOTk4In0",110 "has_more": true111}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 Python client has client.linkedin.ad_library_search(...) and the TypeScript client client.linkedin.adLibrarySearch(). Both return the same envelope as the HTTP API. Install them from PyPI (socialscrape-sdk) or npm (socialscrape); plain HTTP works in any language.
Can an AI agent call it?
Yes. The MCP server, which you run on your own machine, reaches every built endpoint, with the same prices.