---
title: "添加监控账号"
canonical_url: "https://tweetstream.io/zh-cn/docs/api/add-accounts"
last_updated: 2026-11-05
---

# 添加监控账号

添加一个或多个要监控的 X/Twitter 账号。

Canonical URL: https://tweetstream.io/zh-cn/docs/api/add-accounts

## `POST /api/add-account`

`https://api.tweetstream.io/api/add-account`

## 授权

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `Authorization` | `string`, 必填 | 使用 TweetStream API 密钥进行 Bearer 认证：`Bearer <key>`。 |

## 请求体

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `accounts` | `string \| string[]`, 必填 |  |

### 请求体示例

```json
{
  "accounts": [
    "marketdesk",
    "realDonaldTrump"
  ]
}
```

## 响应字段

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `action` | `enum<string>`, 必填 |  |
| `error` | `string \| null`, 必填 |  |
| `requestId` | `string`, 必填 |  |
| `results` | `object[]`, 必填 |  |
| `results.input` | `string`, 必填 |  |
| `results.message` | `string` |  |
| `results.state` | `enum<string>`, 必填 |  |
| `summary` | `object`, 必填 |  |
| `summary.failed` | `integer`, 必填 |  |
| `summary.succeeded` | `integer`, 必填 |  |
| `summary.total` | `integer`, 必填 |  |

## 响应

| 状态 | 说明 | 请求头 |
| --- | --- | --- |
| `200` | 成功 |  |
| `207` | 部分账号操作成功，部分失败 |  |
| `400` | 请求无效 |  |
| `401` | API key 缺失或无效 |  |
| `403` | 已认证的账号无法使用此功能 |  |
| `429` | handle 请求过多 | `Retry-After` |
| `500` | 请求未能完成 |  |
| `503` | 账号管理暂时不可用 |  |

### 200

```json
{
  "action": "follow",
  "error": "<string>",
  "requestId": "<string>",
  "results": [
    {
      "input": "<string>",
      "message": "<string>",
      "state": "added"
    }
  ],
  "summary": {
    "failed": 0,
    "succeeded": 0,
    "total": 0
  }
}
```

### 207

```json
{
  "action": "follow",
  "error": "<string>",
  "requestId": "<string>",
  "results": [
    {
      "input": "<string>",
      "message": "<string>",
      "state": "added"
    }
  ],
  "summary": {
    "failed": 0,
    "succeeded": 0,
    "total": 0
  }
}
```

### 400

```json
{
  "error": "<string>"
}
```

### 401

```json
{
  "error": "<string>"
}
```

### 403

```json
{
  "error": "<string>"
}
```

### 429

```json
{
  "action": "follow",
  "error": "<string>",
  "requestId": "<string>",
  "results": [
    {
      "input": "<string>",
      "message": "<string>",
      "state": "added"
    }
  ],
  "summary": {
    "failed": 0,
    "succeeded": 0,
    "total": 0
  }
}
```

### 500

```json
{
  "error": "<string>"
}
```

### 503

```json
{
  "action": "follow",
  "error": "<string>",
  "requestId": "<string>",
  "results": [
    {
      "input": "<string>",
      "message": "<string>",
      "state": "added"
    }
  ],
  "summary": {
    "failed": 0,
    "succeeded": 0,
    "total": 0
  }
}
```

## 代码示例

### cURL

```bash
curl --request POST \
  --url https://api.tweetstream.io/api/add-account \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "accounts": [
    "marketdesk",
    "realDonaldTrump"
  ]
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.tweetstream.io/api/add-account", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "accounts": [
      "marketdesk",
      "realDonaldTrump"
    ]
  }),
});

console.log(response.status, await response.json());
```

### Python

```python
import os
import requests

response = requests.post(
    "https://api.tweetstream.io/api/add-account",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}"},
    json={
        "accounts": [
            "marketdesk",
            "realDonaldTrump",
        ],
    },
)

print(response.status_code, response.json())
```
