Creates a user.

Usage notes

This topic provides an example on how to create a user named Alice.

Limits

You can call this operation up to 100 times per second per account. This operation is globally limited to 100 times per second across all accounts. If the number of the calls per second exceeds a limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limits when you call this operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateUser

The operation that you want to perform. Set the value to CreateUser.

DirectoryId String Yes d-00fc2p61****

The ID of the directory.

UserName String Yes Alice

The name of the user. The name must be unique within the directory. The name cannot be changed.

The name can contain numbers, letters, and the following special characters: @_-.

The name can be up to 64 characters in length.

FirstName String No Alice

The first name of the user.

The name can be up to 64 characters in length.

LastName String No Lee

The last name of the user.

The name can be up to 64 characters in length.

DisplayName String No Alice

The display name of the user.

The name can be up to 256 characters in length.

Description String No This is a user.

The description of the user.

The description can be up to 1,024 characters in length.

Email String No Alice@example.com

The email address of the user. The email address must be unique within the directory.

The email address can be up to 128 characters in length.

Status String No Enabled

The status of the user. Valid values:

  • Enabled: The logon of the user is enabled. This is the default value.
  • Disabled: The logon of the user is disabled.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
User Object

The information about the user.

Status String Enabled

The status of the user. Valid values:

  • Enabled: The logon of the user is enabled.
  • Disabled: The logon of the user is disabled.
UserName String Alice

The name of the user.

Email String Alice@example.com

The email address of the user.

Description String This is a user.

The description of the user.

UserId String u-00q8wbq42wiltcrk****

The ID of the user.

FirstName String Alice

The first name of the user.

CreateTime String 2021-10-26T03:03:42Z

The time when the user was created.

ProvisionType String Manual

The type of the user. Valid values:

  • Manual: The user is manually created.
  • Synchronized: The user is synchronized from an external identity provider (IdP).
DisplayName String Alice

The display name of the user.

UpdateTime String 2021-10-26T03:03:42Z

The time when the user was modified.

LastName String Lee

The last name of the user.

RequestId String F6F90F3D-4502-5877-B80B-97476F6AE2CC

The ID of the request.

Examples

Sample requests

https://[Endpoint]/?Action=CreateUser
&DirectoryId=d-00fc2p61****
&UserName=Alice
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateUserResponse>
    <User>
        <Status>Enabled</Status>
        <UserName>Alice</UserName>
        <Email/>
        <Description/>
        <UserId>u-00q8wbq42wiltcrk****</UserId>
        <FirstName/>
        <CreateTime>2021-10-26T03:03:42Z</CreateTime>
        <ProvisionType>Manual</ProvisionType>
        <DisplayName/>
        <UpdateTime>2021-10-26T03:03:42Z</UpdateTime>
        <LastName/>
    </User>
    <RequestId>F6F90F3D-4502-5877-B80B-97476F6AE2CC</RequestId>
</CreateUserResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "User" : {
    "Status" : "Enabled",
    "UserName" : "Alice",
    "Email" : "",
    "Description" : "",
    "UserId" : "u-00q8wbq42wiltcrk****",
    "FirstName" : "",
    "CreateTime" : "2021-10-26T03:03:42Z",
    "ProvisionType" : "Manual",
    "DisplayName" : "",
    "UpdateTime" : "2021-10-26T03:03:42Z",
    "LastName" : ""
  },
  "RequestId" : "F6F90F3D-4502-5877-B80B-97476F6AE2CC"
}

Error codes

For a list of error codes, visit the API Error Center.