# X (Twitter) 关注列表 API (twitter.following_list)

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

X（Twitter）关注列表按 `username` 读取这个账号关注的可见账号，每行有用户名、显示名、所在地、粉丝数、发帖数、注册时间和认证标识。它回答「这个账号在看谁」：研究人员用它梳理某个圈子的信息网络，行业分析用它追踪关键人物新关注了哪些公司和人。

定期读同一个账号的关注列表、比对前后两次，就能看出新增和取消的关注。`username` 只认短名，带不带 @ 都可以，主页链接不行。不传 `limit` 时读 200 行，最多 2000 行；读到的是平台上看得见的那部分关注，不一定是全部。每行的 `follower_count` 能分出它关注的是大号还是小号，`created_at` 能看出关注的多是新号还是老号。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| username | not declared | yes | not declared | X 用户短名，可带 @，不要填完整主页 URL。profile 从最近帖子内的作者信息整理资料；followers_list 与 following_list 分别读取可见粉丝和关注账号，不保证完整关系网。 |
| limit | integer (1–2000) | no | 200 | 这次调用最多返回的条数，整数，1–2000；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| username | 用户名（@handle）。 |
| url | 该记录在原平台上的可访问链接。 |
| name | 名称。用于账号/商品/商家类能力，指该对象本身的名字。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| location | 地理位置描述，原文透传，格式随平台而异。 |
| avatar_url | 头像图片链接。部分平台给的是带尺寸参数的 CDN 链接，可能有时效。 |
| follower_count | 粉丝数。null 表示不公开，不等于 0。 |
| following_count | 关注数。null 表示不公开，不等于 0。 |
| post_count | 发布内容总数。null 表示不公开，不等于 0。 |
| is_verified | 是否为平台认证账号（蓝V等）。null 表示无法判定。 |
| is_protected | 账号是否为受保护状态（推文仅粉丝可见）。 |
| created_at | 创建时间，格式同 posted_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": "twitter",
  "action": "following_list",
  "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": "following_list",
        "params": {
            "username": "nasa",
        },
    },
    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 115. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "twitter",
  "action": "following_list",
  "results": [
    {
      "id": "•••",
      "username": "•••",
      "url": "https://x.com/•••",
      "name": "•••",
      "text": "Serving President Donald J. Trump as the 16th @NASA Deputy Administrator | Working alongside @••• to lead the next Golden Age of space discovery 🚀",
      "avatar_url": "https://pbs.twimg.com/•••",
      "follower_count": 5417,
      "following_count": 6,
      "post_count": 64,
      "is_verified": false,
      "is_protected": false,
      "created_at": "Thu May 14 18:55:50 +0000 2026",
      "platform": "twitter"
    },
    {
      "id": "•••",
      "username": "•••",
      "url": "https://x.com/•••",
      "name": "•••",
      "text": "@••• astronaut. Artemis II crewmember | Astronaute @••• Membre de l’équipage d’Artemis II",
      "location": "•••",
      "avatar_url": "https://pbs.twimg.com/•••",
      "follower_count": 149812,
      "following_count": 155,
      "post_count": 2844,
      "is_verified": false,
      "is_protected": false,
      "created_at": "Tue Aug 09 14:55:39 +0000 2011",
      "platform": "twitter"
    }
  ],
  "count": 115,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 关注列表和粉丝列表能互相代替吗？

不能，方向相反。关注列表是这个账号主动关注的人，体现它的兴趣和信息来源；粉丝列表是关注它的人，体现它的受众。两者请求都只要 `username`，返回列也相同，存数据时要标明来自哪一边。想做互相关注分析，两页各读一次，用 `id` 取交集即可。名单超过 2000 行时两边都只读到一部分，交集也会跟着偏小。

### 怎么发现一个账号新关注了谁？

每隔一段时间读一次，把名单按 `id` 存下来，和上一次比对：新出现的 `id` 就是新增关注，消失的就是取消关注。`id` 是原平台上的唯一标识，存名单时以它为键。两次读取要用同样的 `limit`，否则名单长度不同，会把没读到的账号误判成取消关注。名单触到 2000 行的上限时，新增和消失的判断也都不完整。`created_at` 是账号的注册时间，名单里没有关注发生的时间。

### `is_protected` 为 true 的账号是什么？

受保护账号，推文只有它的粉丝能看到。这类账号出现在名单里，说明关注关系存在，后续分析时可以先单独列出。统计时可以按 `is_protected` 把名单分成公开和受保护两组，再分别比较 `post_count` 和 `follower_count`，缺值的行单独计数，别按 0 算进平均。

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