CreateContextDatabaseWorkspace
Creates a ContextDB workspace and its first member, and optionally generates an initial API key.
Operation description
Creates a ContextDB workspace and its first member.
By default, GenerateInitialKey is set to
true. An initial API key is generated during creation, and the plaintext key is returned only once. Save the returned key. If set tofalse, no initial API key is generated, and the ApiKeyName and ApiKey fields in the response are empty.You can use ClusterId to specify the cluster to which the workspace belongs.
You can use PermissionMode to select the compatibility mode or the advanced permission mode. The advanced permission mode can only be selected by the Alibaba Cloud account. It takes effect immediately after the workspace is created and cannot be disabled.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
rdsai:CreateContextDatabaseWorkspace |
create |
*All Resource
|
None | None |
Request syntax
GET / HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| WorkspaceName |
string |
Yes |
The name of the workspace. |
my-workspace |
| MemberName |
string |
Yes |
The ID of the cluster to which the workspace belongs. This parameter is optional.
|
default |
| PermissionMode |
string |
No |
The name of the first member when the workspace is created. This parameter is optional. |
my-member |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The workspace is created. |
||
| RequestId |
string |
The request ID. |
FE9C65D7-930F-57A5-A207-8C396329**** |
| ClusterId |
string |
The ID of the cluster to which the workspace belongs. |
default |
| WorkspaceId |
string |
The ID of the newly created workspace. |
ws-as1llqmkol**** |
| WorkspaceName |
string |
The name of the workspace. |
my-workspace |
| MemberId |
string |
The ID of the first member. |
mb-cz51tnnp8**** |
| MemberName |
string |
The name of the first member. |
my-member |
| Role |
string |
The role of the first member. The value is fixed as |
owner |
| ApiKeyName |
string |
The name of the first API key. The name is |
default |
| ApiKey |
string |
The plaintext of the first API key. It is returned only once during creation. Save the key properly. If GenerateInitialKey is set to |
ctxdb-***** |
| Type |
string |
The workspace type. Valid values: |
personal |
| Status |
string |
The workspace status. Valid values: |
Active |
| CreatedAt |
string |
The creation time in ISO 8601 format. |
2026-05-28T17:59:55Z |
| PermissionMode |
string |
The actual permission mode that takes effect after the workspace is created. A lowercase string is returned. Valid values:
This field is optional. If it is not returned in the response, call GetContextDatabaseWorkspace to query the workspace details and confirm the actual mode. Do not recreate the workspace simply because this field is missing. |
advanced |
| ConsolePermissionMode |
string |
The permission mode used by the server to parse the identity of the current call. Valid values:
This field describes the identity context of the current call. The actual permission mode of the workspace is subject to PermissionMode. Creating a workspace uses the account-level identity context, so this field may be empty. |
advanced |
| Viewer |
object |
The viewer identity information of the current call, including the identity parsing mode, caller account type, and member information. Member-related fields are optional. |
|
| IdentityMode |
string |
The identity parsing mode of the current call. Valid values:
The identity parsing mode and the permission mode of the workspace are different concepts. You cannot infer whether the advanced permission mode is enabled for the workspace based on this field. |
account_compatibility |
| CallerType |
string |
The account type of the caller for the current call, such as |
customer |
| BoundMemberId |
string |
The ID of the workspace member bound in the identity information of the current call. This field is optional and is empty if no bound member information is provided. |
member-example |
| BoundMemberRole |
string |
The role of the bound member in the workspace, such as |
Owner |
| BoundMemberStatus |
string |
The status of the bound member, such as |
active |
| SelectedMemberId |
string |
The ID of the workspace member selected in the account compatibility identity mode. This field is optional and is empty if no member is selected for the current call. This field and the bound member ID represent the member selection result and the binding relationship, respectively. |
member-example |
| Capabilities |
object |
The account-level capability information of the current call. It only indicates the operations that the account compatibility adapter can perform and does not represent resource-level authorization. This field is optional and is not returned if no account-level executable operations are provided. |
|
| ExecutableActions |
array |
The list of operation names that the account compatibility adapter can perform. The list content does not represent read/write, member group, or access control authorization for specific resources. |
|
|
string |
The name of a single operation. The example only illustrates the format of the operation name. The actual executable operations are subject to the list returned in the current call. |
ListContextDatabaseMembers |
Examples
Success response
JSON format
{
"RequestId": "FE9C65D7-930F-57A5-A207-8C396329****",
"ClusterId": "default",
"WorkspaceId": "ws-as1llqmkol****",
"WorkspaceName": "my-workspace",
"MemberId": "mb-cz51tnnp8****",
"MemberName": "my-member",
"Role": "owner",
"ApiKeyName": "default",
"ApiKey": "ctxdb-*****",
"Type": "personal",
"Status": "Active",
"CreatedAt": "2026-05-28T17:59:55Z",
"PermissionMode": "advanced",
"ConsolePermissionMode": "advanced",
"Viewer": {
"IdentityMode": "account_compatibility",
"CallerType": "customer",
"BoundMemberId": "member-example",
"BoundMemberRole": "Owner",
"BoundMemberStatus": "active",
"SelectedMemberId": "member-example"
},
"Capabilities": {
"ExecutableActions": [
"ListContextDatabaseMembers"
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | Request parameter is invalid. | The request parameters are invalid. |
| 401 | Unauthorized | Unauthorized. | |
| 500 | InternalError | Internal server error. | The server failed to process the request. |
| 403 | NoPermission | Permission denied. | Permission denied, %s. |
| 502 | UpstreamError | Upstream service returned an error. | The upstream service returned an error. |
| 404 | ResourceNotFound | Resource not found. | The specified resource does not exist. |
| 503 | ServiceUnavailable | Dependent service is not configured or unavailable. | |
| 503 | PermissionModeUnavailable | Workspace permission mode is temporarily unavailable. | |
| 429 | QuotaExceeded | Resource quota exceeded. | Create resource quota exceeding limit |
| 409 | ResourceAlreadyExists | Resource state conflict. | A resource state conflict occurred. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.