All Products
Search
Document Center

Key Management Service:GetRandomPassword

Last Updated:Jul 29, 2025

Obtains a random password string.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
PasswordLengthstringNo

The number of bytes that the password to be generated contains.

Valid values: 8 to 128.

Default value: 32

32
ExcludeCharactersstringNo

The characters that are not included in the password to be generated.

Valid values:

Valid characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ! \"#$%&'()*+,-. /:;<=>? @[\] your_project_id} ~ .

This parameter is empty by default.

ABCabc
ExcludeLowercasestringNo

Specifies whether to exclude lowercase letters.

Valid values:

  • true
  • false
false
ExcludeUppercasestringNo

Specifies whether to exclude uppercase letters.

Valid values:

  • true
  • false
false
ExcludeNumbersstringNo

Specifies whether to exclude digits.

Valid values:

  • true
  • false
false
ExcludePunctuationstringNo

Specifies whether to exclude special characters.

Valid values:

  • true
  • false
false
RequireEachIncludedTypestringNo

Specifies whether to include all the preceding character types.

Valid values:

  • true
  • false
true

Response parameters

ParameterTypeDescriptionExample
object
RandomPasswordstring

The generated random password.

IxGn>NMmNB(y?iZ<Yc,_H/{2GC'U****
RequestIdstring

The ID of the request.

6b0cbe25-5e33-467e-972e-7a83c6c97604

Examples

Sample success responses

JSONformat

{
  "RandomPassword": "IxGn>NMmNB(y?iZ<Yc,_H/{2GC'U****",
  "RequestId": "6b0cbe25-5e33-467e-972e-7a83c6c97604"
}

Error codes

HTTP status codeError codeError message
400InvalidParametersome of the specified parameters "\" is not valid
500InternalFailureInternal Failure

For a list of error codes, visit the Service error codes.