# Reddit 用户内容 API (reddit.user_posts)

- Canonical page: https://everyinfra.com/reddit-api/user_posts
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "reddit", "action": "user_posts", "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 50 per call
- Mode: sync; add "mode": "async" for slow tasks

Reddit 用户内容按 `username` 列出一个用户发过的帖子，每条带标题、正文、所在版块 `community`、点赞数、评论数、发布时间、分类标签，链接帖还带站外地址和域名。它回答「这个人在 Reddit 上发什么、常去哪些版块」，适合核查一个账号的背景、研究品牌账号在社区里怎么运营，以及看一个账号的链接帖都指向哪些站外域名。默认返回 10 条，单次最多 50 条。

用户名可以写 spez、u/spez 或完整 /user/ 链接；`sort` 和 `date_range` 的用法与社区帖子相同，时间窗只在 `top` 排序下生效。`author_username` 是帖子作者的用户名，可以用来拼链接。图片帖用 `image_urls` 取图。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | user_posts 的用户名，例如 spez 或 u/spez，或完整 /user/用户名/ URL。 |
| date_range | enum: all_time / past_day / past_hour / past_month / past_week / past_year | no | not declared | 用户发帖的相对时间窗；all_time 不限，past_hour/day/week/month/year 为对应的最近时间。Reddit 在 sort=top 时才会应用该窗口。 |
| sort | enum: newest / popular / relevance / rising / top | no | not declared | 用户发帖列表排序：newest 最新、popular 热门、top 高分、rising 上升、relevance 相关性。 |
| limit | integer (1–50) | no | 10 | 这次调用最多返回的条数，整数，1–50；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## 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": "user_posts",
  "params": {
    "username": "spez"
  }
}'
```

```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": "user_posts",
        "params": {
            "username": "spez",
        },
    },
    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": "user_posts",
  "results": [
    {
      "id": "1vgbkge",
      "url": "https://www.reddit.com/user/spez/comments/1vgbkge/modernizing_reddits_infrastructure_with_you/",
      "title": "Modernizing Reddit’s infrastructure with you",
      "author_username": "spez",
      "community": "u_spez",
      "like_count": 345,
      "comment_count": 467,
      "posted_at": "2026-08-05T16:03:56.264000+00:00",
      "platform": "reddit"
    },
    {
      "id": "1u7hraf",
      "url": "https://www.reddit.com/user/spez/comments/1u7hraf/21_years_of_reddit/",
      "title": "21 years of Reddit",
      "author_username": "spez",
      "community": "u_spez",
      "like_count": 900,
      "comment_count": 297,
      "posted_at": "2026-06-16T16:04:27.655000+00:00",
      "platform": "reddit"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 怎么看一个用户常去哪些版块？

按 `community` 统计他发帖的版块，次数最多的几个就是他的主要活动范围。这能帮你判断他的兴趣和专业领域，也能找到你的目标用户聚集的社区。单次最多 50 条，统计出来的是这一批帖子里的分布；想换一段时间看，`sort` 传 `top` 再配 `date_range`，时间窗只在这种排序下生效。`posted_at` 是 UTC 时间，统计活跃时段前先换成自己要用的时区。`community` 不含 r/ 前缀，可以直接按它分组。

### 怎么看一个账号的链接帖都指向哪里？

看 `external_link` 和 `domain`：按 `domain` 统计，就知道这个账号的链接帖主要指向哪些站点；再对照 `community`、`like_count` 和 `comment_count`，看这些帖子发在哪些版块、社区反应如何。`external_link` 是链接帖指向的站外地址，只有链接帖有；`domain` 在文字帖上是 self.版块名 或 reddit.com，所以统计站外域名要先排除这两类。

### 想看用户历史上最受欢迎的帖子怎么办？

`sort` 传 `top`，`date_range` 传 `all_time`，就会把他历史上得分最高的帖子排在前面。换成 `past_year` 就只看最近一年。`sort` 的取值有 `newest`、`popular`、`relevance`、`rising`、`top`，只有 `top` 会应用时间窗；`all_time` 不限，`past_hour`、`past_day`、`past_week`、`past_month`、`past_year` 是对应的最近时间。`like_count` 为 null 表示不公开，不等于 0。

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