Crescendo Lab 文件
正體中文
註冊開始用

Account API 參考

Platform API v1 的 Account:每個操作的路徑、參數、請求與回應欄位、scope、冪等與錯誤,直接取自 API 合約。

最後更新

由 API 合約(Agent Lab Platform API 1.0.0-alpha.1)產生。說明文字是合約的英文原文。

The signed-in person, across workspaces. The workspace operations here are account-level (x-agentlab-principal: account): they happen before any installation exists, so they are called with the person's own sign-in token for the application, carrying the account-level scopes workspaces:read or workspaces:create that the person approved when they signed in. The application declares those scopes as it declares any other, and workspaces:create needs Agent Lab's review first. These scopes reach these operations and nothing inside a workspace, where only an installation's token is accepted; an installation's token is refused here.

The signed-in person's profile#

GET /v1/account/profile

Reachable by an operators' own application from its registered page origin with the person's access token (Origin names that page), or by the console with its session cookie. A bearer token sent without that origin is read as a console request and needs the cookie.

Scope身分驗證方式Idempotency-Key
無—personToken, consoleSession—

回應

狀態碼內容說明
200application/json: objectThe profile.
401application/json: LegacyErrorStringauthenticationRequired.
403application/json: LegacyErrorStringoriginNotAllowed: the origin is neither the console's nor the application's.
503application/json: LegacyErrorString 或 ErrorauthenticationUnavailable, or the API contract could not be read (Error).

200 application/json

欄位型別必填說明
profileobject是—
profile.accountIdstring是The opaque account key, never the email.
profile.emailstring是—
profile.loginMethodsstring[]是—
statusstring是可用值: ready.

The person's workspaces#

GET /v1/workspaces

The workspaces the signed-in person can open, with their role in each, and whether they may create another. With state=deletion_scheduled, the workspaces they own that are scheduled for deletion instead: recoverable in the console until deletionEffectiveAt. Reading changes nothing: an invitation waiting for the person is claimed when they next open the console.

Scope身分驗證方式Idempotency-Key
workspaces:readaccountpersonToken—

參數

名稱位置型別必填說明
statequerystring否deletion_scheduled lists the recoverable workspaces instead. 可用值: deletion_scheduled.
cursorquerystring否The nextCursor of the previous page. Opaque.
limitqueryinteger否Items per page. 預設值: 50.

回應

狀態碼內容說明
200application/json: AccountWorkspaceListOne page of workspaces.
400application/json: ErrorThe request itself is wrong, such as a cursor this list did not answer (recovery: none).
401application/json: ErrorNo token, or a token the platform does not honor.
403application/json: ErrorSCOPE_NOT_GRANTED: the sign-in does not carry the scope, or the application no longer declares it or Agent Lab no longer approves it (recovery: authorize: sign the person in again asking for it); PERSON_TOKEN_REQUIRED: an installation's token (recovery: none); SERVER_TO_SERVER_ONLY: sent from a browser (recovery: none).
429application/json: ErrorRate limited (recovery: retry).
503application/json: ErrorTry again later (recovery: retry).

Create a workspace#

POST /v1/workspaces

A workspace the signed-in person owns, under the same limit and slug rules as creating one in the console. The application is not installed in it: to act there, it asks to be installed, and the person approves that on the install consent screen. A retry with the same slug after the first succeeded answers WORKSPACE_SLUG_UNAVAILABLE, so read the list before trying again.

Scope身分驗證方式Idempotency-Key
workspaces:createaccountpersonToken—

請求內容

application/json: AccountWorkspaceCreate

欄位型別必填說明
namestring是—
slugstring是—

回應

狀態碼內容說明
201application/json: AccountWorkspaceThe workspace.
400application/json: ErrorThe request itself is wrong, such as a cursor this list did not answer (recovery: none).
401application/json: ErrorNo token, or a token the platform does not honor.
403application/json: ErrorWORKSPACE_CREATION_LIMIT_REACHED: the person may not create another workspace (recovery: none); or as for every account-level operation (AccountForbidden).
409application/json: ErrorWORKSPACE_SLUG_UNAVAILABLE: the slug is taken or reserved (recovery: none).
413application/json: ErrorThe body is larger than the operation accepts (PAYLOAD_TOO_LARGE, recovery: none).
429application/json: ErrorRate limited (recovery: retry).
503application/json: ErrorTry again later (recovery: retry).

Whether the person can open a workspace#

GET /v1/workspaces/{workspaceId}/admission

Why a workspace the person expected is not in their list: reachable (it is open to them), realm_not_admitted (they are a member, but signed in through an entrance the workspace does not admit; signInRealms names the ones it does), or no_membership, which is also the answer for a workspace that does not exist.

Scope身分驗證方式Idempotency-Key
workspaces:readaccountpersonToken—

參數

名稱位置型別必填說明
workspaceIdpathstring是The workspace, by id.

回應

狀態碼內容說明
200application/json: WorkspaceAdmissionThe answer.
401application/json: ErrorNo token, or a token the platform does not honor.
403application/json: ErrorSCOPE_NOT_GRANTED: the sign-in does not carry the scope, or the application no longer declares it or Agent Lab no longer approves it (recovery: authorize: sign the person in again asking for it); PERSON_TOKEN_REQUIRED: an installation's token (recovery: none); SERVER_TO_SERVER_ONLY: sent from a browser (recovery: none).
429application/json: ErrorRate limited (recovery: retry).
503application/json: ErrorTry again later (recovery: retry).