When to Use UUIDs vs Sequential IDs in Apps and APIs
2026-05-06
Trade-offs between UUID v4, database sequences, and exposing identifiers in URLs or public APIs.
Random UUIDs reduce guessable resource URLs and work well when merging data from multiple systems.
They are wider and less human-friendly than integers, which can matter for logs and support tickets.
v4 UUIDs assume randomness from a secure source; do not roll your own short tokens for security-sensitive IDs.
Pick one strategy per resource type and document itβmixing styles confuses clients and migrations.