Skip to content

Password Generation

The /password endpoint generates one or more passwords using cryptographically secure randomness (crypto.randomInt). Supports two modes: random (character-based) and passphrase (word-based). Each response includes the generated passwords along with their strength rating and entropy score.

Use Cases

Generate secure passwords for users during account creation, produce passphrases for easier memorization, test password strength UI, or seed test fixtures with realistic credentials.

Parameters

ParameterRequiredDefaultDescription
typeNorandomGeneration mode: random (character-based) or passphrase (word-based).
lengthNo16Character count for random mode (8–128), or word count for passphrase mode (3–10).
uppercaseNotrueInclude uppercase letters (A–Z). Set to false to disable.
lowercaseNotrueInclude lowercase letters (a–z). Set to false to disable.
digitsNotrueInclude digits (0–9). Set to false to disable.
symbolsNofalseInclude symbols (!@#$%^&*()-_=+[]{}|;:,.<>?). Set to true to enable.
excludeNo""Characters to remove from the charset (e.g. exclude=0Ol1).
countNo1Number of passwords to generate (1–20).
separatorNo-Word separator for passphrase mode.

Response Fields

FieldTypeDescription
passwordsstring[]List of generated passwords or passphrases
typestringGeneration mode used: random or passphrase
lengthnumberCharacter count (random) or word count (passphrase)
strengthstringStrength rating: weak, moderate, strong, or very_strong
entropynumberShannon entropy in bits (rounded to 1 decimal place)

Strength Thresholds

StrengthEntropy range
weak< 40 bits
moderate40 – 59.9
strong60 – 79.9
very_strong≥ 80 bits

Code Examples

curl -X GET \
  "https://api.sylvain.sh/v5/password"

Try It

Error Handling

Error MessageDescription
Type must be "random" or "passphrase"The type parameter is not a supported value
Length must be between 8 and 128The length parameter is out of range for random mode
At least one character set must be enabledAll character sets are disabled or exclude removed all characters
Count must be between 1 and 20The count parameter is out of the allowed range