Updated on 2025-12-29 GMT+08:00

Creating an ACL Account

Function

This API is used to create an account with read/write or read-only permissions for a DCS Redis 4.0 or 5.0 instance.

If the default user has enabled password-free access, normal users cannot use the instance. To allow normal users to use the instance, disable password-free access.

The password of the default user of a single-node or master/standby instance cannot contain colons (:). Otherwise, normal users cannot be created.

URI

POST /v2/{project_id}/instances/{instance_id}/accounts

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details, see Obtaining a Project ID.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

instance_id

Yes

String

Definition:

Instance ID. It can be viewed on the instance details page on the DCS console.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

account_name

Yes

String

Definition:

ACL username.

Constraints:

  • Starts with a letter.

  • Can contain only letters, digits, hyphens (-), and underscores (_).

  • Can contain 1 to 64 characters.

Range:

N/A

Default Value:

N/A

account_role

Yes

String

Definition:

ACL user permissions.

Constraints:

N/A

Range:

  • read: read-only

  • write: read and write

Default Value:

N/A

account_password

Yes

String

Definition:

ACL user password.

Constraints:

  • Can contain 8 to 64 characters.

  • Cannot use the username spelled forwards or backwards.

  • Must contain at least three of the following character types (colons are not allowed):

    • Lowercase letters

    • Uppercase letters

    • Digits

    • Special characters `~!@#$%^&*()-_=+\|{}'",<.>/?

Range:

N/A

Default Value:

N/A

description

No

String

Definition:

ACL user description.

Constraints:

0–1,024 characters

Range:

N/A

Default Value:

N/A

account_read_policy

No

String

Definition:

Read requests are routed to master or replica nodes.

Constraints:

  • This parameter can be set only for Proxy Cluster and read/write splitting instances except for Proxy Cluster instances without read/write splitting enabled.

  • For details about read/write splitting, see the backend-master-only parameter in section "Managing Instances" > "Modifying Configuration Parameters of a DCS Instance" in the User Guide.

Range:

  • master: Read requests are routed to the master node.

  • replica: Read requests are routed to the replica node.

  • master-replica: Read requests are routed to the master and replica nodes.

Default Value:

By default, this parameter is not set. If this parameter is not set, read requests are forwarded based on the read/write splitting configuration of the instance.

  • For details about the complete read/write splitting configuration, see parameter read-only-slave-when-wr-split in User Guide > "Managing Instances" > "Modifying Configuration Parameters of a DCS Instance".

  • Proxy Cluster instance

    • By default, read/write splitting is disabled, and read requests are forwarded to the master node.

    • Read/Write splitting enabled

      • By default, complete read/write splitting is enabled, and read requests are forwarded to the replica node.

      • If complete read/write splitting is disabled, read requests are randomly forwarded to the master and replica nodes.

  • Read/Write splitting instance

    • Read/Write splitting is supported by default.

      • By default, complete read/write splitting is enabled, and read requests are forwarded to the replica node.

      • If complete read/write splitting is disabled, read requests are randomly forwarded to the master and replica nodes.

Response Parameters

Status code: 200

The ACL user creation task is successfully delivered.

Status code: 400

Table 3 Response body parameters

Parameter

Type

Description

error_msg

String

Definition:

Error message.

Range:

N/A

error_code

String

Definition:

Error code.

Range:

For details, see Error Codes.

error_ext_msg

String

Definition:

Extended error information. This parameter is not used currently and is set to null.

Range:

N/A

Status code: 401

Table 4 Response body parameters

Parameter

Type

Description

error_msg

String

Definition:

Error message.

Range:

N/A

error_code

String

Definition:

Error code.

Range:

For details, see Error Codes.

error_ext_msg

String

Definition:

Extended error information. This parameter is not used currently and is set to null.

Range:

N/A

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Definition:

Error message.

Range:

N/A

error_code

String

Definition:

Error code.

Range:

For details, see Error Codes.

error_ext_msg

String

Definition:

Extended error information. This parameter is not used currently and is set to null.

Range:

N/A

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Definition:

Error message.

Range:

N/A

error_code

String

Definition:

Error code.

Range:

For details, see Error Codes.

error_ext_msg

String

Definition:

Extended error information. This parameter is not used currently and is set to null.

Range:

N/A

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_msg

String

Definition:

Error message.

Range:

N/A

error_code

String

Definition:

Error code.

Range:

For details, see Error Codes.

error_ext_msg

String

Definition:

Extended error information. This parameter is not used currently and is set to null.

Range:

N/A

Example Requests

Creating a read-only ACL account named user.

POST https:///{dcs_endpoint}/v2/{project_id}/instances/{instance_id}/accounts

{
  "account_name" : "user",
  "account_role" : "read",
  "account_password" : "xxxxx"
}

Example Responses

Status code: 400

Definition:

Invalid request.

{
  "error_code" : "DCS.4961",
  "error_msg" : "Acl account request param invalid."
}

Status Codes

Status Code

Description

200

The ACL user creation task is successfully delivered.

400

Definition:

Invalid request.

401

Authentication failed.

403

Request rejected.

404

Incorrect path.

500

Internal error.

Error Codes

See Error Codes.