# X (Twitter) 推文自串 API (twitter.thread)

- Canonical page: https://everyinfra.com/twitter-api/thread
- Endpoint: POST /api/v1/social with {"platform": "twitter", "action": "thread", "params": {...}}
- Price: $0.002153 per call ($2.15 per 1,000 requests); failed and empty results are not charged
- Returns: list, default 100, max 100 per call
- Mode: sync; add "mode": "async" for slow tasks

推文自串按 `url` 读取一条长推文串：传串里任意一条的链接，返回从根帖起这个作者自己连发的帖子。它回答「这个人把一件事分几条讲完」，适合把一串帖子还原成连续的文字，存档一条技术长帖或发布说明的全文，再交给摘要和翻译。每条带正文、点赞、转发和回复数，`reply_to_id` 标出它接着回复的是哪条，`source` 记录发帖客户端。

`url` 可以填 https://x.com/<用户名>/status/<数字 ID>，也可以只填数字帖子 ID；`id` 是它的兼容输入。别人在串里回的内容不属于自串，不在结果里，那些要用评论那一页读。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | 帖子链接 https://x.com/<用户名>/status/<数字 ID>，或数字帖子 ID；可以是自串里的任意一条，返回从根帖起整串作者自己连发的帖子。 |
| id | not declared | no | not declared | url 的兼容输入：数字帖子 ID。 |
| limit | integer (1–100) | no | 100 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | 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 |
| reply_to_id | platform-native meaning |
| source | 发推客户端（如 Twitter for iPhone）；平台没给时没有这个键。 |
| media | 推文图片 / 视频：type（photo / video / animated_gif）、url（图片或视频封面）、width、height、duration_sec（视频秒数）、video_url（码率最高的 mp4）。 |
| author_id | 作者在原平台的唯一 ID。 |
| author_avatar_url | 作者头像图片链接（多数平台带签名、会过期）。 |
| author_bio | platform-native meaning |
| author_is_verified | platform-native meaning |
| author_following_count | platform-native meaning |
| 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": "thread",
  "params": {
    "url": "https://x.com/NASA/status/2082555075759685670"
  }
}'
```

```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": "thread",
        "params": {
            "url": "https://x.com/NASA/status/2082555075759685670",
        },
    },
    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": "thread",
  "results": [
    {
      "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": …,
      "reply_to_id": …,
      "source": …,
      "media": …,
      "author_id": …,
      "author_avatar_url": …,
      "author_bio": …,
      "author_is_verified": …,
      "author_following_count": …,
      "author_created_at": …,
      "author_banner_url": …,
      "platform": …
    }
  ],
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 必须传根帖的链接吗？

不用。串里任意一条的链接或数字 ID 都可以，返回的总是从根帖起整串作者自己连发的帖子。所以从转发或引用里拿到的是串中间的某一条，也能直接读出完整的一串。`conversation_id` 是根推文的 ID，同一串共用它，可以用来核对读到的是不是同一串。

### 超长的串能读完吗？

一次最多 100 条，默认也是 100 条。串更长时，一次调用只能得到其中一部分，做全文还原前要先和原帖对一下条数，别把截到 100 条的结果当成完整的文章。

### 推文自串和用户内容有什么区别？

这一页围绕一条串，从根帖起连着读作者自己发的帖子；用户内容按用户名读一个账号的帖子，不按串组织。这一页的每条里没有话题标签、@ 到的用户和外链这几个字段，要它们，就用用户内容。

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