# Discord 用户搜索 API (discord.search_users)

- Canonical page: [https://everyinfra.com/discord-api/search_users](https://everyinfra.com/discord-api/search_users?utm_medium=ai_doc&utm_campaign=page_md)
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "discord", "action": "search_users", "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

## Health

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

## 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 | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| username | 用户名（@handle）。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| avatar | 头像。 |
| clan_tag | 服务器 Clan 标签。 |
| server_count | 结果里的服务器数量。 |
| invite_count | 邀请链接数。 |
| 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": "discord",
  "action": "search_users",
  "params": {
    "keyword": "leo"
  }
}'
```

```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_users",
        "params": {
            "keyword": "leo",
        },
    },
    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_users",
  "results": [
    {
      "id": "•••",
      "username": "•••",
      "name": "•••",
      "avatar": "https://cdn.discordapp.com/•••",
      "clan_tag": "Ca㏌e",
      "server_count": 65,
      "invite_count": 65,
      "created_at": "2025-05-14T00:00:00+00:00",
      "platform": "discord"
    },
    {
      "id": "•••",
      "username": "•••",
      "name": "•••",
      "avatar": "https://cdn.discordapp.com/•••",
      "server_count": 25,
      "invite_count": 42,
      "created_at": "2018-02-16T00:00:00+00:00",
      "platform": "discord"
    }
  ],
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

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