> ## 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.

# 推广帖子

> 将 TikTok 视频作为 Spark Ad 推广。Ayrshare 在您的 TikTok 广告账户中创建广告系列、广告组和广告，并应用您的目标、预算和定向。

将 TikTok 视频作为 Spark Ad 推广。广告按原样投放该视频，以其创作者的账户名义展示，视频保留其点赞、评论和关注。Ayrshare 会在您的 TikTok 广告账户中创建一个广告系列、一个广告组和一个广告。

<ul>
  <li>关联 TikTok，然后在仪表板中连接一个 TikTok 广告账户。广告将从该广告账户投放。</li>
  <li>对于来自您已关联 TikTok 账户的视频，您不需要代码。如果该 TikTok 账户在 TikTok 中已关联到您的广告账户，广告将以该账户身份投放。否则，Ayrshare 会为您创建 Spark Ads 代码。</li>
  <li>对于其他创作者的视频，由创作者在 TikTok 应用中生成 Spark Ads 代码并提供给您。请在 `platformOptions.tiktok.sparkAuthCode` 中发送该代码。代码必须对应您要推广的视频，否则响应为 `code: 101`。</li>
  <li>预算设置在广告组上，使用您广告账户的货币。请勿发送 `budget.currency` 或 `budget.level: "campaign"`。</li>
  <li>最低预算为每天 20（以您广告账户的货币计）。总预算为每个排期日至少 20。</li>
  <li>广告投放期间，视频会保留在创作者的主页上。发送 `platformOptions.tiktok.adsOnly: true` 可仅将其作为广告展示。</li>
  <li>如果您发送请求的速度超过 TikTok 允许的速度，响应为 `code: 364`，HTTP 状态码为 429，`details` 中包含 TikTok 的消息。请等待一分钟，然后使用新的 `idempotencyKey` 重试。</li>
  <li>广告包含在 Premium Plan、Business Plan 和 Enterprise Plan 中，详见 [Ads 概览](https://www.ayrshare.com/docs/zh-Hans/apis/ads/overview.md)。使用其他方案时，响应为 `code: 169`。</li>
  <li>如果 TikTok 撤销了 Ayrshare 对您广告账户的访问权限，响应为 `code: 420`，HTTP 状态码为 401，并且 `ads` webhook 会发送 `accountRevoked`。请在仪表板中重新连接 TikTok 广告账户。</li>
  <li>TikTok 广告按账户开启。请联系我们开启。</li>
</ul>

### TikTok 支持的内容

| 选项 | TikTok |
| - | - |
| 目标 | `brand_awareness`, `video_views`, `traffic` |
| 预算 | `daily` 或 `lifetime`，设置在广告组上 |
| 定向 | 国家、地区和城市、年龄段、性别、兴趣 |
| 不支持 | `targeting.keywords`、`targeting.audiences`、`targeting.excludedLocations`、`attachTo`、消息按钮 |
| 广告状态更新 | `ACTIVE`, `PAUSED`, `DELETED` |

### 广告目标

<ul>
  <li>`brand_awareness`: 向尽可能多的人展示视频。</li>
  <li>`video_views`: 获得更多视频观看次数。</li>
  <li>`traffic`: 将用户引导至您的网站。需要带链接的 `callToAction`。</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`

## 请求体参数

**accountId** `string` *required*

您的 TikTok 广告账户（广告主）ID，例如 `7100000000000000001`。必须是您已连接的广告账户。

**postId** `string`

要推广的 Ayrshare 帖子 ID。请发送 `postId` 或 `socialPostId`。

**socialPostId** `string`

要推广的 TikTok 视频 ID。

**goal** `string` *required*

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

**budget** `object` *required*

**子属性**

**amount** `number` *required*

花费金额，至少 20，最多两位小数。

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

`daily` 或 `lifetime`。总预算需要 `schedule.end`。

**schedule** `object`

**子属性**

**start** `string`

广告开始的 ISO 日期时间。默认为当前时间。

**end** `string`

广告停止的 ISO 日期时间。省略则广告一直投放，直到您暂停。

**targeting** `object` *required*

**子属性**

**locations** `object` *required*

广告的展示位置：在 `countries` 下填写两个字母的国家代码，或在 `regions` 或 `cities` 下填写来自 `GET /ads/tiktok/regions?search=<term>` 的位置 ID。

```json theme={"system"}
{ "countries": ["US"], "regions": [{ "key": "5332921" }] }
```

**ageMin** `number`

TikTok 某个年龄段的起始值：18、25、35、45 或 55。

**ageMax** `number`

TikTok 某个年龄段的结束值：24、34、44、54，或 65（表示 55 岁及以上）。

**genders** `string`

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

**interests** `array`

来自 `GET /ads/tiktok/interests?search=<term>` 的兴趣类别 ID。

**callToAction** `object`

`traffic` 目标必填。

**子属性**

**type** `string` *required*

`LEARN_MORE`、`SHOP_NOW`、`SIGN_UP`、`CONTACT_US`、`APPLY_NOW`、`BOOK_NOW`、`DOWNLOAD_NOW`、`GET_QUOTE`、`ORDER_NOW`、`SUBSCRIBE`、`WATCH_NOW` 或 `READ_MORE`。

**link** `string`

要打开的页面。`traffic` 目标必填。

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

`active` 或 `paused`。

**idempotencyKey** `string`

此推广请求的唯一非空键。使用相同的键重试相同的请求体，可避免创建重复的广告：第一次的响应（包括错误）会被重放。使用不同的请求体重复使用该键会返回 HTTP 409。该键仅适用于此平台：在其他平台上使用相同的键会启动一次单独的推广。仍在处理中的请求也会返回 409；预留不可用时会返回 503，且不会创建广告。

**platformOptions.tiktok** `object`

**子属性**

**sparkAuthCode** `string`

视频创作者在 TikTok 应用中为此视频生成的 Spark Ads 代码。对于并非来自您已关联 TikTok 账户的视频，此项必填。

**adsOnly** `boolean` (default: false)

`true` 表示仅将视频作为广告展示，不显示在创作者的主页上。

```bash cURL theme={"system"}
curl -X POST https://api.ayrshare.com/api/ads/tiktok/boost \
  -H "Authorization: Bearer API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "accountId": "7100000000000000001",
    "socialPostId": "7400000000000000001",
    "goal": "brand_awareness",
    "budget": { "amount": 20, "type": "daily" },
    "targeting": { "locations": { "countries": ["US"] } },
    "platformOptions": { "tiktok": { "sparkAuthCode": "#AbCdEf123" } }
  }'
```

```json 200: Video Boosted theme={"system"}
{
  "status": "success",
  "id": "1800000000000000003",
  "platform": "tiktok",
  "adStatus": "ACTIVE",
  "budget": { "amount": 20, "type": "daily", "level": "adSet", "currency": "USD" },
  "schedule": { "start": 1792584000000 },
  "platformIds": {
    "campaignId": "1800000000000000001",
    "adGroupId": "1800000000000000002",
    "adId": "1800000000000000003"
  }
}
```

```json 400: Code for another video 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.tiktok.sparkAuthCode is for TikTok video 7400000000000000002, not the boosted post 7400000000000000001."
}
```

```json 400: Budget too small 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": "budget.amount on tiktok is at least 20 in the ad account's currency."
}
```

```json 401: Ad account access removed theme={"system"}
{
  "action": "ads",
  "status": "error",
  "code": 420,
  "message": "Ads permissions missing for this social account. Please unlink the account and relink it in the social account linking page, granting all ads permissions.",
  "details": "Relink tiktok and grant the ads permissions to use ads on tiktok."
}
```

```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. Please retry in some time."
}
```


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