Password API

Description

Generate a random password based on your input parameters. For better security we recommend looking into using a Passphrase instead if your requirements allow for it.

Important:

For obvious security reasons, please make sure that the generated password is of sufficient strength depending on your application needs and use-case. Proper guidelines and recommendations can be found in this Wikipedia Article.

Endpoint

> GET https://api.jsonrepo.com/v1/compute/generator/password

Headers

Field Description
api_key Required Your API Key

Parameters

Field Type Description
length Integer Optional Length of generated password
Default: 14
Min: 6
Max: 40
lower_case String Optional Include lower case characters
Default: true
Set to false to disable
upper_case String Optional Include upper case characters
Default: true
Set to false to disable
numbers String Optional Include numbers
Default: true
Set to false to disable
specials String Optional Include special characters _-!@#$%^&*()[]
Default: true
Set to false to disable
repeat String Optional Include repeat characters
Default: true
Set to false to disable

Character Length & Repetition:

If repeat is set to false then length cannot be set to higher than the total number of characters enabled. Example: You cannot generate a non-repeating string of size 20 that contains only numbers as there are only 10 numbers in total (0-9).

Response

A successful request will result in a populated payload field with the expected output.

A failed request will result in an error output as detailed in Error Rules. If the endpoint validation fails due to missing, badly formatted or invalid parameters, the endpoint will return HTTP code 400 along with a message detailing the error.

See the examples section for more information.

Request

  • Curl
// Generate a password of `length` 20 with no `numbers`

curl -G \
https://api.jsonrepo.com/v1/compute/generator/password \
-H "api_key: {YOUR_API_KEY_HERE}" \
--data-urlencode "length=20" \
--data-urlencode "numbers=false"

Success Response

{
    "http_code": 200,
    "http_message": "Ok",
    "message": "Successful execution",
    "payload": {
        "password": "qF&$LRz#-HsNOu^YU]^q"
    }
}

Error Response Examples

// Request with badly formatted `length` parameter

{
    "http_code": 400,
    "http_message": "Bad Request",
    "message": "Malformed request: `length` parameter must be between 6 (min) and 40 (max). Default is 14.",
    "payload": []
}

// Request with all characters turned off

{
    "http_code": 400,
    "http_message": "Bad Request",
    "message": "Malformed request: All character-sets are disabled. Password cannot be generated.",
    "payload": []
}

// Request with `repeat=false` and not enough characters

{
    "http_code": 400,
    "http_message": "Bad Request",
    "message": "Malformed request: Enabled charsets are too small for `length`. Cannot generate non-repeating password.",
    "payload": []
}