# Search the public Ad Library

Searches the public Ad Library. Works with Meta Ads and LinkedIn Ads.

```http
GET https://api.pozy.ai/v1/ads/library
```

- Area: Ads / Ad Library
- Auth: Authorization: Bearer pz_live_...

## Query parameters

- `platform` (string): one of meta, linkedin
- `accountId` (string)
- `q` (string)
- `pageIds` (string)
- `advertiser` (string)
- `countries` (string)
- `adType` (string): one of ALL, POLITICAL_AND_ISSUE_ADS, HOUSING_ADS, EMPLOYMENT_ADS, FINANCIAL_PRODUCTS_AND_SERVICES_ADS
- `status` (string): one of ACTIVE, INACTIVE, ALL
- `platforms` (string)
- `mediaType` (string): one of ALL, IMAGE, MEME, VIDEO, NONE
- `languages` (string)
- `since` (string (date))
- `until` (string (date))
- `searchType` (string): one of KEYWORD_UNORDERED, KEYWORD_EXACT_PHRASE
- `fields` (string)
- `limit` (integer)
- `after` (string)

## Example request

```bash
curl -X GET "https://api.pozy.ai/v1/ads/library?limit=25" \
  -H "Authorization: Bearer $POZY_API_KEY"
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/library?limit=25", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.get(
    "https://api.pozy.ai/v1/ads/library",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={
        "limit": 25,
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `platform`, string, required: One of `meta`, `linkedin`
- `data`, array of object, required
- `paging`, object, required
  - `after`, string: Can be null
  - `total`, integer

```json
{
  "platform": "meta",
  "data": [
    {}
  ],
  "paging": {
    "after": "string",
    "total": 42
  }
}
```
