uuid ninja has a simple API that can be used to easily generate a uuid from anywhere that is capable of issuing an http request.
the API looks for an Accept
header. the supported response types are application/json
and text/plain
. the API defaults to JSON responses.
the available endpoints are as follows:
v3 / v5
the v3 endpoint allows you to generate a v3 uuid:
curl \
-H "Accept: text/plain" \
https://uuid.ninja/api/v3/67819eb0-8e4e-4b16-ac0c-963a1f8ecbd9/foo
50da134d-b08f-3157-8315-f2ce12544465
the expected URL is: /api/v3/<namespace uuid>/<name>
to generate a v5 uuid, the URL is almost the exact same, except that v3
should be replaced with v5
.
> curl \
-H "Accept: text/plain" \
https://uuid.ninja/api/v5/67819eb0-8e4e-4b16-ac0c-963a1f8ecbd9/foo
3f56b884-e5d1-5540-b182-aeb6440f09bb
v4
to generate a v4 uuid, is simpler, since no input is required. simply send a request to the v4 endpoint:
> curl https://uuid.ninja/api/v4
{"result":"c3abb8ae-ff8a-4e8c-8032-df9bbae5832e"}
then voilà, a v4 uuid.
v7
to generate a v7 uuid, use the v7 endpoint:
> curl https://uuid.ninja/api/v7
{"result":"0195f473-217e-7000-806a-674975c1d486"}
the endpoint accepts a seq
parameter that is a number that allows the providing of your own sequence.
if no seq
is provided, then an internal sequence is used.