再次请求机器人的 PDS 使用其已领取的账户代码
POST/me/bots/{did}/switch
参数
| 名称 | 位置 | 类型 | 描述 |
|---|---|---|---|
| did (必填) | path | string | 机器人的 DID,与 `GET /me/bots` 列出的一致。 |
响应
| 状态码 | 描述 | 正文 |
|---|---|---|
| 200 | 切换结果。 | SwitchResult |
| 401 | 令牌缺失、已过期或已撤销(代码 `unauthorized`)。请重新运行 `bsbot login`。 | Error |
| 403 | 令牌缺少 `handles` 范围,或绑定到了单个机器人(`insufficient_scope`)。 | Error |
| 404 | 你的账户中没有这个机器人,或这是机器人的账户代码子域名(API 仅在主站点提供)。 | Error |
| 429 | 已限速:按 IP 的 `publicApi`、按账户的 `creatorApi`,以及针对领取、切换、检查和释放的按账户 `handleChange`(与控制台共享)。 | Error |
| 500 | 意外错误。 | Error |
示例
curl \
-X POST \
-H "Authorization: Bearer $BLUESKY_BOT_TOKEN" \
https://bluesky.bot/api/v1/me/bots/did:plc:yourbot/switch数据结构
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` 一起返回。 |
SwitchOutcome
| 字段 | 类型 | 描述 |
|---|---|---|
| status (必填) | string: "verified", "pending", "manual" | |
| verifiedAt | string, date-time | |
| reason | string: "reauthorize", "pds_refused", "pds_unreachable" |
SwitchResult
| 字段 | 类型 | 描述 |
|---|---|---|
| switch (必填) | SwitchOutcome |