Quick Start

Get started with our API in just a few lines of code. All password generation happens client-side for maximum security.

// Include our API script <script src="https://safepasswordgenerator.net/api.js"></script // Generate a secure password const password = SafePasswordGen.generate({ length: 16, includeUppercase: true, includeLowercase: true, includeNumbers: true, includeSymbols: true }); console.log(password); // "K9#mP2@vL8$nQ7!"

JavaScript API Reference

SafePasswordGen.generate(options)

Generates a cryptographically secure password using the Web Crypto API.

Method SafePasswordGen.generate(options)

Parameters

Parameter Type Default Description
length number 16 Password length (8-128 characters)
includeUppercase boolean true Include uppercase letters (A-Z)
includeLowercase boolean true Include lowercase letters (a-z)
includeNumbers boolean true Include numbers (0-9)
includeSymbols boolean true Include symbols (!@#$%^&*)
excludeSimilar boolean false Exclude similar characters (0,O,l,1,I)
excludeAmbiguous boolean false Exclude ambiguous symbols ({},[],(),\/,~,;,<>)
easyToType boolean false Use only easy-to-type characters

Example Usage

// Basic password const basic = SafePasswordGen.generate(); // Custom configuration const custom = SafePasswordGen.generate({ length: 24, includeSymbols: false, excludeSimilar: true }); // Easy-to-type password const easy = SafePasswordGen.generate({ length: 20, easyToType: true });

๐Ÿ” Passphrase Generation

SafePasswordGen.generatePassphrase(options)

Generate memorable passphrases using a curated word list.

Method SafePasswordGen.generatePassphrase(options)

Parameters

Parameter Type Default Description
wordCount number 4 Number of words (3-8)
separator string " " Word separator
capitalize boolean false Capitalize first letter of each word
includeNumbers boolean false Add random numbers

Example Usage

// Basic passphrase const phrase = SafePasswordGen.generatePassphrase(); // "correct horse battery staple" // Custom passphrase const custom = SafePasswordGen.generatePassphrase({ wordCount: 5, separator: "-", capitalize: true, includeNumbers: true }); // "Correct-Horse-Battery-Staple-42"

๐Ÿ”ข Bulk Generation

SafePasswordGen.generateBulk(options)

Generate multiple passwords at once for batch operations.

Method SafePasswordGen.generateBulk(options)

Parameters

Parameter Type Default Description
count number 10 Number of passwords to generate (1-1000)
format string "array" Output format: "array", "csv", "json"
passwordOptions object {} Options for individual password generation

Example Usage

// Generate 5 passwords as array const passwords = SafePasswordGen.generateBulk({ count: 5, passwordOptions: { length: 12 } }); // Generate as CSV const csv = SafePasswordGen.generateBulk({ count: 10, format: "csv" });

๐Ÿงช Interactive API Tester

Test our API directly in your browser. Try different configurations and see the results instantly.

Password Generator Test

Passphrase Generator Test

Security & Privacy

Our API is designed with security and privacy as the top priorities:

๐Ÿ“ฑ Browser Support

Our API works in all modern browsers that support the Web Crypto API:

Frequently Asked Questions

Q: Is there a rate limit for the API?

A: No, there are no rate limits. Since all generation happens client-side, you can generate as many passwords as needed without restrictions.

Q: Can I use this API in commercial applications?

A: Yes, our API is free to use in both personal and commercial applications. We only ask that you don't resell our API as a service.

Q: How do I handle errors in my application?

A: Our API throws descriptive errors for invalid parameters. Always wrap API calls in try-catch blocks for production use.

Q: Can I customize the character sets?

A: Currently, we provide predefined character sets for security reasons. Contact us if you need custom character sets for specific use cases.