---
title: "修改 Ultra Speed 账号"
canonical_url: "https://tweetstream.io/zh-cn/docs/api/set-ultra-accounts"
last_updated: 2026-11-05
---

# 修改 Ultra Speed 账号

按 handle 为各个账号开启或关闭 Ultra Speed。

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

## `POST /api/ultra/accounts`

`https://api.tweetstream.io/api/ultra/accounts`

## 授权

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

## 请求头

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `Idempotency-Key` | `string`, 必填 | 必填。每次购买或变更生成一个 key，重试时沿用；相同的 key 返回相同的结果。 |

## 请求体

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `changes` | `object[]`, 必填 | an array of at most 100 item(s) |
| `changes.enabled` | `boolean`, 必填 |  |
| `changes.handle` | `string`, 必填 | a string matching the pattern ^@?[A-Za-z0-9_]{1,15}$ |
| `subscriptionId` | `string`, 必填 | a string at most 128 character(s) long |

### 请求体示例

```json
{
  "changes": [
    {
      "enabled": true,
      "handle": "marketdesk"
    }
  ],
  "subscriptionId": "sub_1QExampleUltra"
}
```

## 响应字段

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `accountLimit` | `integer`, 必填 | an integer |
| `accounts` | `object[]`, 必填 |  |
| `accounts.handle` | `string`, 必填 | a string matching the pattern ^@?[A-Za-z0-9_]{1,15}$ |
| `accounts.id` | `string`, 必填 | a string matching the pattern ^[1-9][0-9]{0,19}$ |
| `subscriptionId` | `string`, 必填 |  |
| `results` | `object[]`, 必填 |  |
| `results.enabled` | `boolean`, 必填 |  |
| `results.handle` | `string`, 必填 | a string matching the pattern ^@?[A-Za-z0-9_]{1,15}$ |
| `results.message` | `string` | a string at most 200 character(s) long |
| `results.outcome` | `enum<string>`, 必填 |  |

## 响应

| 状态 | 说明 | 请求头 |
| --- | --- | --- |
| `200` | 成功 |  |
| `400` | 请求无效、验证码错误，或未接受服务条款 |  |
| `401` | API key 缺失或无效，或 setup proof 缺失或已过期 |  |
| `404` | 结账或链接不存在，或账号没有该产品的使用权 |  |
| `409` | 幂等键、结账、优惠或试用冲突 |  |
| `429` | 已达到速率限制或开通额度，请在 retryAfterSeconds 秒后重试 |  |
| `503` | 暂时不可用，请稍后重试 |  |

### 200

```json
{
  "accountLimit": 5,
  "accounts": [
    {
      "handle": "marketdesk",
      "id": "1189745302"
    }
  ],
  "subscriptionId": "sub_1QExampleUltra",
  "results": [
    {
      "enabled": true,
      "handle": "marketdesk",
      "outcome": "applied"
    }
  ]
}
```

### 400

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 401

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 404

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 409

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 429

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

### 503

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "<string>",
    "reason": "not_offered",
    "retryAfterSeconds": 123
  },
  "next": {
    "message": "<string>",
    "action": "call_action",
    "method": "POST",
    "name": "<string>",
    "url": "<string>",
    "who": "agent"
  }
}
```

## 代码示例

### cURL

```bash
curl --request POST \
  --url https://api.tweetstream.io/api/ultra/accounts \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header 'Idempotency-Key: 7c9e6679-7425-40de-944b-e07fc1f90ae7' \
  --header 'Content-Type: application/json' \
  --data '{
  "changes": [
    {
      "enabled": true,
      "handle": "marketdesk"
    }
  ],
  "subscriptionId": "sub_1QExampleUltra"
}'
```

### JavaScript

```javascript
const response = await fetch("https://api.tweetstream.io/api/ultra/accounts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TWEETSTREAM_API_KEY}`,
    "Idempotency-Key": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "changes": [
      {
        "enabled": true,
        "handle": "marketdesk"
      }
    ],
    "subscriptionId": "sub_1QExampleUltra"
  }),
});

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

### Python

```python
import os
import requests

response = requests.post(
    "https://api.tweetstream.io/api/ultra/accounts",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}", "Idempotency-Key": "7c9e6679-7425-40de-944b-e07fc1f90ae7"},
    json={
        "changes": [
            {
                "enabled": True,
                "handle": "marketdesk",
            },
        ],
        "subscriptionId": "sub_1QExampleUltra",
    },
)

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