# Twitch 关键词搜索 API (twitch.search)

- Canonical page: [https://everyinfra.com/twitch-api/search](https://everyinfra.com/twitch-api/search?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "twitch", "action": "search", "params": {...}}
- Price: $0.001389 per call ($1.39 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 30 per call
- Mode: sync; add "mode": "async" for slow tasks

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | search 的频道关键词；不是任意直播标题检索词。 |
| limit | integer (1–30) | no | 10 | 这次调用最多返回的条数，整数，1–30；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| user_id | 用户在原平台的唯一 ID。 |
| username | 用户名（@handle）。 |
| display_name | 显示名，可能与 username 不同。 |
| bio | 个人简介，账号自己填写的文本。可能含换行和 emoji。 |
| url | 该记录在原平台上的可访问链接。 |
| avatar_url | 头像图片链接。部分平台给的是带尺寸参数的 CDN 链接，可能有时效。 |
| banner_url | 频道横幅。 |
| follower_count | 粉丝数。null 表示不公开，不等于 0。 |
| is_partner | 是否为 Twitch 合作伙伴（最高档认证）。 |
| is_affiliate | 是否为 Affiliate（初级变现资格，低于 Partner 一档）。 |
| is_live | 当前是否在播。 |
| current_viewers | 当前观看人数。 |
| stream_title | 直播标题。 |
| current_game | 当前直播的游戏。 |
| stream_started_at | 本场开播时间。 |
| last_broadcast_title | 最近直播标题。 |
| last_broadcast_game | 最近直播的游戏。 |
| last_broadcast_at | 最近一次开播时间。判断主播是否活跃/停更的关键字段。 |
| created_at | 创建时间，格式同 posted_at。 |
| 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": "twitch",
  "action": "search",
  "params": {
    "keyword": "chess"
  }
}'
```

```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": "twitch",
        "action": "search",
        "params": {
            "keyword": "chess",
        },
    },
    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": "twitch",
  "action": "search",
  "results": [
    {
      "user_id": "•••",
      "username": "•••",
      "display_name": "•••",
      "bio": "Chess.com is the world’s #1 chess community with millions of chess players and fans. Join today!",
      "url": "https://www.twitch.tv/chess",
      "avatar_url": "https://static-cdn.jtvnw.net/•••",
      "follower_count": 1273946,
      "is_partner": true,
      "is_affiliate": false,
      "is_live": false,
      "platform": "twitch"
    },
    {
      "user_id": "•••",
      "username": "•••",
      "display_name": "•••",
      "bio": "Canadian Grandmasters pushing the boundaries of chess entertainment... •••",
      "url": "https://www.twitch.tv/chessbrah",
      "avatar_url": "https://static-cdn.jtvnw.net/•••",
      "follower_count": 338247,
      "is_partner": true,
      "is_affiliate": false,
      "is_live": false,
      "platform": "twitch"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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