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-f2ce12544465the 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-aeb6440f09bbv4
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":"a5daa645-8680-4d92-93ca-bbb54aca7467"}
then voilà, a v4 uuid.
v7
to generate a v7 uuid, use the v7 endpoint:
> curl https://uuid.ninja/api/v7
{"result":"019a3531-ec6e-7000-80d2-32af975c7736"}
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.