Claim a workspace¶
Claim a specified workspace for the current identity and return whether this request performed the claim.
POST https://moi.matrixorigin.cn/newmoi/workspaces/claim
Before you call this API¶
Identify the workspace to claim. Prepare a personal access token and the workspace ID.
The following example uses:
$AI_STUDIO_API_KEY: Your personal access token, passed in theX-API-Keyheader.$WORKSPACE_ID: The workspace ID to claim, passed in the request body’sworkspace_idfield.
The calling identity is the claim target. You cannot specify another user in the request.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/claim" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"workspace_id": "'$WORKSPACE_ID'"
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
ID of the workspace to claim. |
Successful response¶
On success, the API returns 200. Use the claim result fields to determine whether the workspace was claimed by this request.
{
"code": "OK",
"msg": "OK",
"data": {
"workspace_id": "ws_01",
"claimed": true,
"already_claimed": false
}
}
Response fields:
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
ID of the claimed workspace. |
|
boolean |
Whether this request completed a claim. |
|
boolean |
Whether the workspace was already claimed by the current identity before the request. |
Error response¶
{
"code": "ErrWorkspaceNotFound",
"msg": "Workspace not found",
"data": null
}
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
|
|
|
Provide a valid workspace ID and retry. |
|
|
Credentials are missing or invalid. |
Check the personal access token. |
|
|
The current identity has not been synchronized or cannot claim workspaces. |
Complete account synchronization, or ask an administrator for access before retrying. |
|
|
The current account or target workspace does not exist. |
Check the workspace ID and confirm the current account is available. |
|
|
The workspace is being claimed, or the current identity must first be a member. |
Wait for the current operation to finish, or resolve the membership requirement first. |
|
|
The workspace was rolled back. |
Confirm the workspace again, then make a new claim request. |
|
|
A dependent service is temporarily unavailable. |
Retry later. |
|
|
The service could not complete the claim. |
Record the request time and error message, then retry. |