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

# LinkedIn Ads API

> Extract LinkedIn ad details, ad copy, media URL, and call-to-action buttons from Ad Library URLs

`POST /v1/data/linkedin/ads-library/run`

**Pricing:** $0.002 per ad ($2.00 per 1,000).

## Request

Send the inputs under `params`. Only the keys below are accepted; any other key returns `422 invalid_params`.

**urls** `string` *required*

LinkedIn Ad Library URL (or company URL).

Format e.g. `https://www.linkedin.com/ad-library/search?accountowner=nvidia&countries=br&dateoption=last-30-days`.

**maxResults** `integer`

Number of ads to return. Use 0 for all.

## Example

```bash cURL theme={null}
curl -X POST "https://api.mindcase.co/v1/data/linkedin/ads-library/run?wait=true" \
  -H "Authorization: Bearer $MINDCASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "params": {
    "urls": "https://www.linkedin.com/ad-library/search?accountOwner=nvidia&countries=BR&dateOption=last-30-days",
    "maxResults": 10
  }
}'
```

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

r = requests.post(
    "https://api.mindcase.co/v1/data/linkedin/ads-library/run",
    params={"wait": "true"},
    headers={"Authorization": f"Bearer {os.environ['MINDCASE_API_KEY']}"},
    json={"params": {
    "urls": "https://www.linkedin.com/ad-library/search?accountOwner=nvidia&countries=BR&dateOption=last-30-days",
    "maxResults": 10
}},
)
job = r.json()
rows = job.get("data", [])  # if job["status"] == "running", poll /v1/jobs/{job_id}/results
```

```javascript Node.js theme={null}
const r = await fetch("https://api.mindcase.co/v1/data/linkedin/ads-library/run?wait=true", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.MINDCASE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ params: {
  "urls": "https://www.linkedin.com/ad-library/search?accountOwner=nvidia&countries=BR&dateOption=last-30-days",
  "maxResults": 10
} }),
});
const job = await r.json();
const rows = job.data ?? []; // if job.status === "running", poll /v1/jobs/{job_id}/results
```

## Response fields

Each row in `data` is one ad, keyed by these fields.

| Field | Name | Type |
| - | - | - |
| `adUrl` | Ad URL | url |
| `adId` | Ad ID | text |
| `advertiserUrl` | Advertiser URL | url |
| `paidBy` | Paid By | text |
| `format` | Format | text |
| `headline` | Headline | text |
| `body` | Body | text |
| `clickUrl` | Click URL | url |
| `started` | Started | text |
| `ended` | Ended | text |
| `daysActive` | Days Active | number |
| `impressions` | Impressions | text |
| `impressionsByCountry` | Impressions By Country | object\_array |
| `targetingLocation` | Targeting Location | text |
| `mediaUrl` | Media URL | url |
| `mediaType` | Media Type | text |

## Example response

Abridged: long text and lists are shortened.

```json theme={null}
{
  "job_id": "7f3a1c2e-0b9d-4c55-9a51-3f2e8d1b6a40",
  "agent": "linkedin/ads-library",
  "status": "completed",
  "row_count": 1,
  "truncated": false,
  "data": [
    {
      "headline": null,
      "started": null,
      "format": "SINGLE_IMAGE",
      "advertiserUrl": "https://www.linkedin.com/company/40981439",
      "impressionsByCountry": [],
      "paidBy": "NAÇÃO DIGITALSOLUTIONS LTDA",
      "mediaType": "IMAGE",
      "adId": "1442452943",
      "adUrl": "https://www.linkedin.com/ad-library/detail/1442452943",
      "clickUrl": null,
      "impressions": null,
      "body": "Precisa de agentes autônomos capazes de operar com segurança em ambientes corporativos? 🤔 \n\nNeste webinar, você vai conhecer os recursos, frameworks e prátic...",
      "targetingLocation": null,
      "daysActive": null,
      "mediaUrl": "https://media.licdn.com/dms/image/v2/D4D10AQGb4U628WCh4Q/image-shrink_1280/B4DZ8kkZC7JQAc-/0/1783024947646/FEED_PT_290626png?e=2147483647&v=beta&t=wgtotBWwPS...",
      "ended": null
    }
  ]
}
```

## Related APIs

For Meta ads use [`facebook/ads`](https://docs.mindcase.co/apis/facebook/ads); for Google ads use [`google-ads/ads`](https://docs.mindcase.co/apis/google-ads/ads).


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