---
title: "修改账号的 Discord webhook 和关键词过滤"
canonical_url: "https://tweetstream.io/zh-cn/docs/api/update-account-settings"
last_updated: 2026-11-05
---

# 修改账号的 Discord webhook 和关键词过滤

修改一个监控账号的 Discord webhook 和关键词过滤。未提供的字段保留已保存的值。

Canonical URL: https://tweetstream.io/zh-cn/docs/api/update-account-settings

## `PATCH /api/account-settings`

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

## 授权

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

## 请求体

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `account` | `string`, 必填 |  |
| `discordWebhook` | `string \| null` | A `https://discord.com/api/webhooks/...` or `https://discordapp.com/api/webhooks/...` URL, or `null` to use the global webhook. |
| `keywords` | `string[]` | Skip this account's posts whose text contains any of these words. |

### 请求体示例

```json
{
  "account": "marketdesk",
  "keywords": [
    "solana",
    "etf"
  ]
}
```

## 响应字段

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `account` | `string`, 必填 |  |
| `discordWebhook` | `string \| null`, 必填 |  |
| `keywords` | `string[]`, 必填 |  |

## 响应

| 状态 | 说明 | 请求头 |
| --- | --- | --- |
| `200` | 成功 |  |
| `400` | 请求无效 |  |
| `401` | API key 缺失或无效 |  |
| `403` | 已认证的账号无法使用此功能 |  |
| `404` | 找不到请求的资源 |  |
| `500` | 请求未能完成 |  |

### 200

```json
{
  "account": "<string>",
  "discordWebhook": "<string>",
  "keywords": [
    "<string>"
  ]
}
```

### 400

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

### 401

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

### 403

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

### 404

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

### 500

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

## 代码示例

### cURL

```bash
curl --request PATCH \
  --url https://api.tweetstream.io/api/account-settings \
  --header "Authorization: Bearer $TWEETSTREAM_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "account": "marketdesk",
  "keywords": [
    "solana",
    "etf"
  ]
}'
```

### JavaScript

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

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

### Python

```python
import os
import requests

response = requests.patch(
    "https://api.tweetstream.io/api/account-settings",
    headers={"Authorization": f"Bearer {os.environ['TWEETSTREAM_API_KEY']}"},
    json={
        "account": "marketdesk",
        "keywords": [
            "solana",
            "etf",
        ],
    },
)

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