# Discord 关键词搜索 API (discord.search)

- Canonical page: [https://everyinfra.com/discord-api/search](https://everyinfra.com/discord-api/search?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "discord", "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 20, max 100 per call
- Mode: sync; add "mode": "async" for slow tasks

Discord 关键词搜索按 `keyword` 在公开服务器目录里查找服务器，每条带名称、介绍、成员数和在线人数、Boost 数、分类和关键词标签、验证等级、是否 NSFW、创建时间和链接。它回答「围绕这个主题有哪些公开社区、活跃程度如何」，适合社区运营参照同类服务器，营销团队寻找目标用户聚集的社区，研究者按主题梳理社区。

它只查公开服务器目录，不检索服务器里的聊天消息，也不能进入私有服务器。判断活跃度看 `online_count` 占 `member_count` 的比例，比只看总数更说明问题；有 `vanity_url_code` 说明服务器达到过 Boost 等级门槛。`language` 由平台判定，可能不准。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | search 查公开服务器目录，search_users 按用户名或显示名查公开用户。它不检索服务器内消息，也不授予访问私有服务器的权限。 |
| limit | integer (1–100) | no | 20 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| member_count | 服务器总成员数。 |
| online_count | 当前在线数。**在线/总数比值比总数更能反映社区活跃度**。 |
| boost_count | 服务器 Boost 数（成员付费加成）。 |
| vanity_url_code | 自定义邀请短链。有它说明服务器达到过 Boost 等级门槛。 |
| language | 内容语言代码（如 zh、en），由平台判定，可能不准。 |
| categories | 服务器分类。 |
| keywords | 关键词标签。 |
| icon_url | 服务器图标。 |
| banner_url | 横幅图。 |
| verification_level | 验证等级（进入门槛）。 |
| is_nsfw | 是否为 NSFW 服务器。 |
| created_at | 创建时间，格式同 posted_at。 |
| directory_url | 服务器目录页链接。 |
| 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": "discord",
  "action": "search",
  "params": {
    "keyword": "game development"
  }
}'
```

```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": "discord",
        "action": "search",
        "params": {
            "keyword": "game development",
        },
    },
    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 20. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "discord",
  "action": "search",
  "results": [
    {
      "id": "•••",
      "name": "Krunker Bunker",
      "url": "https://discord.gg/krunker",
      "text": "The official Krunker.io Discord server! Your hub for game development, trading, giveaways, and chatting!",
      "member_count": 192954,
      "online_count": 6754,
      "boost_count": 21,
      "language": "en-US",
      "categories": [
        "LFG"
      ],
      "keywords": [
        "Game",
        "Gaming",
        "Krunker"
      ],
      "icon_url": "https://cdn.discordapp.com/icons/448194623580667916/307504ce3821a7b6ffd605b21dc996a8.png?size=256.webp?size=256",
      "banner_url": "https://cdn.discordapp.com/banners/448194623580667916/b77e42c8e9069afa2fbdcee16a23adfc.webp?size=480",
      "verification_level": "COMMUNITY, DISCOVERABLE, VERIFIED",
      "directory_url": "https://discord.com/servers/krunker-bunker-448194623580667916",
      "platform": "discord"
    },
    {
      "id": "•••",
      "name": "InfinitySports",
      "url": "https://discord.gg/infinitysports",
      "text": "Official discord server for the ROBLOX game development studio InfinitySports",
      "member_count": 156670,
      "online_count": 17822,
      "boost_count": 102,
      "language": "en-US",
      "categories": [
        "Esports"
      ],
      "keywords": [
        "basketball",
        "football",
        "hockey"
      ],
      "icon_url": "https://cdn.discordapp.com/icons/1102970117853282374/ddccd7682a0870316aa7c477b00fb259.png?size=256.webp?size=256",
      "banner_url": "https://cdn.discordapp.com/banners/1102970117853282374/d42d8db7fa0b142d5c23c3f0ff56eb2a.webp?size=480",
      "verification_level": "COMMUNITY, DISCOVERABLE",
      "directory_url": "https://discord.com/servers/infinitysports-1102970117853282374",
      "platform": "discord"
    }
  ],
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 能搜到服务器里的聊天内容吗？

不能。`keyword` 只在公开服务器目录里匹配服务器，不检索任何服务器内的消息，也不提供进入私有服务器的权限。要找的是用户而不是服务器时，用 Discord 用户搜索，它按用户名或显示名查找公开用户。

### 怎么判断一个服务器活不活跃？

用 `online_count` 除以 `member_count`，即读取时在线成员占总成员的比例，它比成员总数更能反映活跃度；`boost_count` 是成员付费加成（Boost）的数量，可以作为社区投入程度的另一个信号。在线人数只代表读取那一刻，定期读取才能看出趋势。

### 想进一步读某个服务器的资料怎么办？

手里有邀请码或邀请链接时，用 Discord 服务器资料读取，可以传裸邀请码、discord.gg 或 discord.com/invite 链接；它只读邀请对应的公开信息，不会替你加入服务器，邀请失效也不代表服务器不存在。想按分类浏览，用 Discord 目录与社区发现。

## Also

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