更新機械人的目錄資訊
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:沒有寫入任何內容。 |