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

Modifying the Account Login Policy

Function

This API is used to modify the account login policy.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

iam:securitypolicies:updateLoginPolicyV5

Write

-

-

-

-

URI

PUT /v5/login-policy

Request Parameters

Table 1 Request body parameters

Parameter

Mandatory

Type

Description

user_validity_period

No

Integer

Definition:

If an IAM user does not log in within the validity period (days) specified by this parameter, the user will be disabled.

Constraints:

This parameter is not applicable to the root user.

Range:

The value ranges from 0 to 240.

Default Value:

N/A

custom_info_for_login

No

String

Definition:

Login information.

Constraints:

The value cannot contain the following characters: "@", "#", "%", "&", "<", ">", "\", "$", "^", and "*".

The value contains 0 to 64 characters.

Range:

N/A

Default Value:

N/A

lockout_duration

No

Integer

Definition:

Account lockout duration (minute) for IAM users.

Constraints:

N/A

Range:

The value ranges from 15 to 1440.

Default Value:

N/A

login_failed_times

No

Integer

Definition:

Maximum number of invalid login attempts.

Constraints:

N/A

Range:

The value ranges from 3 to 10.

Default Value:

N/A

period_with_login_failures

No

Integer

Definition:

Time limit (minutes).

Constraints:

N/A

Range:

The value ranges from 15 to 60.

Default Value:

N/A

session_timeout

No

Integer

Definition:

Login session expiration time.

Constraints:

N/A

Range:

The value ranges from 15 to 1440.

Default Value:

N/A

show_recent_login_info

No

Boolean

Definition:

Whether to display the latest login information.

Constraints:

N/A

Range:

The value can be true or false.

Default Value:

N/A

allow_address_netmasks

No

Array of AllowAddressNetmask objects

Definition:

IP address or network segment that can be accessed, for example, xxx.xxx.xxx.xxx/24.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

allow_ip_ranges

No

Array of AllowIpRange objects

Definition:

IP address range that is allowed to access, for example, 0.0.0.0-255.255.255.255.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Table 2 AllowAddressNetmask

Parameter

Mandatory

Type

Description

address_netmask

Yes

String

Definition:

IP address or CIDR block, for example, 192.168.0.1/24.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

description

No

String

Definition:

Description.

Constraints:

The value cannot contain the following characters: "@", "#", "%", "&", "<", ">", "\", "$", "^", and "*".

The value contains 0 to 255 characters.

Range:

N/A

Default Value:

N/A

Table 3 AllowIpRange

Parameter

Mandatory

Type

Description

ip_range

Yes

String

Definition:

IP address range, for example, 0.0.0.0-255.255.255.255.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

description

No

String

Definition:

Description.

Constraints:

The value cannot contain the following characters: "@", "#", "%", "&", "<", ">", "\", "$", "^", and "*".

The value contains 0 to 255 characters.

Range:

N/A

Default Value:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

login_policy

login_policy object

Definition:

Login authentication policy

Range:

N/A

Table 5 login_policy

Parameter

Type

Description

user_validity_period

Integer

Definition:

If an IAM user does not log in within the validity period (days) specified by this parameter, the user will be disabled.

Range:

N/A

custom_info_for_login

String

Definition:

Login information.

Range:

N/A

lockout_duration

Integer

Definition:

Account lockout duration (minute) for IAM users.

Range:

N/A

login_failed_times

Integer

Definition:

Maximum number of invalid login attempts.

Range:

N/A

period_with_login_failures

Integer

Definition:

Time limit (minutes).

Range:

N/A

session_timeout

Integer

Definition:

Login session expiration time.

Range:

N/A

show_recent_login_info

Boolean

Definition:

Whether to display the latest login information.

Range:

N/A

allow_address_netmasks

Array of allow_address_netmasks objects

Definition:

IP address or network segment that can be accessed.

Range:

N/A

allow_ip_ranges

Array of allow_ip_ranges objects

Definition:

IP address range from which access is allowed.

Range:

N/A

Table 6 allow_address_netmasks

Parameter

Type

Description

address_netmask

String

Definition:

IP address or CIDR block, for example, 192.168.0.1/24.

Range:

N/A

description

String

Definition:

Description.

Range:

N/A

Table 7 allow_ip_ranges

Parameter

Type

Description

ip_range

String

Definition:

IP address range, for example, 0.0.0.0-255.255.255.255.

Range:

N/A

description

String

Definition:

Description.

Range:

N/A

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition :

Error code. For details, see Error Code.

Range:

The format is PAP5.XXXX, for example, PAP5.0012.

error_msg

String

Definition :

Error message. For details, see Error Message.

Range:

N/A.

request_id

String

Definition:

Unique identifier of an API request, which is used to locate API calling exceptions.

Range:

N/A

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition :

Error code. For details, see Error Code.

Range:

The format is PAP5.XXXX, for example, PAP5.0012.

error_msg

String

Definition :

Error message. For details, see Error Message.

Range:

N/A.

request_id

String

Definition:

Unique identifier of an API request, which is used to locate API calling exceptions.

Range:

N/A

encoded_authorization_message

String

Definition :

Encrypted details returned when the authentication fails, which are used to locate authentication problems. The STS5 decryption API can be used for decryption. For details, see API link.

Range:

N/A.

Example Requests

Modifying the account login policy

PUT https://{endpoint}/v5/login-policy

{
  "user_validity_period" : 0,
  "custom_info_for_login" : "info",
  "lockout_duration" : 15,
  "login_failed_times" : 5,
  "period_with_login_failures" : 15,
  "session_timeout" : 60,
  "show_recent_login_info" : false,
  "allow_sms_login" : "true",
  "allow_address_netmasks" : [ {
    "address_netmask" : "192.168.0.1/24",
    "description" : "description"
  } ],
  "allow_ip_ranges" : [ {
    "ip_range" : "0.0.0.0-255.255.255.255",
    "description" : "description"
  } ]
}

Example Responses

Status code: 200

Successful

{
  "login_policy" : {
    "user_validity_period" : 0,
    "custom_info_for_login" : "info",
    "lockout_duration" : 15,
    "login_failed_times" : 5,
    "period_with_login_failures" : 15,
    "session_timeout" : 60,
    "show_recent_login_info" : false,
    "allow_address_netmasks" : [ {
      "address_netmask" : "192.168.0.1/24",
      "description" : "description"
    } ],
    "allow_ip_ranges" : [ {
      "ip_range" : "0.0.0.0-255.255.255.255",
      "description" : "description"
    } ]
  }
}

Status Codes

Status Code

Description

200

Successful

400

Bad request

403

Forbidden

Error Codes

See Error Codes.