What is a UUID?
A Universally Unique Identifier, a 128-bit value formatted as 32 hex digits with hyphens, used as a globally unique key without coordination between systems.
Also known as: Universally Unique Identifier, GUID
A UUID looks like f47ac10b-58cc-4372-a567-0e02b2c3d479. The 128-bit space is large enough that a system can mint UUIDs locally and trust they will never collide with another system's, no central registry required. That property is why UUIDs are the default primary key in most distributed systems and event-driven architectures.
There are several versions. v4 is random and the most common: 122 bits of entropy, generated from a CSPRNG. v1 embeds a timestamp and MAC address; v7 (newer) embeds a unix timestamp at the front so the IDs sort in time order, which plays better with B-tree indexes. v5 derives a UUID deterministically from a name plus a namespace, useful for stable IDs derived from external keys.
For APIs and brand data, UUIDs are the workhorse identifier for resources: every brand, every logo asset, every webhook delivery gets one. The tradeoff vs auto-incrementing integers is size (16 bytes vs 4 or 8) and index locality (random UUIDs hurt B-tree performance under heavy insert load), which is why v7 / ULIDs / KSUIDs exist as time-ordered alternatives.
In the wild
- A REST API returning resources keyed by
id: "f47ac10b-58cc-4372-a567-0e02b2c3d479" - An idempotency key generated as a UUIDv4 by the client to dedupe retries
- Postgres tables using
uuidcolumns as primary keys to allow sharding without ID collisions