Preferably, you would design you APIs and services to be idempotent (ie. use PUT not POST etc.)
Using idempotency identifier is the last resort in my book.
Still, UUID is probably the simplest and most reliable way to generate such idempotency identifiers.
How is URI not an idempotency identifier for PUT?
Still, UUID is probably the simplest and most reliable way to generate such idempotency identifiers.