Clerk adds Backend API endpoint to merge two users into one
Brief
Clerk launched a Backend API endpoint that merges a duplicate user into another user and deletes the duplicate, replacing a manual admin cleanup process.
What the merge moves
- Email addresses, phone numbers, connected accounts, passkeys, TOTP, backup codes, organization memberships and metadata transfer to the kept user.
- Where both users share a field — name, password, username, metadata key or organization role — the kept user's current value wins.
- The duplicate user is deleted after the merge.
Safety and tracking
- Merges are irreversible; pass dry_run: true to preview the merged user before committing.
- The response includes the deleted user as it was before the merge.
- A new user.merged webhook links the two users, and each merge is recorded in Admin Logs and Application Logs.
Restrictions
- A merge is rejected if either user is managed by Directory Sync.
- A merge is rejected if the user being deleted has an enterprise SSO account.
- The Backend API returns the reasons when it rejects a merge.
Generated by AI from the original article. Check the source for full details.