CreateUser

Updated at:
Copy as MD

Creates a user in a specified workspace. The username must be unique within the workspace, can contain only lowercase letters, digits, and hyphens, and cannot be a reserved name such as manager, admin, or any name starting with worker-. If the password is not specified, the server generates an initial password and returns it in the initialPassword field of the response.

Operation description

Creates a user in a workspace for member collaboration and application access, which can be used to configure team members and user logons.

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

agentcore:CreateUser

create

*User

acs:agentcore:{#regionId}:{#accountId}:workspace/{#workspaceId}/user/*

None None

Request syntax

POST /workspaces/{workspaceId}/users HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

workspaceId

string

Yes

The workspace ID.

ws-123456

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body for creating a user.

name

string

Yes

The username. The name must be unique within the workspace, can contain only lowercase letters, digits, and hyphens, must start and end with a lowercase letter or a digit, and must be 1 to 32 characters in length. Reserved names such as manager, admin, or any name starting with worker- are not allowed.

user-01

displayName

string

Yes

The display name of the user. The name must be 1 to 32 characters in length.

John Doe

email

string

No

The email address of the user. The address can be up to 256 characters in length.

user-01@example.com

note

string

No

The remarks for the user. The remarks can be up to 1,024 characters in length.

Agent operations team member

password

string

No

The initial password of the user. The password must be 8 to 32 characters in length and must contain uppercase letters, lowercase letters, digits, and special characters. It cannot contain the username. If this parameter is not specified, the server generates a random password and returns it in the initialPassword field of the response.

Example@2026

clientToken

string

No

Not supported.

Not supported

Response elements

Element

Type

Description

Example

object

requestId

string

The request ID.

request-123456

message

string

The response message. An error description is returned if the request fails.

success

httpStatusCode

integer

The HTTP status code.

200

code

string

The business status code.

SUCCESS

success

boolean

Indicates whether the request is successful.

data

object

The information about the created user.

workspaceId

string

The workspace ID.

ws-123456

agentCoreUserId

string

The user ID.

usr-123456

name

string

The username. The name must be unique within the workspace, can contain only lowercase letters, digits, and hyphens, must start and end with a lowercase letter or a digit, and must be 1 to 32 characters in length.

user-01

displayName

string

The display name of the user. The name must be 1 to 32 characters in length.

John Doe

email

string

The email address of the user. The address can be up to 256 characters in length.

user-01@example.com

authMethod

string

The authentication method of the user. A value of password indicates that the local password authentication of the workspace is used. A value of dingtalk or feishu indicates that the user is synchronized and authenticated by the corresponding external identity provider.

password

note

string

The remarks for the user. The remarks can be up to 1,024 characters in length.

Agent operations team member

status

string

The status of the user. Valid values: Creating, Active, Updating, Deleting, Failed, and DeleteFailed.

Valid values:

  • Creating :

    Creating.

  • Active :

    Active.

  • Failed :

    Failed.

  • DeleteFailed :

    Delete failed.

  • Updating :

    Updating.

  • Deleting :

    Deleting.

Active

createdAt

string

The time when the user was created, in UTC format compliant with RFC 3339.

2026-08-12T03:04:05Z

updatedAt

string

The time when the user was last updated, in UTC format compliant with RFC 3339.

2026-08-12T03:04:05Z

regionId

string

The region ID of the resource.

cn-hangzhou

initialPassword

string

The initial password of the user. If a password was specified during creation, that password is returned. Otherwise, a random password generated by the server is returned.

Example@2026

Examples

Success response

JSON format

{
  "requestId": "request-123456",
  "message": "success",
  "httpStatusCode": 200,
  "code": "SUCCESS",
  "success": false,
  "data": {
    "workspaceId": "ws-123456",
    "agentCoreUserId": "usr-123456",
    "name": "user-01",
    "displayName": "Zhang San",
    "email": "user-01@example.com",
    "authMethod": "password",
    "note": "Agent operation team member",
    "status": "Active",
    "createdAt": "2026-08-12T03:04:05Z",
    "updatedAt": "2026-08-12T03:04:05Z",
    "regionId": "cn-hangzhou",
    "initialPassword": "Example@2026"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.