---
title: "Ads"
description: "搜索 LinkedIn 广告资料库，或列出某家公司投放的全部广告。"
---

> Every apinoa docs page as markdown: https://apinoa.com/llms.txt (all in one file: https://apinoa.com/llms-full.txt; this API family in one file: https://apinoa.com/docs/ads/llms.txt)

```http
GET | POST /v1/linkedin-ads/ads
```

参数可以用 `GET` 的查询字符串发送，也可以用 `POST` 的 JSON 请求体发送，两者等价。

## 请求

```bash tab="cURL"
curl "https://gateway.apinoa.com/v1/linkedin-ads/ads?advertiser=1035" \
  -H "x-api-key: $APINOA_API_KEY"
```

```js tab="JavaScript"
const params = new URLSearchParams({ advertiser: "1035" });
const res = await fetch(`https://gateway.apinoa.com/v1/linkedin-ads/ads?${params}`, {
  headers: { "x-api-key": process.env.APINOA_API_KEY },
});
const { success, data, error } = await res.json();
```

```python tab="Python"
import os

import requests

res = requests.get(
    "https://gateway.apinoa.com/v1/linkedin-ads/ads",
    params={"advertiser": "1035"},
    headers={"x-api-key": os.environ["APINOA_API_KEY"]},
)
body = res.json()
```

## 传入内容

| 传入 | 读取内容 | 说明 |
|---|---|---|
| `query` | 匹配关键词的广告 |  |
| `advertiser` | 某家公司投放的全部广告 | 数字 LinkedIn 公司 id（广告的 `advertiser.id`） |
| `company` | 某家公司投放的全部广告 | 公司标识名（`microsoft`）、公司 URL 或数字公司 id |
| `advertiserName` | 名称匹配的广告主的广告 | LinkedIn 对名称做宽松匹配：`Microsoft` 也会找到 `Microsoft Azure` 和合作伙伴。只看一家公司请用 `advertiser` 或 `company` |
| `payer` | 由该付款方出资的广告 | 名称与广告 `paidBy` 中所写一致 |

传入其中一个。筛选条件可与任意一个搭配：`country`（ISO 3166-1 alpha-2 代码，逗号分隔）、`dateOption`（`last-30-days`、`current-month`、`current-year`、`last-year`）或 `startDate` 加 `endDate`（YYYY-MM-DD），以及 `sort`（默认 `newest`，或 `oldest`）。筛选条件会随 `cursor` 带到后续页面。

## 参数

| Parameter | Type | Required | Notes |
|---|---|---|---|
| `advertiser` | string |  | Every ad one company runs, by its numeric LinkedIn company id (an ad's `advertiser.id`). |
| `advertiserName` | string |  | Ads from advertisers whose name matches this one (LinkedIn matches loosely: "Microsoft" also finds "Microsoft Azure"). For one company exactly, use `advertiser` or `company`. |
| `company` | string |  | Every ad one company runs: its vanity name (e.g. microsoft), its company URL, or its numeric LinkedIn company id. |
| `country` | string list |  | Only ads shown in these countries: ISO 3166-1 alpha-2 codes, comma-separated (e.g. DE,FR). Default: every country. |
| `cursor` | string |  | Opaque cursor from the previous page's `cursor`. Pass it alone for the next page. |
| `dateOption` | enum |  | Only ads shown in this window: last-30-days, current-month, current-year or last-year. Default: the last twelve months. `last-30-days` `current-month` `current-year` `last-year` |
| `endDate` | string |  | With startDate: only ads shown up to this day (YYYY-MM-DD). |
| `payer` | string |  | Ads paid for by this payer, as an ad's `paidBy` names it. |
| `query` | string |  | Keywords to search the Ad Library for. |
| `sort` | enum |  | newest first (default) or oldest first. `newest` `oldest` |
| `startDate` | string |  | With endDate: only ads shown from this day (YYYY-MM-DD), at most twelve months back. |

The same parameters, and every response type, are in the OpenAPI document: https://apinoa.com/openapi.json

## 响应

在 `data` 中返回 [`AdPage`](/docs/api-reference/ads/response-schema#adpage)。以下为真实响应的节选：数组只保留前几项，长文本已截断。

```json
{
  "success": true,
  "data": {
    "library": "linkedin-ads",
    "items": [
      {
        "library": "linkedin-ads",
        "id": "1698885096",
        "url": "https://www.linkedin.com/ad-library/detail/1698885096",
        "advertiser": {
          "name": "Microsoft",
          "avatarUrl": "https://media.licdn.com/dms/image/v2/D560BAQH32RJQCl3dDQ/company-logo_…"
        },
        "format": "Carousel Ad",
        "text": "Explore the latest developments across AI, cloud and security from Mic…",
        "images": [],
        "videos": [],
        "cards": [
          {
            "title": "See what’s next for your organisation",
            "image": {
              "url": "https://media.licdn.com/dms/image/v2/D5610AQFlopy4Rm-itQ/image-shrink_…"
            }
          }
        ],
        "ext": {
          "creativeType": "SPONSORED_UPDATE_CAROUSEL",
          "textTruncated": true
        }
      }
    ],
    "cursor": "5wraO2u_AhBuSF7ObPceqP2vGsnCEsdUSPpXXSrhyVVGTCnfWXD1ZI1B3AgdnJwqF2b8jv…",
    "total": 11538
  }
}
```

## 错误

| 状态 | 代码 | 含义 |
|---|---|---|
| 400 | `INVALID_CURSOR` | 该 `cursor` 不是本操作返回的。请不带它重新开始。 |
| 400 | `INVALID_PARAMS` | 参数缺失、未知或超出范围。消息中会指出是哪一个。 |
| 401 | `UNAUTHORIZED` | 缺少 `x-api-key` 请求头，或密钥已吊销或未知。 |
| 402 | `INSUFFICIENT_CREDITS` | 积分不足以支付本次调用。请在控制台选择套餐或充值。 |
| 404 | `NOT_FOUND` | LinkedIn 上不存在该公司。 |
| 429 | `MARKETPLACE_SATURATED` | 并发调用过多。请等待 `Retry-After` 秒后重试。 |
| 502 | `UPSTREAM_ERROR` | 广告资料库返回了无法使用的内容。请退避后重试。 |

所有代码见 [Errors](/docs/errors)。失败的调用不计费。

## 价格

**Price** 1 credit per call. [Plans and credits](https://apinoa.com/en/pricing).

## 说明

- 所有记录遵循统一的 [Ads API 数据结构](/docs/api-reference/ads/response-schema)。只有 LinkedIn 提供的信息在 `ext` 中：`creativeType`（LinkedIn 自己的格式代码）、`textTruncated`、`poster`、`document`、`event`、`message`、`links` 和 `targeting`。
- 每页最多 24 条广告。`total` 是匹配的广告数，与广告资料库所示一致，随第一页返回。
- 搜索结果中的广告文本是 LinkedIn 缩短后的预览（`ext.textTruncated: true`），另有素材图片和视频封面。[`ad`](/docs/api-reference/linkedin-ads/ad) 返回完整广告：完整文本、视频文件、行动号召、链接、出资方，以及 LinkedIn 公开时的投放日期、展示次数和定向。
- 广告资料库涵盖最近十二个月。更早的 `startDate` 会被拒绝。
- `company` 无论是名称、URL 还是 id 都计 1 个单位，之后每一页也都是 1 个单位。
- 要获取下一页，只传 `cursor`。
