Skip to main content

Endpoint

POST https://api.bunny.build/api/v1/random-password/generate

Authentication

HeaderRequiredValue
X-API-KeyYesYour API key (bun_...)
Content-TypeYesapplication/json

Overview

Generate cryptographically secure random passwords on demand. Bunny’s Password Generator lets you control length and character sets (uppercase, lowercase, numbers, and symbols) and returns the password alongside its charset size and entropy in bits so you can enforce your own strength policy.

Use cases

  • Generate temporary passwords for new user accounts
  • Power password suggestion UI in signup flows
  • Create secure API tokens and secret keys
  • Automate credential generation in DevOps pipelines

Details

Length range: 4–256 characters. Entropy is calculated as floor(log2(charset_size) * length). If no character sets are specified, lowercase and numbers are used by default. All randomness is sourced from the platform’s cryptographically secure RNG.

Request body

FieldTypeRequiredDescription
lengthintegerNoPassword length (default: 16, range: 4–256)
uppercasebooleanNoInclude uppercase letters (default: true)
lowercasebooleanNoInclude lowercase letters (default: true)
numbersbooleanNoInclude digits (default: true)
symbolsbooleanNoInclude special characters (default: false)

Example

{
  "length": 16,
  "uppercase": true,
  "lowercase": true,
  "numbers": true,
  "symbols": true
}

Response

200 OK

FieldTypeDescription
passwordstringThe generated password
lengthintegerActual length of the password
charset_sizeintegerNumber of unique characters in the pool used for generation
entropy_bitsintegerPassword entropy in bits: floor(log2(charset_size) * length)
Example
{
  "password": "aB3$kLm9!Xz2#qRt",
  "length": 16,
  "charset_size": 88,
  "entropy_bits": 102
}

401 Unauthorized

{
  "detail": "Missing API key. Include X-API-Key header."
}

402 Payment Required

{
  "detail": "Monthly quota exceeded. Upgrade your plan."
}

422 Unprocessable Entity

Invalid parameters.
{
  "detail": "Length must be between 4 and 128"
}

429 Too Many Requests

{
  "detail": "Rate limit exceeded. Try again in 60 seconds."
}

cURL example

curl -X POST https://api.bunny.build/api/v1/random-password/generate \
  -H "X-API-Key: bun_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"length": 16, "uppercase": true, "lowercase": true, "numbers": true, "symbols": true}'