Hi @bill.poole
Welcome to the Auth0 Community!
You are asking whether the Auth0 Management API supports conditional writes, such as ETag/If-Match headers or version-based updates, so that concurrent updates to a user’s email cannot overwrite a newer change.
Summary: The Management API does not expose a documented conditional-write mechanism in the materials reviewed, so the practical protection is to use the API’s built-in uniqueness check and to avoid triggering a second write that resets verification state.
Root Cause: A write to PATCH /api/v2/users/{id} applies the last request it receives, and the API does not compare a version or timestamp before applying it. A delayed request from an earlier change can therefore arrive after a newer one, which matches the sequence you described.
Solution: Use the following controls to reduce the race window, then submit the conditional-write request through official channels.
- Rely on the duplicate-email check built into the API. If the new email already belongs to another user,
PATCH /api/v2/users/{id}returns400 Bad RequestwitherrorCode: auth0_idp_errorand leaves the original profile unchanged. You do not need a separate read-then-write lookup for that case. - Expect the same-email case to return
200 OKwithout changingemail_verified, so a retried request with an unchanged value is safe. - Avoid a second write that flips verification state. The Auth0 Community reported a case where another function updated the same user after the Management API call and reset
email_verifiedtotrue. Route all email writes for a user through one service so no other process updates the profile in between. - Serialize writes per user at the application layer, for example with a per-user lock or a single queue consumer, so only one outbox message for a given user is in flight at a time. This narrows the window but, as you noted, does not remove it without server-side support.
- Submit the conditional-write request to Auth0 through the Auth0 Community feature requests area or your account team, and include your transactional outbox scenario as the use case.
Kind Regards,
Nik