為你的某個機械人領取帳號代碼並切換過去
POST/me/bots/{did}/claim
採用控制台本身的規則:格式、保留名稱、冒犯性字詞、可用性(由唯一索引保障)、已釋出帳號代碼的寬限期。接着立即在 Bluesky 上切換機械人的帳號代碼;`switch` 會說明結果。為已有帳號代碼的機械人變更帳號代碼,會釋出舊的帳號代碼。
請求主體: ClaimRequest
參數
| 名稱 | 位置 | 類型 | 說明 |
|---|---|---|---|
| did (必填) | path | string | 機械人的 DID,與 `GET /me/bots` 列出的相同。 |
回應
| 狀態碼 | 說明 | 內容 |
|---|---|---|
| 200 | 已領取的帳號代碼與切換結果。 | ClaimResult |
| 400 | 請求內容格式錯誤(`bad_request`),或名稱不被允許(`invalid_handle`,附 `reason`)。 | Error |
| 401 | 權杖遺失、已過期或已撤銷(代碼 `unauthorized`)。請重新執行 `bsbot login`。 | Error |
| 403 | 機械人已被停權(`forbidden`),或權杖缺少 `handles` 範圍或已綁定到單一機械人(`insufficient_scope`)。 | Error |
| 404 | 你的帳號中沒有這個機械人,或這是機械人的帳號代碼子網域(API 僅在主站提供)。 | Error |
| 409 | 另一個機械人持有此帳號代碼,或它正處於寬限期(`conflict`,原因 `taken`)。 | Error |
| 429 | 已達速率限制:`publicApi` 依 IP、`creatorApi` 依帳號,而領取、切換、檢查和釋出則適用依帳號計算的 `handleChange`(與控制台共用)。 | Error |
| 500 | 未預期的錯誤。 | Error |
範例
curl \
-X POST \
-H "Authorization: Bearer $BLUESKY_BOT_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"weather"}' \
https://bluesky.bot/api/v1/me/bots/did:plc:yourbot/claim結構描述
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`。 |
ClaimRequest
| 欄位 | 類型 | 說明 |
|---|---|---|
| name (必填) | string | 名稱部分,例如 `weather.bluesky.bot` 中的 `weather`。 |
SwitchOutcome
| 欄位 | 類型 | 說明 |
|---|---|---|
| status (必填) | string: "verified", "pending", "manual" | |
| verifiedAt | string, date-time | |
| reason | string: "reauthorize", "pds_refused", "pds_unreachable" |
ClaimResult
| 欄位 | 類型 | 說明 |
|---|---|---|
| handle (必填) | string | |
| switch (必填) | SwitchOutcome |