更新机器人的目录信息
PATCH/me/bots/{did}/listing
只有发送的字段会改变;在 `operator` 和 `disclosure` 中,只有发送的键会改变。`null` 会清除字段;列表会替换已保存的列表。适用控制台自身的规则,要么全部保存,要么全不保存:只要有一个字段被拒绝,就不会保存任何内容。与已保存值相同的修改不会写入任何内容(`changed: false`)。需要 `listing` 范围。
请求正文: BotListingPatch
参数
| 名称 | 位置 | 类型 | 描述 |
|---|---|---|---|
| did (必填) | path | string | 机器人的 DID,与 `GET /me/bots` 列出的一致。 |
响应
| 状态码 | 描述 | 正文 |
|---|---|---|
| 200 | 更新后的目录信息,以及是否有任何变更。 | BotListingUpdate |
| 400 | 不是 JSON 对象,或包含未知字段(`bad_request`,附带 `parameter`);或有被拒绝的值(`invalid_listing`,附带 `field`,例如 `usage[1].example`,以及 `reason`,即控制台规则的代码,例如 `too_long`、`link`、`unknown_category`、`cleared_by_admin`)。 | Error |
| 401 | 令牌缺失、已过期或已撤销(代码 `unauthorized`)。请重新运行 `bsbot login`。 | Error |
| 403 | 令牌缺少 `listing` 范围(`insufficient_scope`,附带 `scope` 和 `WWW-Authenticate` 质询):这是在该范围出现之前签发的 CLI 令牌。请重新运行 `bsbot login`。 | Error |
| 404 | 你的账户中没有这个机器人,或这是机器人的账户代码子域名(API 仅在主站点提供)。 | Error |
| 429 | 已达到速率限制:`publicApi` 按 IP 计算,`creatorApi` 按账户计算,`botSettings` 也按账户计算(每小时 30 次修改,与控制台共用)。 | Error |
| 500 | 意外错误。 | Error |
示例
curl \
-X PATCH \
-H "Authorization: Bearer $BLUESKY_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"category":"weather"}' \
https://bluesky.bot/api/v1/me/bots/did:plc:yourbot/listing数据结构
Error
| 字段 | 类型 | 描述 |
|---|---|---|
| error (必填) | object | |
| error.code (必填) | string: "bad_request", "invalid_handle", "not_found", "rate_limited", "internal_error", "unauthorized", "forbidden", "conflict", "invalid_grant", "upstream_error", "insufficient_scope", "invalid_listing", "consent_required" | |
| error.message (必填) | string | |
| error.reason | string | 用于 `invalid_handle`、`invalid_listing`、`conflict` 和 `forbidden`:例如 `reserved`、`taken`、`too_long`、`no_handle`、`suspended`。 |
| error.url | string, uri | 用于 consent_required:打开此控制台页面以授权编辑个人资料。 |
| error.field | string | 用于 `invalid_listing`:被拒绝的字段。 |
| error.scope | string | 用于 `insufficient_scope`:令牌缺少的范围。 |
| error.parameter | string | 无效的查询参数。 |
| error.retryAfterSeconds | integer (1–) | 与 `rate_limited` 一起返回。 |
BotUsageLine
| 字段 | 类型 | 描述 |
|---|---|---|
| kind (必填) | string: "mention", "follow", "dm" | `mention`:用 `example` 提及机器人;`follow`:关注机器人;`dm`:给它发送私信。 |
| description (必填) | string | 机器人的用途,一行纯文本。 |
| example | string | 仅用于提及行(提及行始终有此字段):帖文中跟在 `@handle` 后面的文字。绝不是链接或其他提及。 |
BotListing
| 字段 | 类型 | 描述 |
|---|---|---|
| listed (必填) | boolean | 显示在公开目录中。 |
| category (必填) | string | null: "news", "art", "utility", "fun", "weather", "dev", "ai", "other", null | |
| description (必填) | string | null | 简短的公开摘要。发布时必须提供非空白的描述;已列入目录时清除描述会被拒绝(required_for_listing)。如需清除,请在同一次修改中将其移出目录。 |
| languages (必填) | string: "en", "ja", "pt", "es", "fr", "de", "it", "nl", "ko", "zh", "ru", "uk", "pl", "tr", "ar", "fa", "he", "hi", "id", "th", "vi", "sv", "ca", "eo"[] | 创作者声明的语言,主要语言排在第一位(BCP-47 主语言代码)。 |
| showRecentPosts (必填) | boolean | 机器人页面显示其最新帖文。 |
| operator (必填) | object | 运营者信息行及其是否显示。 |
| operator.name (必填) | string | null | |
| operator.shown (必填) | boolean | |
| usage (必填) | BotUsageLine[] | |
| sourceUrl (必填) | string | null | |
| openSource (必填) | boolean | |
| supportUrl (必填) | string | null | |
| disclosure (必填) | object | |
| disclosure.purpose (必填) | string | null | |
| disclosure.contact (必填) | string | null | 一个 https 链接、写成 `@handle` 的 Bluesky 账户代码,或一个电子邮箱地址。这个需要身份验证的端点返回可编辑的地址,绝不返回经过混淆处理的公开显示内容。 |
| disclosure.contactEmailPublic (必填) | boolean | 明确同意公开电子邮箱联系方式;设置新地址时必须为 true。清除 contact 即可撤回同意。 |
| disclosure.usesGenerativeAi (必填) | boolean | null | 选择 AI 分类或发布 AI 目录信息时,必须设为 true 或 false。false 是有效值;过去未知的回答保持为 null。分类和信息披露的变更会在同一次操作中一并检查。 |
| disclosure.automationLevel (必填) | string | null: "automated", "collaborative", "assisted", null | |
| disclosure.activities (必填) | string: "scheduled_posts", "event_posts", "replies_to_mentions"[] |
BotListingPatch
| 字段 | 类型 | 描述 |
|---|---|---|
| listed | boolean | 显示在公开目录中。 |
| category | string | null: "news", "art", "utility", "fun", "weather", "dev", "ai", "other", "", null | |
| description | string | null | 简短的公开摘要。发布时必须提供非空白的描述;已列入目录时清除描述会被拒绝(required_for_listing)。如需清除,请在同一次修改中将其移出目录。 |
| languages | array | null | 创作者声明的语言,主要语言排在第一位(BCP-47 主语言代码)。 |
| showRecentPosts | boolean | 机器人页面显示其最新帖文。 |
| operator | object | 运营者信息行及其是否显示。 |
| operator.name | string | null | |
| operator.shown | boolean | |
| usage | array | null | |
| sourceUrl | string | null | |
| openSource | boolean | |
| supportUrl | string | null | |
| disclosure | object | |
| disclosure.purpose | string | null | |
| disclosure.contact | string | null | 一个 https 链接、写成 `@handle` 的 Bluesky 账户代码,或一个电子邮箱地址。这个需要身份验证的端点返回可编辑的地址,绝不返回经过混淆处理的公开显示内容。 |
| disclosure.contactEmailPublic | boolean | 明确同意公开电子邮箱联系方式;设置新地址时必须为 true。清除 contact 即可撤回同意。 |
| disclosure.usesGenerativeAi | boolean | null | 选择 AI 分类或发布 AI 目录信息时,必须设为 true 或 false。false 是有效值;过去未知的回答保持为 null。分类和信息披露的变更会在同一次操作中一并检查。 |
| disclosure.automationLevel | string | null: "automated", "collaborative", "assisted", null | |
| disclosure.activities | array | null |
BotListingUpdate
| 字段 | 类型 | 描述 |
|---|---|---|
| listing (必填) | BotListing | |
| changed (必填) | boolean | 发送的每个值都与已保存的值相同时为 false:没有写入任何内容。 |