> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stophy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# LinkedIn ads

> Read a LinkedIn Ad Library search page with a keyword or accountOwner as JSON with the linkedin-ads parser. $1 per 1,000 calls.

Reads a LinkedIn Ad Library search page with a keyword or accountOwner, or an ad page or lnkd.in share link, and returns its data as JSON.

## Make a request

Send the page's URL to [scrape](https://docs.stophy.dev/api-reference/endpoint/scrape.md) with a `json` format that names the parser. Get an API key in the [Quickstart](https://docs.stophy.dev/quickstart).

```bash cURL theme={null}
curl -X POST https://api.stophy.dev/v1/scrape \
  -H "Authorization: Bearer $STOPHY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.linkedin.com/ad-library/search?keyword=software&countries=DE","formats":[{"type":"json","parser":"linkedin-ads"}]}'
```

```typescript TypeScript theme={null}
const response = await fetch("https://api.stophy.dev/v1/scrape", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.STOPHY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://www.linkedin.com/ad-library/search?keyword=software&countries=DE",
    formats: [{ type: "json", parser: "linkedin-ads" }],
  }),
});
console.log(await response.json());
```

```python Python theme={null}
import os

import requests

response = requests.post(
    "https://api.stophy.dev/v1/scrape",
    headers={"Authorization": f"Bearer {os.environ['STOPHY_API_KEY']}"},
    json={
        "url": "https://www.linkedin.com/ad-library/search?keyword=software&countries=DE",
        "formats": [{"type": "json", "parser": "linkedin-ads"}],
    },
)
print(response.json())
```

## Read the response

The parser's data is in `data.json`. Its fields include `adId`, `adUrl`, `creativeType`, `format`, `advertiserName` and `advertiserUrl`. This sample is cut to the first items.

```json theme={null}
{
  "success": true,
  "data": {
    "json": {
      "results": [
        {
          "adId": "1624678994",
          "adUrl": "https://www.linkedin.com/ad-library/detail/1624678994",
          "creativeType": "SPONSORED_STATUS_UPDATE",
          "format": "Single Image Ad",
          "advertiserName": "Torii",
          "advertiserUrl": null,
          "advertiserAvatarUrl": "https://media.licdn.com/dms/image/v2/D4E0BAQGF3JEvj2zgcA/company-logo_100_100/B4EZ9IPSWCJYAI-/0/1783623394930/toriihq_l…",
          "postedBy": null,
          "text": "Torii shows you every SaaS and AI app in the estate, who has access to each one, and what it actually costs. Most…",
          "headline": "You cannot optimize software you cannot see.",
          "imageUrls": [
            "https://media.licdn.com/dms/image/v2/D4E10AQG2Y8yC_MDg-Q/image-shrink_1280/B4EaGeSmFVIgAg-/0/1793657037813/torii-discov…"
          ]
        }
      ],
      "total": 148790,
      "cursor": "1624832654-1793655819560"
    }
  }
}
```

## Options

Send options in the `options` object of the `json` format.

| Option | What it does |
| - | - |
| `within` | Only ads shown in the last 30 days or the last year. |
| `cursor` | The cursor from the previous response. Send it as is. |

It also takes `advertiser`.

## Price

\$1 per 1,000 calls. See [Pricing](https://docs.stophy.dev/account/pricing.md).

## Limits and errors

* The URL must be a LinkedIn Ad Library search page with a keyword or accountOwner, or an ad page or lnkd.in share link. Any other URL fails with `invalidRequest`.
* To read the next page, send the `cursor` from the response as the `cursor` option. Paging needs an API key.
* The answer comes back in `data.json`. If the page cannot be read, the call fails with an error code from [Errors](https://docs.stophy.dev/api-reference/errors.md).

## Related

* [Pre-built parsers](https://docs.stophy.dev/scrape/prebuilt-parsers) lists every parser.
* [Scrape](https://docs.stophy.dev/scrape/overview) has the options every scrape takes.
* [LinkedIn company](https://docs.stophy.dev/scrape/prebuilt-parsers/social/linkedin-company.md)
* [LinkedIn profile](https://docs.stophy.dev/scrape/prebuilt-parsers/social/linkedin-profile.md)
* [LinkedIn posts](https://docs.stophy.dev/scrape/prebuilt-parsers/social/linkedin-posts.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.