> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bunny.build/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /uuid-generator

> Generate UUIDs, NanoIDs, and ULIDs in bulk. Supports v4, v7, nanoid, and ulid formats.

## Endpoint

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

## Authentication

| Header         | Required | Value                    |
| -------------- | -------- | ------------------------ |
| `X-API-Key`    | Yes      | Your API key (`bun_...`) |
| `Content-Type` | Yes      | `application/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

| Field      | Type   | Required | Description                                                            |
| ---------- | ------ | -------- | ---------------------------------------------------------------------- |
| `type`     | string | No       | ID format: `v4`, `v7`, `nanoid`, or `ulid` (default: `v4`)             |
| `count`    | number | No       | Number of IDs to generate (default: 1, max: 100)                       |
| `size`     | number | No       | Length of each NanoID (default: 21, only used when `type` is `nanoid`) |
| `alphabet` | string | No       | Custom character set for NanoID (only used when `type` is `nanoid`)    |

### Example

```json theme={null}
{
  "type": "v4",
  "count": 3
}
```

## Response

### 200 OK

| Field   | Type      | Description                                                        |
| ------- | --------- | ------------------------------------------------------------------ |
| `type`  | string    | The requested ID type                                              |
| `count` | number    | The number of IDs generated                                        |
| `ids`   | string\[] | Array of generated identifiers                                     |
| `id`    | string    | The first generated identifier (convenience shortcut for `ids[0]`) |

**Example**

```json theme={null}
{
  "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

```json theme={null}
{
  "detail": "Missing API key. Include X-API-Key header."
}
```

### 402 Payment Required

```json theme={null}
{
  "detail": "Monthly quota exceeded. Upgrade your plan."
}
```

### 422 Unprocessable Entity

```json theme={null}
{
  "detail": "Invalid type. Must be one of: v4, v7, nanoid, ulid"
}
```

### 429 Too Many Requests

```json theme={null}
{
  "detail": "Rate limit exceeded. Try again in 60 seconds."
}
```

## cURL example

```bash theme={null}
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}'
```
