---
title: "Ads"
description: "搜索 Meta 广告资料库，或列出某个广告主在 Facebook、Instagram、Messenger 和 Audience Network 上投放的全部广告。"
---

> 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/meta-ads/ads
```

参数可以用 `GET` 的查询字符串发送，也可以用 `POST` 的 JSON 正文发送，两者等效。

## 请求

```bash tab="cURL"
curl "https://gateway.apinoa.com/v1/meta-ads/ads?advertiser=15087023444&status=all" \
  -H "x-api-key: $APINOA_API_KEY"
```

```js tab="JavaScript"
const params = new URLSearchParams({ advertiser: "15087023444", status: "all" });
const res = await fetch(`https://gateway.apinoa.com/v1/meta-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/meta-ads/ads",
    params={"advertiser": "15087023444", "status": "all"},
    headers={"x-api-key": os.environ["APINOA_API_KEY"]},
)
body = res.json()
```

## 传入内容

| 传入 | 读取内容 | 说明 |
|---|---|---|
| `query` | 匹配关键词的广告 | `exact` 只匹配完整短语 |
| `advertiser` | 某个广告主投放的全部广告 | 广告主的 `id`，来自 [`advertisers`](/docs/api-reference/meta-ads/advertisers) 或广告的 `advertiser.id` |
| `query` + `advertiser` | 匹配关键词、且仅限这些广告主的广告 | 最多 10 个 id，用逗号分隔 |

传入 `query`、`advertiser` 或两者。筛选条件（`country`、`status`、`adType`、`mediaType`、`platforms`、`languages`、`startDate`、`endDate`、`sort`）都可搭配使用。

## 参数

| Parameter | Type | Required | Notes |
|---|---|---|---|
| `adType` | enum |  | all (default), or one special category: political (social issues, elections or politics), housing, employment, credit. `all` `political` `housing` `employment` `credit` |
| `advertiser` | string list |  | The advertiser's id, as `advertisers` returns it (or an ad's `advertiser.id`): every ad it runs. With `query`, up to 10 ids, comma-separated, narrow the keyword search to those advertisers. |
| `country` | string |  | Where the ads ran: an ISO 3166-1 alpha-2 code, or ALL (default). |
| `cursor` | string |  | Opaque cursor from the previous page's `cursor`. Pass it alone for the next page. |
| `endDate` | string |  | Only ads that started running on or before this day (YYYY-MM-DD). |
| `exact` | boolean |  | query: match the exact phrase instead of any of its words. |
| `languages` | string list |  | Only ads in these languages (ISO 639-1). |
| `mediaType` | enum |  | all (default), image, video, meme, image_and_meme, none. `all` `image` `video` `meme` `image_and_meme` `none` |
| `platforms` | string list |  | Only ads that ran on these platforms. |
| `query` | string |  | Keywords to search the Ad Library for. |
| `sort` | enum |  | relevance (default), or impressions (highest first; Facebook states impressions for political ads). `relevance` `impressions` |
| `startDate` | string |  | Only ads that started running on or after this day (YYYY-MM-DD). |
| `status` | enum |  | active (default), inactive or all. `active` `inactive` `all` |

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": "meta-ads",
    "items": [
      {
        "library": "meta-ads",
        "id": "1702938977100376",
        "url": "https://www.facebook.com/ads/library/?id=1702938977100376",
        "advertiser": {
          "id": "15087023444",
          "name": "Nike",
          "url": "https://www.facebook.com/nike/",
          "avatarUrl": "https://scontent-bos5-1.xx.fbcdn.net/v/t39.35426-6/431756959_71287105437…",
          "ext": {
            "likes": 39488420,
            "categories": [
              "Sportswear",
              "Product/service"
            ]
          }
        },
        "format": "DPA",
        "title": "{{product.name}}",
        "text": "Bring sports more fully into your day with the Nike App.",
        "linkUrl": "http://itunes.apple.com/app/id1095459556",
        "ctaText": "Install now",
        "images": [],
        "videos": [],
        "cards": [
          {
            "title": "Nike Run Swift 3 Women's Road Running Shoes",
            "text": "Bring sports more fully into your day with the Nike App.",
            "linkUrl": "https://www.nike.com/ph/t/run-swift-3-road-running-shoes-2fHbzp/DR2698-0…",
            "ctaText": "Install Now",
            "image": {
              "url": "https://scontent-bos5-1.xx.fbcdn.net/v/t39.35426-6/431679131_94921416663…",
              "ext": {
                "resizedUrl": "https://scontent-bos5-1.xx.fbcdn.net/v/t39.35426-6/431679131_94921416663…"
              }
            },
            "ext": {
              "caption": "itunes.apple.com",
              "linkDescription": "₱3,995",
              "ctaType": "INSTALL_MOBILE_APP"
            }
          },
          {
            "title": "Nike Invincible 3 Women's Road Running Shoes",
            "text": "Bring sports more fully into your day with the Nike App.",
            "linkUrl": "https://www.nike.com/ph/t/invincible-3-road-running-shoes-LL61DX/DR2660-…",
            "ctaText": "Install Now",
            "image": {
              "url": "https://scontent-bos5-1.xx.fbcdn.net/v/t39.35426-6/431631323_92872743202…",
              "ext": {
                "resizedUrl": "https://scontent-bos5-1.xx.fbcdn.net/v/t39.35426-6/431631323_92872743202…"
              }
            },
            "ext": {
              "caption": "itunes.apple.com",
              "linkDescription": "₱9,895",
              "ctaType": "INSTALL_MOBILE_APP"
            }
          }
        ],
        "firstShownAt": "2025-04-07T07:00:00.000Z",
        "lastShownAt": "2026-11-07T08:00:00.000Z",
        "ext": {
          "active": true,
          "platforms": [
            "facebook",
            "instagram"
          ],
          "caption": "itunes.apple.com",
          "ctaType": "INSTALL_MOBILE_APP",
          "has_user_reported": false,
          "gated_type": "ELIGIBLE",
          "is_aaa_eligible": false,
          "regional_regulation_data": {
            "finserv": {
              "is_deemed_finserv": false,
              "is_limited_delivery": false
            },
            "tw_anti_scam": {
              "is_limited_delivery": false
            }
          },
          "hide_data_status": "NONE",
          "snapshot": {
            "is_reshared": false
          }
        }
      }
    ],
    "cursor": "FBe_2wsngLShai3Nb8Z3btwLqnQCPM5mfHmg_xoJDSWCYQpot_7Bie7WzcRR96xHrpnClTN0…",
    "total": 15646,
    "ext": {
      "searchType": "page",
      "countries": [
        "ALL"
      ],
      "status": "all",
      "adType": "all",
      "mediaType": "all",
      "advertiser": "15087023444"
    }
  }
}
```

## 错误

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

全部错误代码见 [Errors](/docs/errors)。失败的调用不计费。

## 价格

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

## 说明

- `total` 是匹配的广告数，与广告资料库所示完全一致。超过 50,000 时它只说明不少于该数，此时返回 `totalRange`（`{"lower": 50000}`）。
- 社会议题、选举或政治类广告（`adType=political`）还带有以范围（`{text, lower, upper}`）表示的 `spend`、`impressions`、`reach`，以及 `currency` 和出资方（`paidBy`）。
- `country` 是一个 ISO 3166-1 alpha-2 代码，或 `ALL`（默认）。`startDate` 和 `endDate` 限定广告开始投放的日期。
- 每条广告的 `ext` 包含只有 Meta 给出的信息：`active`、`platforms`（投放位置）、`adId`、`activeSeconds`、创意的 `caption`、`linkDescription` 和 `ctaType`、出资方披露的其余部分（`disclaimer`：标签、Meta 核实出资方的方式、联系方式）、`collationId` 和 `collationCount`（Meta 归为同一创意的广告）、`sensitive`，以及广告资料库发送的其他所有字段（保留原名）。广告主的 `ext` 含 `likes`、`categories`、广告投放时使用的名称（`nameInAd`）和 `deleted`；图片和视频在各自的 `ext` 中保留 Meta 的其他副本（`resizedUrl`、`watermarkedUrl`、`sdUrl` 等）。
- 响应的 `ext` 是广告资料库实际应用的搜索条件。
- 要获取下一页，只传 `cursor`。
