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

# 推广帖子

> 将 Reddit 社区帖子作为推广帖子推广。Ayrshare 创建广告系列、广告组和广告，并设置广告目标、预算和自定义受众定位。

推广一个现有的 Reddit 帖子。Ayrshare 会在您的 Reddit 广告账户中创建一个活动、一个广告组以及一个推广该帖子的广告。

### 限制

<ul>
  <li>Reddit 广告需按账户单独开通。请联系我们以启用该功能。</li>
  <li>**仅限社区帖子。** 您可以推广社区（subreddit）中的帖子。您个人主页（`r/u_<username>`）上的帖子无法推广，并会返回 `code: 101`。</li>
  <li>**必须提供转化像素。** 无论目标为何，没有转化像素时 Reddit 都不会投放任何广告。请在 `platformOptions.reddit.pixelId` 中发送您的像素 ID，否则推广会返回 `code: 101`。您可以在 Reddit Ads Events Manager 中找到该 ID。</li>
</ul>

<ul>
  <li>关联 Reddit 并授予广告权限（`adsread`、`adsedit`、`adsconversions`）。如果未关联 Reddit，会返回 `code: 156`。如果缺少广告权限，或 Reddit 不再接受该关联，会返回 `code: 420`：请重新关联 Reddit 并授予这些权限。</li>
  <li>预算使用您广告账户的币种。请勿发送 `budget.currency`：发送该参数会返回 `code: 101`。</li>
  <li>预算设置在广告组层级。`budget.level: "campaign"` 会返回 `code: 101`。</li>
  <li>您的广告账户需要一个付款方式。如果没有付款方式，推广会返回 `code: 101`：请在 Reddit Ads 中添加付款方式。如果有多个付款方式，请在 `platformOptions.reddit.fundingInstrumentId` 中指定。</li>
  <li>Reddit 不接受 `callToAction`、`attachTo`、`targeting.excludedLocations`、年龄定向、`targeting.locations.regions` 和 `targeting.locations.cities`。发送这些参数会返回 `code: 101`。</li>
  <li>Reddit 会审核每条新广告。在获得批准之前，广告显示为 `review.status: "PENDING_APPROVAL"`。</li>
  <li>如果 Reddit 未能启用新广告，推广仍会被创建，且响应中会包含 `warning`。通常广告会处于暂停状态（`adStatus: "PAUSED"`），您可以通过[状态更新](https://www.ayrshare.com/docs/apis/ads/reddit/put-ad-update.md)来恢复投放。如果 Reddit 无法确认广告已暂停，响应会显示 `adStatus: "ACTIVE"`，并警告该广告可能正在投放并产生花费。请进行检查，如有需要，请通过状态更新将其暂停。</li>
  <li>如果将状态更新为 `active` 失败，且 Reddit 无法确认广告已重新停止，错误中会包含 `warning`，提示该广告可能正在投放并产生花费，广告会显示 `adStatus: "ACTIVE"`。请进行检查，如有需要，请通过状态更新将其暂停。</li>
  <li>如果您发送请求的速度超过 Reddit 允许的频率，将返回 `code: 364` 和 HTTP 429。`details` 中包含 Reddit 的消息，并在 Reddit 提供时注明距离可重试还需等待的秒数。</li>
  <li>洞察数据中的花费以您广告账户的币种显示。仅当该币种为 USD 时才会设置 `spendUsd`，否则为 `null`。</li>
</ul>

### 广告目标

<ul>
  <li>`brand_awareness`：将帖子展示给尽可能多的人。</li>
  <li>`website_visits`：获取指向您网站的点击。</li>
  <li>`leads`：获取由您的像素追踪的注册或潜在客户。</li>
  <li>`sales`：获取由您的像素追踪的购买。</li>
</ul>

## 定向自定义受众

要触达或排除您 Reddit 自定义受众中的人群，请发送 `targeting.audiences` 和 `targeting.excludedAudiences`。两者都是来自[受众](https://www.ayrshare.com/docs/apis/ads/reddit/get-audiences.md)的受众 ID 列表：包括您的客户名单、网站访客，以及该广告账户上的任何其他受众。您可以通过[创建受众](https://www.ayrshare.com/docs/apis/ads/reddit/create-audience.md)或在 Reddit Ads Manager 中创建受众。

```json theme={"system"}
{
  "accountId": "a2_abc123",
  "socialPostId": "1abc27",
  "goal": "website_visits",
  "budget": { "amount": 20, "type": "daily" },
  "targeting": {
    "locations": { "countries": ["US"] },
    "audiences": ["ca.129482487242828"],
    "excludedAudiences": ["ca.129482487242999"]
  },
  "platformOptions": { "reddit": { "pixelId": "t2_pixel123" } }
}
```

<ul>
  <li>`targeting.audiences`：在您设置的其他定向范围内，广告会触达属于其中任一受众的人。</li>
  <li>`targeting.excludedAudiences`：属于其中任一受众的人永远不会看到该广告。</li>
  <li>仍在填充中的受众（`status.ready: false`）在 Reddit 匹配到至少 1,000 人之前可能无法投放。</li>
  <li>仍然必须提供 `targeting.locations`。</li>
  <li>每个列表至少需要一个 ID；如果没有，请直接省略该字段，而不要发送空列表。空列表或不是 Reddit 受众 ID 的值会在创建任何内容之前返回带有 `code: 101` 的 `400`。</li>
</ul>

## 请求头参数

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## 请求体参数

**idempotencyKey** `string`

此次推广请求的唯一非空键。使用相同的键重试相同的载荷可避免创建重复广告。使用相同的键但载荷不同会返回 HTTP 409。该键仅适用于此平台：在其他平台上使用相同的键会创建一个独立的推广。仍在处理中的请求同样会返回 409；预留不可用时会返回 503 且不会创建广告。

**accountId** `string` *required*

您的 Reddit 广告账户 ID，例如 `a2_abc123`。

**postId** `string`

要推广的 Ayrshare 帖子 ID。请发送 `postId` 或 `socialPostId`。如果同时发送两者，`postId` 必须是您自己的帖子之一，否则推广会失败并返回 `code: 369`。

**socialPostId** `string`

Reddit 帖子 ID，可带或不带 `t3_` 前缀，例如 `1abc27`。该帖子必须位于社区中。Reddit 无法识别的 ID 会返回 `code: 369`。

**goal** `string` *required*

[广告目标](#ad-goals) 之一。

**budget** `object` *required*

**子属性**

**amount** `number` *required*

花费金额，最多保留两位小数。

**type** `string` (default: daily)

`daily` 或 `lifetime`。总预算（lifetime）需要设置 `schedule.end`。

**schedule** `object`

**子属性**

**start** `string`

广告开始投放的 ISO 日期时间。默认为当前时间。如果开始时间已过去，广告会立即开始投放。

**end** `string`

广告停止投放的 ISO 日期时间。如不设置，广告将持续投放，直到您将其暂停。该时间必须晚于 `start`。两个日期都不能超过 10 年之后。违反任一规则会返回 `code: 101`。

**targeting** `object` *required*

**子属性**

**locations** `object` *required*

广告的展示位置：在 `countries` 下至少提供一个大写的两字母国家代码。小写代码（例如 `"us"`）会返回 `code: 101`。

```json theme={"system"}
{ "countries": ["US", "CA"] }
```

**genders** `string`

`all`、`male` 或 `female`。

**interests** `array`

来自[兴趣](https://www.ayrshare.com/docs/apis/ads/reddit/get-ad-interests.md)的兴趣 ID。

**keywords** `array`

用于展示广告的搜索词，每个最多 100 个字符。

**audiences** `array`

要触达的自定义受众 ID，来自[受众](https://www.ayrshare.com/docs/apis/ads/reddit/get-audiences.md)，至少一个。请参阅[定向自定义受众](#audiences)。

**excludedAudiences** `array`

其中人群永远不会看到该广告的自定义受众 ID，至少一个。请参阅[定向自定义受众](#audiences)。

**status** `string` (default: active)

`active` 或 `paused`。

**platformOptions.reddit** `object` *required*

**子属性**

**pixelId** `string` *required*

您的 Reddit 转化像素 ID。

**fundingInstrumentId** `string`

为广告付费的付款方式。当您的广告账户有多个付款方式时必须提供。

**communities** `array`

展示广告的社区，使用不带 `r/` 的名称，例如 `["gardening"]`。每个名称由 2 到 21 个字母、数字或下划线组成。如果没有社区，请直接省略该字段，而不要发送空列表。

**adName** `string`

活动、广告组和广告的名称，最多 255 个字符。默认由您的公司名称、帖子和时间组成。如果您发送 `idempotencyKey`，默认名称末尾还会附加一个简短的请求标识，同一密钥的标识保持不变。

```bash cURL theme={"system"}
curl -X POST https://api.ayrshare.com/api/ads/reddit/boost \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "a2_abc123",
    "socialPostId": "1abc27",
    "goal": "website_visits",
    "budget": { "amount": 50, "type": "daily" },
    "targeting": { "locations": { "countries": ["US"] } },
    "platformOptions": { "reddit": { "pixelId": "YOUR_PIXEL_ID" } }
  }'
```

```json 200: Post Boosted theme={"system"}
{
  "status": "success",
  "id": "2707300000000000001",
  "platform": "reddit",
  "adStatus": "ACTIVE",
  "budget": { "amount": 50, "type": "daily", "level": "adSet", "currency": "USD" },
  "schedule": { "start": 1791892800000 },
  "platformIds": {
    "campaignId": "2707100000000000001",
    "adGroupId": "2707200000000000001",
    "adId": "2707300000000000001"
  }
}
```

```json 400: No pixel theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 101,
  "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
  "details": "platformOptions.reddit.pixelId is required on reddit: Reddit runs no ad without a conversion pixel. Find it in Reddit Ads Events Manager."
}
```

```json 400: Profile post theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 101,
  "message": "Missing or incorrect parameters. Please verify with the docs. https://www.ayrshare.com/docs/apis",
  "details": "Post 1abc27 is on a Reddit profile (r/u_example). reddit boosts posts in communities only."
}
```

```json 429: Rate limited theme={"system"}
{
  "action": "rate limit",
  "status": "error",
  "code": 364,
  "message": "You are making too many requests. Please reduce the number of requests.",
  "details": "Too many requests Retry in 30 seconds."
}
```


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