Password Generator API

The Password Generator API auto-generates random passwords that are incredibly hard to guess.

/v1/passwordgenerator GET

https://api.api-ninjas.com/v1/passwordgenerator

Returns a random password string adhering to the specified parameters.


Parameters

  • length  optional

    Length of password in characters. If not set, a default value of 16 is used.

  • exclude_numbers  optional

    Whether 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  optional

    Whether to exclude special characters(!@#$%^&*()) from the password. Must be either true or false. If not set, a default value of false will be used.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

length
https://api.api-ninjas.com/v1/passwordgenerator?length=16

Sample Response

JSON
1 2 3 { "random_password": "nYs43u5f1oGK9*g5" }

Code Examples

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.