Password Generator API
The Password Generator API auto-generates random passwords that are incredibly hard to guess.
From 2,203 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 201ms | 242ms | 292ms | 477ms | 1090ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/passwordgenerator GET
https://api.api-ninjas.com/v1/passwordgenerator
Returns a random password string adhering to the specified parameters.
Parameters
lengthoptionalLength of password in characters. If not set, a default value of
16is used.exclude_numbersoptionalpremium onlyWhether to exclude numbers from the password. Must be either
trueorfalse. If not set, a default value offalsewill be used.exclude_special_charsoptionalpremium onlyWhether to exclude special characters(
!@#$%^&*()) from the password. Must be eithertrueorfalse. If not set, a default value offalsewill be used.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
random_passwordThe generated random password string.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/passwordgenerator?length=16Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/passwordgenerator?length=12&uppercase=true&lowercase=true&numbers=true&special=true" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Password Generator API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Password Generator API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Password Generator API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Password Generator API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.How do I control the length of the generated password?
Pass thelengthquery parameter to the/v1/passwordgeneratorendpoint to set the number of characters; if you omit it, a defaultlengthof16is used. See the full API documentation for details.Can I exclude numbers or special characters from the password?
Yes, set theexclude_numbersandexclude_special_charsparameters totrueto remove digits or special characters (!@#$%^&*()) from the output, though both are premium-only features available on a paid plan. By default both arefalse.What does the Password Generator API response include?
A successful request returns a JSON object with a singlerandom_passwordfield containing the generated password string, for examplenYs43u5f1oGK9*g5. If a request fails, you instead receive an error.What are some use cases for the Password Generator API?
It is ideal for creating strong, hard-to-guess passwords during account sign-up flows, resetting credentials, or seeding test data, and it pairs well with related tools like the Random User API and Random Word API for generating mock accounts.