generateID.dev

A fast, secure, and developer-friendly ID generation service built on Cloudflare Workers

CUID2

Secure & Collision-resistant

Next-generation GUIDs that are secure, collision-resistant, and sortable. Perfect for distributed systems.

Length: 24 chars
Format: ch72gsb320000udocl363eofy
Generate CUID2

NanoID

Tiny & URL-friendly

Tiny, secure, URL-friendly unique string ID generator. Compact and perfect for short identifiers.

Length: 21 chars
Format: V1StGXR8_Z5jdHi6B-myT
Generate NanoID

UUID v4

Standard & Universal

Universally unique identifiers following RFC 4122. Industry standard for unique identification.

Length: 36 chars
Format: 550e8400-e29b-41d4-a716-446655440000
Generate UUID

Why use generateID.dev?

✓

Cryptographically Secure

All generators use secure random number generation

✓

Global Edge Performance

Built on Cloudflare Workers for worldwide speed

✓

No Authentication Required

Simple REST API endpoints ready to use

✓

Open Source

Built with trusted open-source libraries

✓

Developer Friendly

Clean API design with comprehensive documentation

✓

Multiple ID Types

Choose the right ID format for your use case

API Documentation

COMPLETE ENDPOINT REFERENCE • PARAMETER OPTIONS • USAGE EXAMPLES

CUID2 Endpoints

Generate default CUID2 (24 characters)

Generates a cryptographically secure, collision-resistant identifier that's sortable by creation time.

GET /cuid2

Response: ch72gsb320000udocl363eofy (24 characters)

Generate CUID2 with custom length (1-100 characters)

Creates a CUID2 and truncates it to your specified length. Useful for shorter identifiers while maintaining security.

GET /cuid2/{length}

Parameters: length - Integer between 1 and 100

Examples

GET /cuid2/12
GET /cuid2/32
GET /cuid2/100

Sample responses: ch72gsb3200 (12 chars), ch72gsb320000udocl363eofy (32 chars)

Advanced Configuration

Configure CUID2 with custom length and fingerprint for distributed systems. All parameters are optional and fall back to defaults.

# With fingerprint only
GET /cuid2?fingerprint=my-app-v1

# With length and fingerprint
GET /cuid2/16?fingerprint=production-server-01

# POST with full configuration
POST /cuid2
{
  "length": 32,
  "fingerprint": "production-server-01"
}

# Fallback to default CUID2
GET /cuid2
POST /cuid2
{}

Parameters: length (1-100, optional), fingerprint (optional string for host identification). If no parameters are provided, generates a standard CUID2.

CUID2 Features

  • Cryptographically secure: Uses secure random number generation
  • Collision-resistant: Extremely low probability of duplicate IDs
  • Sortable: Can be sorted chronologically by creation time
  • URL-safe: Contains only alphanumeric characters
  • Database-friendly: No special characters that could cause issues

Note: CUID2 doesn't natively support custom lengths, so we generate a full CUID2 and truncate it to your requested length. This maintains the cryptographic properties while allowing flexibility in length.

NanoID Endpoints

Generate default NanoID (21 characters)

Creates a compact, URL-friendly unique identifier using a cryptographically secure random generator.

GET /nanoid

Response: V1StGXR8_Z5jdHi6B-myT (21 characters)

Generate NanoID with custom length (1-100 characters)

Generates a NanoID of your exact specified length. Perfect for custom identifier requirements.

GET /nanoid/{length}

Parameters: length - Integer between 1 and 100

Examples

GET /nanoid/8
GET /nanoid/16
GET /nanoid/64

Sample responses: V1StGXR8 (8 chars), V1StGXR8_Z5jdHi6B (16 chars)

NanoID Features

  • Compact: Smaller than UUID while maintaining security
  • URL-safe: Uses A-Za-z0-9_- characters only
  • Customizable length: Generate IDs of any size you need
  • Fast generation: Optimized for high-performance applications
  • Zero dependencies: Lightweight and portable

Note: NanoID natively supports custom lengths and generates cryptographically secure IDs of any size. Each length maintains the same security properties.

UUID Endpoints

Generate default UUID v4

Creates a random UUID v4 following RFC 4122 standard. This is the most commonly used UUID version.

GET /uuid

Response: 550e8400-e29b-41d4-a716-446655440000 (36 characters)

Generate specific UUID version

Request a specific UUID version. Currently supports v1, v4, and v5 (all return v4 for now).

GET /uuid/{version}

Parameters: version - String: "v1", "v4", or "v5"

Examples

GET /uuid/v4
GET /uuid/v7

Sample responses: 550e8400-e29b-41d4-a716-446655440000 (v4), 018e0b8c-7c7c-7c7c-7c7c-7c7c7c7c7c7c (v7)

UUID Features

  • RFC 4122 compliant: Follows official UUID specification
  • Universally unique: Extremely low collision probability
  • Standard format: 8-4-4-4-12 character pattern
  • Widely supported: Compatible with all major systems
  • Database optimized: Many databases have native UUID support
  • Version 7 support: Time-ordered UUIDs with excellent performance

Note: UUID v4 provides random UUIDs, while v7 provides time-ordered UUIDs that are perfect for databases and time-series data. Both versions are fully implemented and production-ready.

Quick Examples

Basic usage

Generate default IDs of each type using simple HTTP requests.

curl https://generateid.dev/cuid2
curl https://generateid.dev/nanoid
curl https://generateid.dev/uuid

Response types: CUID2 (24 chars), NanoID (21 chars), UUID (36 chars)

With parameters

Customize ID lengths and versions for specific use cases.

curl https://generateid.dev/nanoid/16
curl https://generateid.dev/cuid2/12
curl https://generateid.dev/uuid/v4
curl https://generateid.dev/uuid/v7

Customization: NanoID length, CUID2 truncation, UUID version specification (v4, v7)

JavaScript

Integrate ID generation directly into your JavaScript applications.

const cuid2 = await fetch('https://generateid.dev/cuid2/16').then(r => r.text());
const nanoid = await fetch('https://generateid.dev/nanoid/32').then(r => r.text());
const uuid = await fetch('https://generateid.dev/uuid/v4').then(r => r.text());
const uuidv7 = await fetch('https://generateid.dev/uuid/v7').then(r => r.text());

Usage: Perfect for frontend apps, Node.js services, and browser-based tools

Python

Generate IDs from Python scripts and applications.

import requests

cuid2 = requests.get('https://generateid.dev/cuid2/16').text
nanoid = requests.get('https://generateid.dev/nanoid/32').text
uuid = requests.get('https://generateid.dev/uuid/v4').text
uuidv7 = requests.get('https://generateid.dev/uuid/v7').text

Shell Scripts

Use in bash scripts and command-line automation.

#!/bin/bash
ID=$(curl -s https://generateid.dev/nanoid/16)
echo "Generated ID: $ID"

Error Handling

Invalid length parameter (400 Bad Request)

When requesting a length outside the allowed range (1-100 characters).

GET /nanoid/999

Response: Error: Length must be between 1 and 100

Solution: Use a length between 1 and 100 characters

Invalid UUID version (400 Bad Request)

When requesting an unsupported UUID version.

GET /uuid/v6

Response: Error: Version must be v1, v4, or v5

Solution: Use v4 or v7 (both are fully implemented)

Rate limit exceeded (429 Too Many Requests)

When exceeding the rate limit of 100 requests per minute per IP address.

HTTP 429 Too Many Requests
{
  "error": "Rate limit exceeded",
  "requestId": "req_123456",
  "retryAfter": 45
}

Solution: Wait for the specified retry time or implement exponential backoff

Server errors (500 Internal Server Error)

Rare server-side errors that may occur during ID generation.

HTTP 500 Internal Server Error
{
  "error": "Internal server error",
  "requestId": "req_123456"
}

Solution: Retry the request or contact support if persistent

Best Practices

  • Always check HTTP status codes before processing responses
  • Implement retry logic with exponential backoff for 429 errors
  • Log request IDs for debugging and support requests
  • Validate parameters client-side to avoid 400 errors
  • Handle errors gracefully in your applications