Updated on 2026-07-29 GMT+08:00

Creating an Account

Function

This API is used to create an account. The generated account automatically becomes a member account of the organization holding the account that calls this API. This API can be called only from the organization's management account. The Organizations service creates the required service-linked agency and account-accessed agency in the new account.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    organizations:accounts:create

    Write

    -

    • g:RequestTag/<tag-key>

    • g:TagKeys

    -

    organizations:resources:tag

URI

POST /v1/organizations/accounts

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Security-Token

No

String

Definition

Security token (session token) of your temporary security credentials. If a temporary security credential is used, this header is required.

Constraints

N/A

Range

The value contains 0 to 32,768 characters.

Default Value

No default value

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Account name.

Constraints

Mandatory

Range

The value must comply with the regular expression ^[a-zA-Z][0-9a-zA-Z_-]+$.

The value contains a maximum of 64 characters.

Default Value

No default value

email

No

String

Definition

Email address. This parameter is mandatory when an account is created at the Huawei Cloud international website.

Constraints

None

Range

The value must comply with the regular expression ^[a-zA-Z0-9.!#$%&'+/=?^_`{|}~-]+@a-zA-Z0-9?(?:.a-zA-Z0-9?)$.

The value contains 1 to 64 characters.

Default Value

None

phone

No

String

Definition

Mobile number. This parameter is mandatory when an account is created at the Huawei Cloud Chinese mainland website.

Constraints

None

Range

None

Default Value

None

agency_name

No

String

Definition

Agency name.

Constraints

N/A

Range

The value must comply with the regular expression ^[\w-]+$.

The value contains 1 to 32 characters.

Default Value

No default value

description

No

String

Definition

Description.

Constraints

N/A

Range

The value contains 0 to 128 characters.

Default Value

No default value

tags

No

Array of TagDto objects

Definition

List of tags you want to attach to the new account.

Constraints

N/A

Range

0 to 200 tags

Default Value

No default value

Table 3 TagDto

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Identifier or name of the tag key.

Constraints

Mandatory

Range

The value must comply with the regular expression ^((?!sys|\s)[\p{L}\p{Z}\p{N}.:=+-@]*[\p{L}\p{N}.:=+-@])$.

The value contains 1 to 128 characters.

Default Value

None

value

Yes

String

Definition

String value associated with the tag key. You can set the tag value to an empty string, but cannot set it to NULL.

Constraints

Mandatory

Range

The value must comply with the regular expression ^([\p{L}\p{Z}\p{N}_.:/=+-@]*)$.

The value contains 0 to 255 characters.

Default Value

None

Response Parameters

Status code: 202

Table 4 Response body parameters

Parameter

Type

Description

create_account_status

CreateAccountStatusDto object

Definition

Status of the request for creating an account.

Constraints

Mandatory

Range

N/A

Default Value

No default value

Table 5 CreateAccountStatusDto

Parameter

Type

Description

account_id

String

Definition

Unique ID of the newly created account if any.

Constraints

Mandatory

Range

The value must comply with the regular expression ^[\w-]+$.

The value contains a maximum of 64 characters.

Default Value

No default value

account_name

String

Definition

Account name.

Constraints

Mandatory

Range

The value must comply with the regular expression ^[a-zA-Z][0-9a-zA-Z_-]+$.

The value contains a maximum of 64 characters.

Default Value

No default value

completed_at

String

Definition

Date and time when the account was created and the request was completed.

Constraints

Mandatory

Range

The value must be in ISO 8601 format.

Default Value

No default value

created_at

String

Definition

Date and time when the CreateAccount request was made.

Constraints

Mandatory

Range

The value must be in ISO 8601 format.

Default Value

No default value

id

String

Definition

Unique ID of a request. You can get this value from the response to the initial CreateAccount request.

Constraints

Mandatory

Range

The value must comply with the regular expression ^car-[0-9a-z]{8,32}$.

The value contains a maximum of 36 characters.

Default Value

No default value

state

String

Definition

Status of the asynchronous request for creating an account. The value can be in_progress, succeeded, or failed.

Constraints

Mandatory

Range

The value contains 1 to 64 characters.

Default Value

No default value

failure_reason

String

Definition

Reason for a request failure.error.1000 Failed to query the user identity information.error.2000 Failed to create the account.error.2001 Account name conflict.error.3000 Failed to create the resource account.error.3001 The number of accounts that can be registered with the mobile number exceeds the maximum limit.error.4000 Failed to create the birth token.error.5000 Failed to create the service-linked agency.error.6000 Failed to create the agency.error.6001 Failed to query the permission information.error.6002 Failed to bind the permission information.error.7000 Failed to associate the master account with member accounts for unified accounting.error.7001 Too many real-name authentication records.error.7002 Failed to query the unified accounting association between the master account and member accounts.error.0000 System error.

Constraints

N/A

Range

Enumerated values: error.1000, error.2000, error.2001, error.3000, error.3001, error.4000, error.5000, "error.6000**, error.6001, error.6002, error.7000, error.7001, error.7002, and error.0000.

Default Value

No default value

failure_detail_msg

failure_detail_msg object

Definition

Detailed cause of a request failure.

Constraints

N/A

Range

N/A

Default Value

No default value

Table 6 failure_detail_msg

Parameter

Type

Description

error_msg

String

Definition

Transparent transmission error code.

Constraints

None

Range

None

Default Value

None

encoded_authorization_message

String

Definition

Failure information of transparent authentication.

Constraints

None

Range

None

Default Value

None

Example Requests

Creating an account

POST https://{endpoint}/v1/organizations/accounts

{
  "name" : "C9Qzukfn6FIyxAmC3dQclrwZW34UDu_rPSRrCQ4aGFm0-r1zC2RDHt5oHA-aY21B",
  "tags" : [ {
    "key" : "keystring",
    "value" : "valuestring"
  } ]
}

Example Responses

Status code: 202

Successful

{
  "create_account_status" : {
    "account_id" : "0a6d25d23900d45c0faac010e0fb4de0",
    "account_name" : "paas_iam_573331",
    "completed_at" : "2022-08-24T06:41:15Z",
    "created_at" : "2022-08-24T06:41:15Z",
    "id" : "car-awjp43m7bz3b8jgy5v61jrfwakt3og8",
    "state" : "in_progress"
  }
}

Status Codes

Status Code

Description

202

Successful

Error Codes

See Error Codes.