X (Twitter) 列表里的帖子 API
接口健康状态
- 24h 健康值
- 正常
- 健康 / 正常
- 可用
24 小时趋势
30 天趋势
列表里的帖子:返回列表,每次一页、每页最多 20 条,条数不固定(短页不代表到底),要更多就把响应顶层的 next_page_token 作为 page_token 再调,没有 next_page_token 才是到底;limit 照收但不起作用;主要字段 id、url、text、like_count、retweet_count、reply_count。支持翻页:把响应里的 next_page_token 作为 page_token 传回拿下一页,其他参数不变,每页算一次调用。
请求发到 POST https://api.everyinfra.com/api/v1/social,platform 填 twitter,action 填 list_posts。 单价 $0.56 / 千次(每次 $0.000556),失败和空结果都不收费。 同步返回;慢任务可在请求体加 "mode": "async",先拿 job_id 再轮询。
AI 提示词
#请帮我用 EveryInfra 的「X (Twitter) 列表里的帖子」接口(twitter/list_posts)写一个数据采集脚本。
接口约定:
- 请求:POST https://api.everyinfra.com/api/v1/social,请求头 Authorization: Bearer <API Key>;Key 从环境变量 EVERYINFRA_API_KEY 读取,不要写进代码。
- 请求体里 platform 填 twitter,action 填 list_posts,参数放在 params 里。
- 必填参数:
- list_id:X 列表(List)的数字编号,即 x.com/i/lists/ 后的数字,也可填列表链接;返回列表成员发的帖子,从新到旧,成员转发的帖子也在内,每页 20 条。列表不存在或是私密列表时返回空结果,不收费。
- 可选参数:
- page_token:翻页令牌:把上一次响应里的 next_page_token 原样传回,拿下一页;不传从第一页开始。令牌 24 小时有效,每页算一次调用。
- 返回一组记录,每条记录的主要字段:id、url、text、like_count、retweet_count(转发数)、reply_count、view_count、posted_at、author_username、author_name、author_url、author_follower_count;一共 33 个字段,完整列表见 https://api.everyinfra.com/api/v1/social/catalog?platform=twitter。
- 示例请求体:
{
"platform": "twitter",
"action": "list_posts",
"params": {
"list_id": "84839422"
}
}
- 计费:$0.56 / 千次;失败和空结果不扣费。
- 一次要采几十上百个时,在请求体加 "mode": "async":先拿到 job_id,再轮询 GET https://api.everyinfra.com/api/v1/jobs/{job_id} 取结果。
- 返回 422 时,按错误信息里的候选参数和允许值修正;返回 429 或 503 时,按 Retry-After 等待后重试。
写代码前,先问清楚我要采哪些对象、一共多少个、需要哪些字段、结果存成什么格式,再把方案和大概花费讲给我确认。请求参数
#| 参数名 | 位置 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|---|
Authorization | header | string | 是 | - | Bearer 加你的 API Key。在控制台创建;不要放进网址或代码仓库。 |
platform | body | string | 是 | twitter | 平台标识,固定值。 |
action | body | string | 是 | list_posts | 能力标识,固定值。 |
list_id | body.params | string | 是 | - | X 列表(List)的数字编号,即 x.com/i/lists/ 后的数字,也可填列表链接;返回列表成员发的帖子,从新到旧,成员转发的帖子也在内,每页 20 条。列表不存在或是私密列表时返回空结果,不收费。 |
page_token | body.params | string | 否 | - | 翻页令牌:把上一次响应里的 next_page_token 原样传回,拿下一页;不传从第一页开始。令牌 24 小时有效,每页算一次调用。 |
代码示例
#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": "list_posts",
"params": {
"list_id": "84839422"
}
}'OpenAPI 定义 (JSON)示例从环境变量 EVERYINFRA_API_KEY 读取 Key,复制出去的代码不含你的 Key。
响应示例
#{ "id": "req_…", "platform": "twitter", "action": "list_posts", "results": [ { "id": "•••", "url": "https://x.com/santiagomed/status/2123956145698042132", "text": "New on the X API: IP allowlisting.\n\nChoose exactly which IP addresses can use your API keys. If a key ever leaks, calls from anywhere else get blocked. One list covers all your apps.\n\nTurn it on in the Developer Console under Settings > IP allowlist.\n\nDocs: https://docs.x.com/fun…", "like_count": 47, "retweet_count": 5, "reply_count": 5, "view_count": 2555, "posted_at": "2026-11-21T01:46:20+00:00", "author_username": "s•••d", "author_name": "S•••o", "author_url": "https://x.com/•••", "author_follower_count": 5530, "quote_count": 1, "bookmark_count": 13, "language": "en", "conversation_id": "2123956145698042132", "is_reply": false, "is_quote": false, "is_repost": true, "author_id": "•••", "author_avatar_url": "https://pbs.twimg.com/•••", "author_bio": "•••", "author_is_verified": true, "platform": "twitter", "reposted_by": "XDevelopers", "reposted_at": "2026-11-21T01:46:54+00:00" }, { "id": "•••", "url": "https://x.com/Sports/status/2123943867280241125", "text": "BIIIIIIG NIGHT OF BASKETBALL\n\nTime to tap in 👇💥 https://x.com/i/nba?page=home", "like_count": 9, "retweet_count": 2, "reply_count": 2, "view_count": 18267, "posted_at": "2026-11-21T00:57:33+00:00", "author_username": "S•••s", "author_name": "S•••s", "author_url": "https://x.com/•••", "author_follower_count": 13809487, "quote_count": 0, "bookmark_count": 0, "language": "en", "conversation_id": "2123943867280241125", "is_reply": false, "is_quote": false, "is_repost": false, "links": [ "https://x.com/i/nba?page=home" ], "author_id": "•••", "author_avatar_url": "https://pbs.twimg.com/•••", "author_bio": "•••", "author_is_verified": true, "platform": "twitter" } ], "next_page_token": …, "pagination": { … }, "count": 20, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
返回字段
#业务数据在 results 里;下表是每条记录可能包含的字段,平台没有提供的值不会被编造。
| 字段 | 含义 |
|---|---|
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 | 保留平台原语义 |
bookmark_count | 书签(收藏)数。 |
language | 内容语言代码(如 zh、en),由平台判定,可能不准。 |
conversation_id | 所属对话串 ID(根推文 ID),同一串的回复据此归在一起。 |
is_reply | 保留平台原语义 |
is_quote | 是否引用推文。 |
is_repost | 保留平台原语义 |
reply_to_id | 保留平台原语义 |
reply_to_user_id | 所回复用户的数字 ID。 |
reply_to | 保留平台原语义 |
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 | 保留平台原语义 |
author_is_verified | 保留平台原语义 |
author_created_at | 保留平台原语义 |
platform | 数据来源平台标识,与请求里的 platform 一致(如 xiaohongshu、tiktok)。 |
reposted_by | 转发这条帖子的账号(用户名);这一行本身是被转发的原帖。不是转发进来的行没有这个字段。 |
reposted_at | 转发的时间。不是转发进来的行没有这个字段。 |
错误与计费
#- 401
- 缺少 Key 或 Key 无效。
- 402
- 余额不足,先充值。
- 422
- 参数名或取值不对,按错误信息给的候选改;不扣费。
- 429
- 超过每分钟请求上限,按 Retry-After 等待后再试。
- 503
- 暂时无法完成,预扣的费用退回;结果未知时先核对,不要直接重发。
- 200 空结果
- 没有数据,不扣费。
官方资料参照
#只用于核对对象与术语,不表示平台对 EveryInfra 的授权或背书。
- X 帮助中心:如何使用列表(Lists) ↗
X 帮助中心说明打开一个列表会看到列表里收录的账号发的帖子组成的时间线,列表可以分享链接、被别人关注。可证明「列表」和「列表里的帖子」是 X 的官方对象;不证明本接口的排序、每页条数或能取全。
核对于 2026-11-21
- X API:列表里的帖子(Get List Posts) ↗
X 官方 API 文档有按列表 ID 取列表帖子的 Get List Posts。可证明列表由数字 ID 定位、可按 ID 取帖子;不证明本接口和官方接口的字段或覆盖一致。
核对于 2026-11-21