tencent cloud

All product documents
APIs
CreateUser
Last updated: 2024-11-25 16:56:48
CreateUser
Last updated: 2024-11-25 16:56:48

1. API Description

Domain name for API request: ciam.intl.tencentcloudapi.com.

This API is used to create a user.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateUser.
Version Yes String Common Params. The value used for this API: 2022-03-31.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
UserStoreId Yes String User directory ID
PhoneNumber Yes String Mobile number
Email Yes String Email address
Password Yes String Password
UserName Yes String Username
Nickname No String Nickname
Address No String Address
UserGroup.N No Array of String User group ID
Birthdate No Integer Date of birth
CustomizationAttributes.N No Array of MemberMap Custom attribute
IndexedAttribute1 No String Index field 1
IndexedAttribute2 No String Index field 2
IndexedAttribute3 No String Index field 3
IndexedAttribute4 No String Index field 4
IndexedAttribute5 No String Index field 5

3. Output Parameters

Parameter Name Type Description
User User Information of the created user
Note: This field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Creating a user

creating a user

Input Example

POST / HTTP/1.1
Host: ciam.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateUser
<Common request parameters>

{
    "UserStoreId": "2c3aca3b****************a7efe88e",
    "PhoneNumber": "132****0000",
    "Email": "132****@qq.com",
    "Password": "password",
    "Nickname": "nick name",
    "Address": "address",
    "UserGroup": [
        "6cd22e51****************f6f7cb81"
    ],
    "Birthdate": 1706682491339,
    "CustomizationAttributes": [
        {
            "Name": "k",
            "Value": "v",
            "Type": "STRING"
        }
    ],
    "UserName": "zhangsan",
    "IndexedAttribute1": "value1",
    "IndexedAttribute2": "value2",
    "IndexedAttribute3": "value3",
    "IndexedAttribute4": "value4",
    "IndexedAttribute5": "value5"
}

Output Example

{
    "Response": {
        "User": {
            "UserId": "53e25c3****************e4eb5bd1",
            "UserName": "zhangsan",
            "PhoneNumber": "132****0000",
            "Email": "132****@qq.com",
            "LastSignOn": 1711002933442,
            "CreatedDate": 1718332940956,
            "Status": "NORMAL",
            "UserDataSourceEnum": "ADMIN",
            "Nickname": "nick name",
            "Address": "address",
            "Birthdate": 1706682491339,
            "UserGroups": [
                "6cd22e51****************f6f7cb81"
            ],
            "LastModifiedDate": 1722420973329,
            "CustomAttributes": [
                {
                    "Name": "k",
                    "Value": "v",
                    "Type": "STRING"
                }
            ],
            "ResidentIdentityCard": "123456789012345678",
            "QqOpenId": "qqopenid",
            "QqUnionId": "qqunionid",
            "WechatOpenId": "wechatopenid",
            "WechatUnionId": "wechatunionid",
            "AlipayUserId": "alipayuserid",
            "WeComUserId": "wecomuserid",
            "Description": "user1",
            "Name": "name",
            "Locale": "locale",
            "Gender": "male",
            "IdentityVerificationMethod": "-",
            "IdentityVerified": true,
            "Job": "employee",
            "Nationality": "nationality",
            "Primary": true,
            "Zone": "zone",
            "AlreadyFirstLogin": true,
            "TenantId": "tenantId",
            "UserStoreId": "2c3aca3b****************a7efe88e",
            "Version": 0,
            "LockType": "-",
            "LockTime": 0,
            "IndexedAttribute1": "value1",
            "IndexedAttribute2": "value2",
            "IndexedAttribute3": "value3",
            "IndexedAttribute4": "value4",
            "IndexedAttribute5": "value5"
        },
        "RequestId": "e2e9e8aa********************9ab34c6e"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure A CAM signature/authentication error occurred.
DryRunOperation DryRun Operation. It means that the request would have succeeded, but the DryRun parameter was used.
FailedOperation The operation failed.
FailedOperation.AttributeFormatError The user attribute format is abnormal.
FailedOperation.EmailAlreadyExists The email address has already been bound to a user.
FailedOperation.EmailIsNull The email address cannot be empty.
FailedOperation.IndexedAttributeTooLong indexedAttribute can contain up to 512 characters.
FailedOperation.InvalidTenant The tenant is invalid.
FailedOperation.InvalidUserStore The user pool is invalid.
FailedOperation.PasswordIsNull The password cannot be empty.
FailedOperation.PhoneNumberAlreadyExists The mobile number has already been bound to a user.
FailedOperation.PhoneNumberIsNull The mobile number cannot be empty.
FailedOperation.QuotaLimitExceeded The quota is exceeded. Contact customer service.
FailedOperation.UserGroupNotFound The user group does not exist.
FailedOperation.UserNameAlreadyExists The user name already exists.
FailedOperation.UserNameIsNull The username cannot be empty.
InternalError An internal error occurred.
InternalError.UnknownError An unknown error occurred.
InvalidParameter The parameter is incorrect.
InvalidParameter.ParameterIllegal The request parameter is invalid.
InvalidParameterValue The parameter value is incorrect.
LimitExceeded The quota limit is exceeded.
MissingParameter The parameter is missing.
OperationDenied The operation was denied.
RequestLimitExceeded The number of requests exceeds the frequency limit.
RequestLimitExceeded.FrequentRequest Too many requests. Try again later.
RequestLimitExceeded.RepeatRequest Repeated request. Try again later.
ResourceInUse The resource is in use.
ResourceInsufficient The resource is insufficient.
ResourceNotFound The resource does not exist.
ResourceUnavailable The resource is unavailable.
ResourcesSoldOut The resources have been sold out.
UnauthorizedOperation The operation is unauthorized.
UnauthorizedOperation.TenantNotActivated The service is not activated.
UnknownParameter The parameter is unknown.
UnsupportedOperation The operation is not supported.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon