The Password Generator API auto-generates random passwords that are incredibly hard to guess.
https://api.api-ninjas.com/v1/passwordgenerator
Returns a random password string adhering to the specified parameters.
length
optionalLength of password in characters. If not set, a default value of 16
is used.
exclude_numbers
optionalWhether to exclude numbers from the password. Must be either true
or false
. If not set, a default value of false
will be used.
exclude_special_chars
optionalWhether to exclude special characters(!@#$%^&*()
) from the password. Must be either true
or false
. If not set, a default value of false
will be used.
X-Api-Key
requiredAPI Key associated with your account.
https://api.api-ninjas.com/v1/passwordgenerator?length=16
1
2
3
{
"random_password": "nYs43u5f1oGK9*g5"
}
1
2
3
4
5
6
7
8
import requests
length = '16'
api_url = 'https://api.api-ninjas.com/v1/passwordgenerator?length={}'.format(length)
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)
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.