> ## Documentation Index
> Fetch the complete documentation index at: https://docs.molesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 选择工作区

> 切换当前组织，并获取限定在该组织范围内的 Token。

```http theme={null}
POST /api/v1/orgs/{id}/select
```

把已登录用户切换到其所属的另一个组织，并返回限定在该组织范围内的新登录 Token。响应的结构与[登录](https://docs.molesignal.com/zh-Hans/api/auth/login.md)相同，对受保护的 `_sys` 范围还会多出 `"system": true`。平台管理员可以选择 `_sys` 组织，[轮换 JWT 签名密钥](https://docs.molesignal.com/zh-Hans/api/auth/rotate-jwt.md)这类平台级调用需要它。

**路径参数**

| 参数 | 类型 | 说明 |
| - | - | - |
| `id` | string | `GET /api/v1/orgs` 返回的组织 id。 |

```bash cURL theme={null}
curl -X POST http://localhost:5080/api/v1/orgs/<organization-id>/select \
  -H "authorization: Bearer $MS_JWT"
```

```json 200 theme={null}
{
  "token": "eyJhbGciOi...",
  "user_id": "<user-id>",
  "org_id": "<organization-id>",
  "org_name": "default",
  "display_role": "Owner",
  "roles": [
    { "id": "<role-id>", "key": "owner", "name": "Owner", "builtin": true }
  ]
}
```

后续请求使用返回的 Token。之前的 Token 在过期之前，仍可在原来的组织中继续使用。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.