Random

Random String

0calls
Free

Whether you need to generate a secure random password, a unique token, or a simple random ID, this endpoint can meet your needs.

GET
uapis.cn
/api/v1/random/string
Query parameters
2
length
integer

The length of the string you want to generate. Valid range is 1 to 1024.

type
string

Specify the character type that makes up the string.

Overview

You can precisely control the length and character set type of the generated string, making it very flexible.

Usage Notes

Tip

Character Set Type type Details You can precisely control the generated character set through the type parameter:

  • numeric: Pure numbers (0-9)
  • lower: Lowercase letters (a-z)
  • upper: Uppercase letters (A-Z)
  • alpha: Upper and lowercase letters (a-zA-Z)
  • alphanumeric (default): Numbers and upper/lowercase letters (0-9a-zA-Z)
  • hex: Hexadecimal characters (0-9a-f)

Query parameters

length
integeroptional

The length of the string you want to generate. Valid range is 1 to 1024.

type
stringoptional

Specify the character type that makes up the string.

Response

200 / OK

Generation successful!

JSON
{
  "text": "aK3fP7bQ9zRjT1vN"
}

400 / Bad Request

Invalid request parameters.

JSON
{
  "code": "INVALID_ARGUMENT",
  "details": {},
  "message": "Invalid parameter, e.g., length out of range [1, 1024]."
}

500 / Internal Server Error

Internal server error.

JSON
{
  "code": "INTERNAL_SERVER_ERROR",
  "details": {},
  "message": "Failed to generate random string."
}