Generate
Standard · 1 creditGenerate cryptographically secure passwords, random tokens, or nanoids with configurable length and character sets.
POST /api/generate
Section titled “POST /api/generate”Parameters
Section titled “Parameters”| Field | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | — | password, token, or nanoid |
length | integer | No | 16 | Output length (max 4096) |
options.uppercase | boolean | No | — | Include uppercase letters (password only) |
options.lowercase | boolean | No | — | Include lowercase letters (password only) |
options.numbers | boolean | No | — | Include digits (password only) |
options.symbols | boolean | No | — | Include special characters (password only) |
options.exclude_ambiguous | boolean | No | — | Exclude ambiguous characters like 0O1lI (password only) |
Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
value | string | Generated value |
type | string | Type that was generated |
length | integer | Actual length |
entropy | number | Bits of entropy |
Examples
Section titled “Examples”Random password
Section titled “Random password”curl -X POST https://morso.dev/api/generate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "password", "length": 24, "options": {"uppercase": true, "lowercase": true, "numbers": true, "symbols": true}}'{ "value": "k9#Lm$xR4!nQ7@pWz&vB3*jY", "type": "password", "length": 24, "entropy": 157.2}API token
Section titled “API token”curl -X POST https://morso.dev/api/generate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "token", "length": 32}'{ "value": "a3f8c1d9e7b2046f5a9c3e8d1b7f0264", "type": "token", "length": 32, "entropy": 128.0}Nanoid
Section titled “Nanoid”curl -X POST https://morso.dev/api/generate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type": "nanoid", "length": 21}'{ "value": "V1StGXR8_Z5jdHi6B-myT", "type": "nanoid", "length": 21, "entropy": 126.0}