CreateContextDatabaseWorkspace

Updated at:

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 to false, 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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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.

  • If you do not specify this parameter, the cluster selection logic that prioritizes account-exclusive storage is used.

  • default: The shared cluster is used.

  • Cluster IDs starting with acc-: The dedicated cluster to which the account belongs is used.

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 is returned for a shared cluster, and the corresponding cluster ID is returned for a dedicated cluster.

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.

owner

ApiKeyName

string

The name of the first API key. The name is default when the key is generated. If GenerateInitialKey is set to false, this field is empty.

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 false, this field is empty.

ctxdb-*****

Type

string

The workspace type. Valid values: personal and enterprise.

personal

Status

string

The workspace status. Valid values: Active (running normally) and Locked (locked due to overdue payments or expiration).

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:

  • personal_compatibility: The compatibility mode, which corresponds to the request value compatibility.

  • advanced: The advanced permission mode.

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:

  • personal_compatibility: The compatibility mode.

  • advanced: The advanced permission mode.

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:

  • account_compatibility: The account compatibility identity mode.

  • bound_member: The bound member identity mode.

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. This field describes the caller account and does not indicate the role of the workspace member.

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. This field is optional and is empty if no bound member role information is provided.

Owner

BoundMemberStatus

string

The status of the bound member, such as active. This field is optional and is empty if no bound member status information is provided.

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.