Skip to main content

Generate Password

Generates a random password that meets ECGrid complexity requirements, ready to use with Update Password or Create User.

Endpoint

POST /v2/users/generate-password

Request Body

FieldTypeRequiredConstraintsDescription
lengthintegerNoDefaults to 12Desired length of the generated password
{
"length": 16
}

Response

Returns the generated password string. The returned password is guaranteed to satisfy the ECGrid password complexity pattern:

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).+$

{
"success": true,
"data": "Xk7#mQpL2rNv!dYw"
}

Code Examples

curl -X POST "https://rest.ecgrid.io/v2/users/generate-password" \
-H "X-API-Key: $ECGRID_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "length": 16 }'

See Also

  • Update Password — apply the generated password to a user account
  • Create User — supply the generated password when creating a new user