LinkedIn Ad Library search API
Search the LinkedIn Ad Library by company name, company id or keyword (give at least one).
GET /v1/linkedin/ad-library/search
GET /v1/linkedin/ad-library/search
Search the LinkedIn Ad Library by company name, company id or keyword (give at least one). 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.
- Cost: 1 credit
- Cache: Results are kept up to 30 days; send
max_age_daysto reuse them for free. - Timeout: A request still running after about 25 seconds answers
202with a job to poll (Batch and jobs).
Parameters#
| Name | Type | Required | Description |
|---|---|---|---|
query | string | no | Keyword to search for. Also accepted as keyword, q. |
company | string | no | Advertiser name. Also accepted as company_name. |
company_id | string | no | LinkedIn company id: the number in linkedin.com/company/<id>. Also accepted as companyId. |
countries | string | no | Comma-separated 2-letter countries, "US,CA,MX". |
start_date | string | no | Start date, YYYY-MM-DD. Use with end_date. Also accepted as startDate. |
end_date | string | no | End date, YYYY-MM-DD. Use with start_date. Also accepted as endDate. |
Every request also accepts:
cursor: the cursor from the previous page (Pagination).region: two-letter country code for results that vary by country. Changing it restarts the cursor chain.trim:truefor a smaller response withoutnullfields andextra.raw:trueto also get the platform's original object asraw.max_age_days: accept a cached result up to this many days old, for 0 credits (Caching).
Example request#
Set your key in the environment first (see Authentication).
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)12body = res.json()1314if body["ok"]:15 print(body["data"])16else:17 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}Example response#
This is a sample from a recorded response, lists and long text are shortened. Status 200.
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=1795046400&v=beta&t=SZBQn5t9_QMwvmN6bHjuAqWODWScDbTgy1J1v1_PLgA"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=lILQREka0rK8ccXqihFXhxDtktZkTKoOFyYN2S_LEl8"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=_rNRowQC_y_BHpJH7uH1CjZrO0UtOSxkPzd1kMiZhHg"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=724fZOEjF0sGUm5ArcqSVNjyy4UPDVdf9sUy_Bge-ko",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}Response#
A list of Ad objects in data.items, with data.cursor and data.has_more.
See Data models for every field. The envelope around data is described in Responses.
Errors#
Failures are free: credits_charged is 0. Branch on error.code, never on the message.
| Code | HTTP | Retry | Meaning |
|---|---|---|---|
invalid_params | 400 | no | A parameter is missing, unknown or has the wrong type. |
not_found | 404 | no | The platform says this profile, post or item does not exist. |
upstream_blocked | 503 | yes | The platform blocked this fetch; retry (a fresh exit is used). |
Every request can also fail with the account and platform errors listed on the Errors page.
Example error:
1{2 "ok": false,3 "error": {4 "code": "upstream_blocked",5 "message": "The platform blocked this fetch; retry (a fresh exit is used).",6 "retryable": true7 },8 "credits_charged": 0,9 "request_id": "req_609f66ee93c7eb077915dc40"10}Also served at#
These paths answer the same request, so code written for other APIs keeps working: /v1/linkedin/ads/search. See Switching from ScrapeCreators.
Related endpoints#
- LinkedIn Ad Library ad details (
GET /v1/linkedin/ad-library/ad) - LinkedIn public person profile (
GET /v1/linkedin/profile) - LinkedIn company page (
GET /v1/linkedin/company) - LinkedIn company posts (
GET /v1/linkedin/company/posts) - LinkedIn post search (
GET /v1/linkedin/search/posts) - LinkedIn public post (
GET /v1/linkedin/post) - LinkedIn post video transcript (
GET /v1/linkedin/post/transcript)