# Lemmy 信息流 API (lemmy.feed)

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

Lemmy 信息流一个必填参数都没有，以 `instance` 指定的实例为入口直接返回帖子，不填就是 lemmy.world，默认 20 条，单次最多 100 条。每条帖子标出所在社区 `community`，外部链接放在 `external_url`。它回答「这个入口上现在大家在聊什么」，适合做话题扫描，再从中挑出值得单独盯的社区。

扫话题时可以先用标记过滤：`is_nsfw` 标成人内容，`is_locked` 表示禁止新评论，`is_featured` 是置顶精选。`embed_title` 是外部链接的标题，`thumbnail_url` 是缩略图，分辨率低于原图；`posted_at` 是 UTC 时间，`updated_at` 是帖子的编辑时间。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| instance | not declared | no | not declared | Lemmy 实例域名，例如 lemmy.world，默认 lemmy.world；可以传带协议的实例 URL，最终只保留主机名。它指定查询入口，不是社区名称。 |
| sort | enum: active / hot / most_comments / new / new_comments / top | no | not declared | 帖子排序：hot 热门、active 活跃、new 新帖、top 高分、most_comments 评论最多、new_comments 新评论活动。search/community 默认 hot，feed 默认 active，comments 默认 most_comments。 |
| top_range | enum: all / day / hour / month / ninemonths / sixhour / sixmonths / threemonths / twelvehour / week / year | no | not declared | 只在 sort=top 时生效的积分时间窗：hour 1 小时、sixhour 6 小时、twelvehour 12 小时、day 1 天、week 1 周（默认）、month 1 月、threemonths 3 月、sixmonths 6 月、ninemonths 9 月、year 1 年、all 全部。不是评论发布时间过滤。 |
| limit | integer (1–100) | no | 20 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| body | 正文。 |
| url | 该记录在原平台上的可访问链接。 |
| external_url | 帖子指向的外部链接。 |
| community | 社区名。 |
| community_url | 社区链接。 |
| instance | 所在实例(服务器)。Lemmy 是联邦宇宙社区，同名社区可存在于不同实例。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_url | 作者在原平台的主页链接。 |
| score | 净得分（顶减踩）。 |
| upvote_count | 顶数。 |
| downvote_count | 踩数。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| thumbnail_url | 缩略图链接，分辨率低于 image_url。 |
| embed_title | 外链的标题。 |
| is_nsfw | 是否为成人内容。 |
| is_locked | 是否锁定（禁止新评论）。 |
| is_featured | 是否为置顶精选。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| updated_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": "lemmy",
  "action": "feed",
  "params": {}
}'
```

```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": "lemmy",
        "action": "feed",
        "params": {},
    },
    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": "lemmy",
  "action": "feed",
  "results": [
    {
      "id": "52348248",
      "title": "America, exblain",
      "body": "",
      "url": "https://lemmy.world/post/52348248",
      "external_url": "https://lemmy.world/pictrs/image/ecf7373c-3e4f-4c6c-a690-c305f66ba3b6.png",
      "community": "fuckcars",
      "community_url": "https://lemmy.world/c/fuckcars",
      "instance": "lemmy.world",
      "author_username": "•••",
      "author_url": "https://lemmy.world/•••",
      "score": 1093,
      "upvote_count": 1108,
      "downvote_count": 15,
      "comment_count": 311,
      "thumbnail_url": "https://lemmy.world/pictrs/image/a58a4f54-7ff5-473d-8ce8-68209a0e5e4e.png",
      "is_nsfw": false,
      "is_locked": false,
      "is_featured": false,
      "posted_at": "2026-09-25T11:37:14.069798+00:00",
      "platform": "lemmy"
    },
    {
      "id": "52362225",
      "title": "We live in a society...",
      "body": "",
      "url": "https://lemmy.world/post/52362225",
      "external_url": "https://lemmy.world/pictrs/image/ba5283ec-4a15-480b-9f07-26214e5b56a8.png",
      "community": "lemmyshitpost",
      "community_url": "https://lemmy.world/c/lemmyshitpost",
      "instance": "lemmy.world",
      "author_username": "•••",
      "author_url": "https://lemmy.world/•••",
      "score": 812,
      "upvote_count": 816,
      "downvote_count": 4,
      "comment_count": 91,
      "thumbnail_url": "https://lemmy.world/pictrs/image/31475703-1855-4835-9850-24b1f1849fc8.png",
      "is_nsfw": false,
      "is_locked": false,
      "is_featured": false,
      "posted_at": "2026-09-25T18:47:25.597764+00:00",
      "platform": "lemmy"
    }
  ],
  "count": 20,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 信息流怎么只看一个社区？

做不到，信息流没有任何社区参数。可以先按每行的 `community` 分组，看这批帖子集中在哪些社区，再把选中的社区交给社区资料去读，那边一次能取 200 条。同名社区可能在不同实例上，分组时把 `community` 和 `instance` 两列一起用，才不会把两个社区混成一个。

### `instance` 能填什么？

填实例的域名，例如 lemmy.world，不填也是它；写成带协议的完整地址也行，最后只取主机名。信息流除了它没有别的定位参数，换一个 `instance`，拿到的就是另一个实例入口上的帖子，可以用来对比两个实例上的话题。

### `sort` 的取值怎么选？

`hot` 热门，`active` 活跃，`new` 新帖，`top` 高分，`most_comments` 评论最多，`new_comments` 新评论活动。信息流不传时按 `active`，社区资料和关键词搜索默认是 `hot`。扫最新话题用 `new`，想找讨论还在继续的帖子用 `new_comments`；要看一段时间里的高分帖，`top` 再配 `top_range`，例如 `hour`、`twelvehour` 或 `all`，不传是 `week`。

## Also

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