Skip to main content

Endpoint

POST https://api.bunny.build/api/v1/uuid-generator

Authentication

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

Overview

Generate cryptographically random unique identifiers in four formats: UUID v4, UUID v7 (time-ordered), NanoID, and ULID. Request up to 100 IDs in a single call to batch-seed databases, test fixtures, or distributed systems.

Use cases

  • Generate primary keys for database records
  • Create time-sortable IDs with UUID v7 or ULID
  • Produce short, URL-safe IDs with NanoID
  • Bulk-seed test data with unique identifiers

Details

Supported types: v4 (random UUID), v7 (time-ordered UUID per RFC 9562), nanoid (21-character URL-safe string), ulid (26-character sortable identifier). The count parameter defaults to 1 and is capped at 100.

Request body

FieldTypeRequiredDescription
typestringNoID format: v4, v7, nanoid, or ulid (default: v4)
countnumberNoNumber of IDs to generate (default: 1, max: 100)
sizenumberNoLength of each NanoID (default: 21, only used when type is nanoid)
alphabetstringNoCustom character set for NanoID (only used when type is nanoid)

Example

{
  "type": "v4",
  "count": 3
}

Response

200 OK

FieldTypeDescription
typestringThe requested ID type
countnumberThe number of IDs generated
idsstring[]Array of generated identifiers
idstringThe first generated identifier (convenience shortcut for ids[0])
Example
{
  "type": "v4",
  "count": 3,
  "ids": [
    "550e8400-e29b-41d4-a716-446655440000",
    "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    "7c9e6679-7425-40de-944b-e07fc1f90ae7"
  ],
  "id": "550e8400-e29b-41d4-a716-446655440000"
}

401 Unauthorized

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

402 Payment Required

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

422 Unprocessable Entity

{
  "detail": "Invalid type. Must be one of: v4, v7, nanoid, ulid"
}

429 Too Many Requests

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

cURL example

curl -X POST https://api.bunny.build/api/v1/uuid-generator \
  -H "X-API-Key: bun_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"type": "v4", "count": 3}'