LinkedIn Ad Library search API
  1. Docs
  2. LinkedIn
  3. LinkedIn Ad Library search API

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_days to reuse them for free.
  • Timeout: A request still running after about 25 seconds answers 202 with a job to poll (Batch and jobs).

Parameters#

NameTypeRequiredDescription
querystringnoKeyword to search for. Also accepted as keyword, q.
companystringnoAdvertiser name. Also accepted as company_name.
company_idstringnoLinkedIn company id: the number in linkedin.com/company/<id>. Also accepted as companyId.
countriesstringnoComma-separated 2-letter countries, "US,CA,MX".
start_datestringnoStart date, YYYY-MM-DD. Use with end_date. Also accepted as startDate.
end_datestringnoEnd 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: true for a smaller response without null fields and extra.
  • raw: true to also get the platform's original object as raw.
  • 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"

Example response#

This is a sample from a recorded response, lists and long text are shortened. Status 200.

200 OKSample response
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.

CodeHTTPRetryMeaning
invalid_params400noA parameter is missing, unknown or has the wrong type.
not_found404noThe platform says this profile, post or item does not exist.
upstream_blocked503yesThe 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.