# Reddit 关键词搜索 API (reddit.search)

- Canonical page: https://everyinfra.com/reddit-api/search
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "reddit", "action": "search", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 25 per call (larger values are capped)
- 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=reddit&action=search

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| keyword | not declared | yes | not declared | search 的 Reddit 帖子检索词，不搜索评论全文；默认按相关性排序，时间范围固定为最近一个月。只返回对得上关键词的帖子：标题或社区名里有关键词的词、全帖凑齐这些词，或者这些词在正文里挨着出现（三个词起至少要命中四分之三）；只沾一个词的帖子不返回，所以条数可能少于 limit，一条都没有时按空结果退款。 |
| sort | enum: controversial / newest / popular / relevance / rising / top | no | not declared | Reddit 帖子搜索排序：relevance 相关性、newest 最新、popular 热度、rising 上升、top 高分、controversial 争议；时间范围固定为最近一个月，排序不改变这一范围。 |
| limit | integer (1–25) | no | 10 | 这次调用最多返回的条数，整数，1–25；不传按默认值，实际返回可能少于这个数。超过上限照收，按上限返回。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| community | 所属 subreddit 名称（不含 r/ 前缀）。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| flair | 帖子的分类标签（flair）原文。 |
| domain | 帖子链接的域名（文字帖为 self.版块名 或 reddit.com）。 |
| external_link | 链接帖指向的站外地址。 |
| thumbnail_url | 缩略图链接，分辨率低于 image_url。 |
| image_urls | 帖子里的图片地址。 |
| 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": "reddit",
  "action": "search",
  "params": {
    "keyword": "mechanical keyboard"
  }
}'
```

```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": "reddit",
        "action": "search",
        "params": {
            "keyword": "mechanical keyboard",
        },
    },
    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": "reddit",
  "action": "search",
  "results": [
    {
      "id": "1wpwg1j",
      "url": "https://www.reddit.com/r/civic/comments/1wpwg1j/would_you_use_mechanical_keyboard_switches_as_12v/",
      "title": "Would you use mechanical keyboard switches as 12V car controls?",
      "text": "We&#39;re building MXIO: a small switch system that lets you use standard MX-style mechanical keyboard switches in a car. The switches are hot-swappable, and each unit can be set up as a momentary or toggle control. It’s designed for 12V systems, rated for 15A continuous / 20A pe…",
      "author_username": "•••",
      "community": "civic",
      "like_count": 0,
      "comment_count": 0,
      "posted_at": "2026-09-25T13:31:55+00:00",
      "platform": "reddit"
    },
    {
      "id": "1wptnwp",
      "url": "https://www.reddit.com/r/IndianTeenagers/comments/1wptnwp/mechanical_keyboard_recommendations/",
      "title": "Mechanical keyboard recommendations",
      "text": "&#x200B; Hey everyone! I’m looking to buy my first mechanical keyboard and would appreciate some recommendations. What I’m looking for: - Budget: Under 7k - Layout: 75% - Use: Gaming + programming + general use I’m mainly looking for something with good build quality, comfortable…",
      "author_username": "•••",
      "community": "IndianTeenagers",
      "like_count": 0,
      "comment_count": 0,
      "posted_at": "2026-09-25T11:18:43+00:00",
      "platform": "reddit"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## Also

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