# X (Twitter) 回复帖子 API (twitter.user_replies)

- Canonical page: https://everyinfra.com/twitter-api/user_replies
- Endpoint: POST /api/v1/social with {"platform": "twitter", "action": "user_replies", "params": {...}}
- Price: $0.000806 per call ($0.81 per 1,000 requests); failed and empty results are not charged
- Returns: list, one page of up to 30 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

填一个账号的 `username`（短名或主页链接），X 回复帖子会翻出它主页「回复」标签页里本人发的内容，按时间由近及远，每条除了正文和互动计数，还带 `reply_to_id`（回的是哪条帖子）和 `conversation_id`（整串对话的编号）。它回答「这个人平时在和谁对话、怎么回应别人」：品牌可以复盘客服号的公开答复，研究者可以观察一位意见领袖在评论区里的立场，这些内容在普通的发帖列表里看不到。

正文里的话题标签、@ 到的人和外链分别拆进 `hashtags`、`mentions`、`links`，统计时不用自己解析正文。一页最多 30 条，条数不固定，用 `page_token` 往下翻，令牌 24 小时内有效；`limit` 不起作用。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | X 用户短名，可带 @，也可填主页链接；取这个账号主页「回复」页里本人发的帖子（多数是回复，也含本人的普通帖子）。 |
| page_token | not declared | no | not declared | 翻页令牌：把上一次响应里的 next_page_token 原样传回，拿下一页；不传从第一页开始。令牌 24 小时有效，每页算一次调用。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| next_page_token | platform-native meaning |
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| retweet_count | 转发数。 |
| reply_count | 回复数，通常用于评论的子回复。null 表示不公开。 |
| view_count | 浏览/播放数。null 表示不公开，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| author_name | 作者昵称（显示名）。 |
| author_url | 作者在原平台的主页链接。 |
| author_follower_count | 作者粉丝数。null 表示不公开。 |
| quote_count | platform-native meaning |
| bookmark_count | 书签（收藏）数。 |
| language | 内容语言代码（如 zh、en），由平台判定，可能不准。 |
| conversation_id | 所属对话串 ID（根推文 ID），同一串的回复据此归在一起。 |
| is_reply | platform-native meaning |
| is_quote | 是否引用推文。 |
| is_repost | platform-native meaning |
| is_pinned | platform-native meaning |
| reply_to_id | platform-native meaning |
| media | 推文图片 / 视频：type（photo / video / animated_gif）、url（图片或视频封面）、width、height、duration_sec（视频秒数）、video_url（码率最高的 mp4）。 |
| hashtags | 正文里的话题标签数组，按出现顺序；没有时不出现这个字段。 |
| mentions | 正文里 @ 到的用户名。 |
| links | 正文里的外链（展开后的完整网址）。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_avatar_url | 作者头像图片链接（多数平台带签名、会过期）。 |
| author_bio | platform-native meaning |
| author_is_verified | platform-native meaning |
| author_following_count | platform-native meaning |
| author_post_count | 作者推文总数。 |
| author_media_count | 作者发过的媒体数。 |
| author_created_at | platform-native meaning |
| author_banner_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": "twitter",
  "action": "user_replies",
  "params": {
    "username": "nasa"
  }
}'
```

```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": "twitter",
        "action": "user_replies",
        "params": {
            "username": "nasa",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "twitter",
  "action": "user_replies",
  "results": [
    {
      "next_page_token": …,
      "id": …,
      "url": …,
      "text": …,
      "like_count": …,
      "retweet_count": …,
      "reply_count": …,
      "view_count": …,
      "posted_at": …,
      "author_username": …,
      "author_name": …,
      "author_url": …,
      "author_follower_count": …,
      "quote_count": …,
      "bookmark_count": …,
      "language": …,
      "conversation_id": …,
      "is_reply": …,
      "is_quote": …,
      "is_repost": …,
      "is_pinned": …,
      "reply_to_id": …,
      "media": …,
      "hashtags": …,
      "mentions": …,
      "links": …,
      "author_id": …,
      "author_avatar_url": …,
      "author_bio": …,
      "author_is_verified": …,
      "author_following_count": …,
      "author_post_count": …,
      "author_media_count": …,
      "author_created_at": …,
      "author_banner_url": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 结果里为什么看不到被回复的原帖？

这里只收这个账号自己发的帖子，被回复的原帖不在结果里。需要原帖时，把 `reply_to_id` 交给单条内容那一页；想把一整串讨论串起来，按 `conversation_id` 归组即可，同一串对话里的回复共用这个编号。同一串里别人的回复不会出现，所以只靠这一页还原不出完整对话。`conversation_id` 是根推文的 ID，交给评论那一页，能补回根帖下的一部分评论。

### 列表里混着普通帖子正常吗？

正常。「回复」标签页本身就会夹带这个账号的普通发帖，所以结果里也有。用 `is_reply` 区分：为真的是回复，为假的是普通帖子；`is_quote` 和 `is_repost` 另外标出引用帖和转发。只想留下回复，把 `is_reply` 为假的行丢掉即可；转发不算回复，置顶帖 `is_pinned` 在统计回复习惯时也可以一并排除。话题标签字段只在正文带标签时才出现，缺这个键就当作没有标签处理。

### 怎么判断回复有没有人看、最常 @ 谁？

`view_count` 是这条回复的浏览量，`like_count`、`reply_count`、`retweet_count` 是互动数。评论区里的回复曝光一般远低于主帖，和同一账号的主帖放在一起比较时，先按 `is_reply` 分组再算平均，结论才公平。想知道它最常 @ 谁，按 `mentions` 里的用户名计数；`links` 是展开后的完整网址，客服号在回复里贴过哪些帮助链接，按域名一数就清楚。看什么时段爱回复，把 `posted_at` 换成本地时区再分组。

## Also

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