# TikTok 关键词搜索 API (tiktok.search)

- Canonical page: https://everyinfra.com/tiktok-api/search
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "tiktok", "action": "search", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 200 per call
- Mode: sync; add "mode": "async" for slow tasks

TikTok 关键词搜索按 `keyword` 检索公开视频，返回视频文案、作者昵称与用户名、点赞、评论、分享和播放数，以及发布时间。它回答「这个话题在 TikTok 上哪些视频在传播、是谁发的」，适合做海外选题和趋势研究、品牌声量观察和寻找海外达人。

用 `content_type` 选搜索栏目：`video` 视频、`profile` 用户、`top` 综合。它不能用来指定某个作者、单条视频或话题，那些有各自的能力。`author_username` 是作者的 @handle，可以拼出主页链接。默认 10 条，单次最多 200 条。注意这里搜的是视频内容，TikTok Shop 的商品搜索是另一套数据。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=tiktok&action=search

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | search 的公开视频关键词；shop_search 则搜索 TikTok Shop 商品，两者不是同一数据集。 |
| content_type | enum: profile / top / video | no | not declared | search 的搜索栏目：video 视频、profile 用户、top 综合；不用于固定作者、单视频、评论或话题入口。 |
| limit | integer (1–200) | no | 10 | 这次调用最多返回的条数，整数，1–200；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_name | 评价人名字（shop_product_reviews），平台已打码，如 n**h。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| share_count | 分享/转发数。null 表示不公开，不等于 0。 |
| view_count | 浏览/播放数。null 表示不公开，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| collect_count | 收藏数。null 表示不公开，不等于 0。 |
| repost_count | 转发数。 |
| duration_sec | platform-native meaning |
| duration_seconds | 时长，单位秒。非视频/音频内容为 null。 |
| cover_image_url | 视频封面图链接（带签名，会过期）。 |
| language | 内容语言代码（如 zh、en），由平台判定，可能不准。 |
| country | 国家或地区。可能是全称也可能是 ISO 代码，取决于平台，未归一。 |
| hashtags | 正文里的话题标签数组，按出现顺序；没有时不出现这个字段。 |
| music | 背景音乐：id、title（曲名）、author、is_original（是否原声）、play_url（音频地址，会过期）、cover_url。 |
| is_ad | 是否广告视频。 |
| is_pinned | 是否在作者主页置顶。 |
| is_sponsored | 是否含赞助内容。 |
| is_slideshow | 是否图文轮播（不是视频）。 |
| has_shop_product | 视频是否挂了 TikTok Shop 商品；没有这个键表示无法判定。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_url | 作者在原平台的主页链接。 |
| author_avatar_url | 作者头像图片链接（多数平台带签名、会过期）。 |
| author_bio | platform-native meaning |
| author_is_verified | platform-native meaning |
| author_is_private | 作者是否私密账号。 |
| author_is_seller | 作者是否 TikTok Shop 卖家。 |
| author_follower_count | 作者粉丝数。null 表示不公开。 |
| author_following_count | platform-native meaning |
| author_like_count | platform-native meaning |
| author_video_count | platform-native meaning |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "tiktok",
  "action": "search",
  "params": {
    "keyword": "urban gardening"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "tiktok",
        "action": "search",
        "params": {
            "keyword": "urban gardening",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "tiktok",
  "action": "search",
  "results": [
    {
      "id": "•••",
      "url": "https://www.tiktok.com/@•••/video/7647269061931355409",
      "text": "Get yourself vertical farms and grow your own vegetables year round! Right here in Ghana 🇬🇭💚\n#Hydroponics #UrbanFarming #FarmToTable #FarmToTable #gardening ",
      "author_name": "•••",
      "author_username": "•••",
      "like_count": 2403,
      "comment_count": 69,
      "share_count": 265,
      "view_count": 27200,
      "posted_at": "2026-06-03T20:30:34+00:00",
      "platform": "tiktok"
    },
    {
      "id": "•••",
      "url": "https://www.tiktok.com/@•••/video/7644708493252939022",
      "text": "Replying to @••• please watch to the end to literally have your jaw on the floor! Let me know if you have any questions- it’s a lot to cover in one video 💚👩🏻‍🌾  #gardentok #gardentour #urbanfarm ",
      "author_name": "•••",
      "author_username": "•••",
      "like_count": 6408,
      "comment_count": 181,
      "share_count": 145,
      "view_count": 50800,
      "posted_at": "2026-05-27T22:53:50+00:00",
      "platform": "tiktok"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `content_type` 有什么区别？

`video` 只搜视频，`profile` 搜用户账号，`top` 对应 TikTok 的综合栏目。它只决定搜索栏目，不能用来指定某个作者、单条视频、评论或话题。`keyword` 填视频主题词，示例是 urban gardening；视频文稿和作者资料要的输入格式不同，不要往这里填。搜索没有时间筛选参数，要看某段时间内的视频，用 `posted_at`（UTC）在结果里自己筛。

### 怎么从搜索结果找到作者主页？

`author_username` 是作者的 @handle，可以拼出 https://www.tiktok.com/@用户名 这样的主页链接。要读作者资料或视频，把用户名本身（可带 @）交给 TikTok 的主页详情或用户视频能力，不要传完整主页链接。结果行里自带 `author_follower_count`，可以先按粉丝数粗筛出值得读主页的作者，它为 null 表示不公开。同一作者可能重复出现，先按 `author_username` 去重，再逐个读主页或视频。

### 能搜 TikTok Shop 的商品吗？

这个能力搜的是公开视频。TikTok Shop 的商品搜索是另一个能力，返回的是商品数据，两者不是同一个数据集。想从搜索结果里挑出带货视频，看 `has_shop_product`：为真表示视频挂了 TikTok Shop 商品，没有这个键表示无法判定，不要当成没挂。`is_ad` 和 `is_sponsored` 分别标出广告视频和含赞助内容的视频，统计品牌声量时可以把它们和自然内容分开；`is_slideshow` 为真的是图文轮播，不是视频。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=tiktok
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
