Skip to content

UUID Generation

The /uuid endpoint generates random UUID v4 values, or parses an existing UUID to extract its version and variant.

How it works?

The endpoint has two modes. When uuid is provided, it switches to parsing and count is ignored. Otherwise it generates count random UUID v4 values (a single one by default). A malformed UUID is not an error: it is returned with valid: false and null components.

Parameters

ParameterRequiredDescription
uuidNoUUID to parse. When provided, nothing is generated and count is ignored
countNoNumber of UUIDs to generate, an integer between 1 and 50. Default: 1

UUID Variants

The variant is derived from the first character of the fourth group:

CharacterVariant
07NCS
8bRFC 4122
cdMicrosoft
efFuture

Response Fields

Single UUID (generated, or count of 1):

FieldTypeDescription
uuidstringThe generated UUID
versionnumberUUID version — always 4 when generated
variantstringAlways RFC 4122 when generated

Batch (count greater than 1):

FieldTypeDescription
uuidsstring[]Array of generated UUID v4 values
countnumberNumber of UUIDs returned

Parsing (uuid provided):

FieldTypeDescription
uuidstringThe original input UUID
versionnumber|nullUUID version, null if the input is not a valid UUID
variantstring|nullUUID variant, null if the input is not a valid UUID
validbooleanWhether the input matches the UUID format

Code Examples

curl -X GET \
  "https://api.sylvain.sh/v5/uuid?count=3"

Try It

Error Handling

If parameters are missing or invalid, the API will return an error:

Error MessageDescription
Please provide a valid UUID (?uuid={uuid})The uuid parameter is not a single string value
Count must be a numberThe count value is not a number
Count must be between 1 and 50The count value is not an integer between 1 and 50