Orlixio

7 min read

What is a UUID

UUIDs are standardized identifiers that can be generated independently with a very low chance of collision.

Table of contents

  1. The purpose of UUIDs
  2. UUID v4
  3. Identifiers are not permissions
  4. Using UUIDs well

The purpose of UUIDs

A UUID is a standardized identifier format designed to be unique without a central counter. This is useful in distributed systems where multiple services, clients, or databases need to create identifiers independently.

UUIDs are easy to recognize because they use groups of hexadecimal characters separated by hyphens. They are longer than sequential IDs, but they avoid coordination problems.

UUID v4

UUID v4 values are random. They do not encode creation time, machine identity, or sequence. That makes them useful for fixtures, API examples, local records, and many production systems that prefer non-sequential identifiers.

Because random UUIDs do not sort by creation time, they may not be ideal for every database index or event stream. Some systems choose time-sortable IDs for that reason.

Identifiers are not permissions

A UUID can be hard to guess, but it should not be the only thing protecting a resource. Applications still need authentication and authorization. Treat identifiers as labels, not proof that a caller has access.

When sharing examples, UUIDs are usually safe as fake data. Real production IDs can still reveal relationships or internal records, so use judgment in screenshots and tickets.

Using UUIDs well

Use UUIDs consistently in an API if that is the chosen identifier format. Document whether clients should generate IDs or wait for the server. Avoid mixing UUIDs, numeric IDs, and custom strings in the same field without a good reason.

For sample JSON, generated UUIDs make fixtures look realistic without requiring a database.

Related guides

FAQ

What does UUID stand for?

UUID stands for Universally Unique Identifier.

What is UUID v4?

UUID v4 is a random UUID version commonly used for generated identifiers.

Are UUIDs secret?

No. UUIDs identify values but should not be treated as authorization secrets.

Can UUIDs collide?

Random UUID v4 collisions are extremely unlikely but not mathematically impossible.