LinkedIn ad details API
One ad from LinkedIn’s Ad Library: format, advertiser, who paid, run dates, total impressions and impressions by country, targeting, and the creative’s text, headline, link and images.
GET /v1/linkedin/ads/{ad}Beta5 credits per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/linkedin/ads/1695641666",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 5 credits{ "ad_id": "1695641666", "url": "https://www.linkedin.com/ad-library/detail/1695641666", "creative_type": "SPONSORED_STATUS_UPDATE", "format": "Single Image Ad", "advertiser": { "name": "Microsoft", "url": "https://www.linkedin.com/company/1035", "company_id": "1035" }, "paid_by": "Test Company", "ran_from": null, "ran_to": null, "run_text": null, "commentary": "Want to explore what's new from #MSIgnite? 🔎 Discover the latest announcements and how to put them into action. 👉 Micros…", "headline": "A vibrant event entrance featuring the text 'Microsoft Ignite | Frontier unlocked.' Colorful abstract lines in green, re…", "destination_url": null, "cta": null, "image_urls": [ "https://media.licdn.com/dms/image/v2/D4E10AQGtdcbCDNpRSA/image-shrink_1280/B4EaH1Te92JUAY-/0/1795116888255?e=2147483647&…" ], "video_url": null, "total_impressions": null, "impressions_by_country": [], "targeting": [], "targeting_parameters": []}Parameters
| Name | Type | Description |
|---|---|---|
adpath · required | string | The ad id or its URL (linkedin.com/ad-library/detail/<id>). Example: 1695641666. |
Response fields
200 with a LinkedInAd, in LinkedIn’s own schema.org JSON-LD, with the rest of the public page beside it.
| Field | Type | Description |
|---|---|---|
ad_id | string | |
url | string | |
creative_type | string | null | |
format | string | null | |
advertiser | object | |
paid_by | string | null | |
ran_from | string | null | YYYY-MM-DD. |
ran_to | string | null | YYYY-MM-DD; null while it is still running. |
run_text | string | null | |
commentary | string | null | |
headline | string | null | |
destination_url | string | null | |
cta | string | null | |
image_urls | string[] | |
video_url | string | null | |
total_impressions | string | null | A range, e.g. "5k-10k". |
impressions_by_country | object[] | |
targeting | object[] | |
targeting_parameters | object[] |
Status codes
| Status | Meaning |
|---|---|
200 | The ad. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | LinkedIn has no such public page, or it was removed. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | LinkedIn is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
What if the ad does not exist?
A missing, removed or hidden page answers an error (404 target_not_found, or 503 upstream_unavailable when LinkedIn turned every visit away) and is never charged.
LinkedIn is a trademark of LinkedIn Corporation. We are not affiliated with or endorsed by LinkedIn.