---
title: Workspace API 参考
description: Platform API v1 的 Workspace：每个操作的路径、参数、请求与回应字段、scope、幂等与错误，直接取自 API 合约。
url: https://agentlab.cresclab.com/docs/zh-cn/api/workspace
language: zh-Hans
updated: 2026-12-05
---

# Workspace API 参考

Platform API v1 的 Workspace：每个操作的路径、参数、请求与回应字段、scope、幂等与错误，直接取自 API 合约。

> [!NOTE]
> 由 API 合约（Agent Lab Platform API 1.0.0-alpha.1）产生。说明文本是合约的英文原文。

The workspace an application is installed in, read as one of its members. Every operation
here names the member with `Agentlab-On-Behalf-Of`, a current member whose sign-in to the
application in this workspace is live, and answers what that member may see in the console; the
path's workspace must be the installation's.

## The acting member's membership and capabilities

`GET /v1/workspaces/{workspaceId}/me`

The member named by `Agentlab-On-Behalf-Of`: their role in the workspace and what that
role lets them do here, as the console reads it. Use it to leave out actions the member
cannot take instead of offering them and being refused.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| 无 | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [WorkspaceMember](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#WorkspaceMember) | The member. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## The workspace's settings

`GET /v1/workspaces/{workspaceId}/settings`

What a member of the workspace reads on its settings page.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `workspace:read` | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [WorkspaceSettings](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#WorkspaceSettings) | The settings. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## Change the workspace's settings

`PATCH /v1/workspaces/{workspaceId}/settings`

Changes only the settings the body names, as the console's settings page saves them; the
others keep their values. Needs a member who may manage the workspace (its owner). A model
the platform does not serve or the workspace's plan does not include, an unknown time zone,
an empty body, or a field this operation does not change (`sandboxPosture`,
`sandboxAvailable`) is refused and nothing changes. A changed `systemPrompt` is a new entry
in the instruction history; the change is recorded in the workspace's audit log as the
acting member's, naming the application. A `gatewayActivityRetentionDays` number deletes
older AI Gateway activity records, as it does when set in the console. The settings carry
no revision: the operation reads the standing settings and saves them whole, so a change
made by someone else while it runs is overwritten with the values it read, for every field,
named or not. A model the workspace's plan no longer includes, kept as `defaultModel`,
refuses every patch that does not name another.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `workspace:write` | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |

### 请求内容

`application/json`: [WorkspaceSettingsPatch](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#WorkspaceSettingsPatch)

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `defaultModel` | `string` | 否 | A model id or capability profile the plan includes; empty uses the platform's default. |
| `systemPrompt` | `string` | 否 | — |
| `requireEvalBeforePublish` | `boolean` | 否 | — |
| `monthlyTokenBudget` | `integer` | 否 | — |
| `rollingWindowTokenBudget` | `integer` | 否 | — |
| `disableAutoToolExecution` | `boolean` | 否 | — |
| `approvalChannelId` | `string` | 否 | Trimmed, then at most 60 characters; empty keeps approvals in the console. |
| `locale` | `string` | 否 | 可用值: `en`, `zh-TW`, `zh-CN`, `ja`, `th`. |
| `auditRetentionDays` | `integer` 或 `null` | 否 | Null keeps every audit record. |
| `gatewayActivityRetentionDays` | `integer` 或 `null` | 否 | Null keeps every AI Gateway activity record; a number deletes older records. |
| `taskFocused` | `boolean` | 否 | — |
| `generalAssistantEnabled` | `boolean` | 否 | — |
| `timeZone` | `string` | 否 | An IANA time zone; empty uses the platform's. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [WorkspaceSettings](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#WorkspaceSettings) | The settings now in force. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `413` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The body is larger than the operation accepts (`PAYLOAD_TOO_LARGE`, `recovery: none`). |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## The history of the workspace's instructions

`GET /v1/workspaces/{workspaceId}/settings/instructions`

Every version of the instructions the workspace adds to every answer (`systemPrompt`),
newest first: what they said, who set them, and when. Needs a member who may manage the
workspace (its owner), as the console's history does.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `workspace:read` | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `cursor` | query | `string` | 否 | The `nextCursor` of the previous page. Opaque. |
| `limit` | query | `integer` | 否 | Items per page. 默认值: `50`. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [InstructionVersionPage](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#InstructionVersionPage) | A page of versions. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## The workspace's products

`GET /v1/workspaces/{workspaceId}/modules`

Which of the platform's products the workspace has turned on, and on which plan, as the
console's navigation reads them. Any member reads it. One answer, not paged.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `workspace:read` | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [WorkspaceModuleList](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#WorkspaceModuleList) | The products. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## The workspace's teams

`GET /v1/workspaces/{workspaceId}/teams`

Every team, oldest first, with the acting member's role in each. The platform lists at
most the first 100 teams of a workspace; `truncated` is true when there are more, on
every page.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `teams:read` | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `cursor` | query | `string` | 否 | The `nextCursor` of the previous page. Opaque. |
| `limit` | query | `integer` | 否 | Items per page. 默认值: `50`. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [TeamPage](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#TeamPage) | A page of teams. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## The workspace's members

`GET /v1/workspaces/{workspaceId}/members`

Every member, as the console's member list shows them, without anyone's identity-provider
subjects. `members:read` is restricted: no installation holds it until the platform has
reviewed the application. The platform lists at most the first 100 members of a
workspace; `truncated` is true when there are more, on every page.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `members:read` | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `cursor` | query | `string` | 否 | The `nextCursor` of the previous page. Opaque. |
| `limit` | query | `integer` | 否 | Items per page. 默认值: `50`. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [MemberPage](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#MemberPage) | A page of members. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## The models the workspace may use

`GET /v1/workspaces/{workspaceId}/models`

The platform's catalog, each model marked whether the workspace's plan includes it (a run
naming one it does not include is refused), the capability profiles the workspace can
choose, and the model each default resolves to. One answer, not paged.

| Scope | 身分 | 验证方式 | Idempotency-Key |
| --- | --- | --- | --- |
| `models:read` | `member` | `installationToken` | — |

### 参数

| 名称 | 位置 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | 是 | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | 是 | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |

### 回应

| 状态码 | 内容 | 说明 |
| --- | --- | --- |
| `200` | `application/json`: [ModelCatalog](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#ModelCatalog) | The catalog. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/zh-cn/api/schemas.md#Error) | Try again later (`recovery: retry`). |
