Remove an individual user from a server-side admin workflow
Account administration
Clerk · Module
Deletes a Clerk user by ID through the Backend API. The method accepts a user ID and returns a promise for the deleted User.
Call clerkClient.users.deleteUser() with the target user's Clerk ID from trusted server-side code. The SDK wraps Clerk's Backend API deletion endpoint, resolves to the deleted User, and requires the SDK's configured authentication credentials.
function deleteUser(userId: string): Promise<User>| Name | Type | Description |
|---|---|---|
userId | string | The ID of the user to delete. |
Promise<User> resolving to the deleted User.
import { clerkClient } from '@clerk/express'
export async function DELETE(request: Request) {
const userId = new URL(request.url).searchParams.get('userId')
if (!userId) return new Response('Missing userId', { status: 400 })
await clerkClient.users.deleteUser(userId)
return Response.json({ success: true })
}Deletes the user identified by the query-string userId and returns a success response.
Account administration
Privacy requests
Lifecycle cleanup
deleteUser() accept and return?deleteUser(userId: string) accepts the Clerk user ID and returns a Promise<User>. It deletes the specified user through Clerk's Backend API.
Follow-up: Which backend endpoint does the SDK wrap? It wraps DELETE/users/{user_id}.
Use clerkClient.users.deleteUser(userId) from server-side code. The userId must identify the user to delete.
Follow-up: How would you delete a user without the SDK? Send an authenticated HTTP DELETE request to Clerk's user endpoint using the Secret Key.
The method deletes a single user programmatically. Clerk's documentation explicitly says bulk deletion cannot currently be performed programmatically.
Follow-up: What should an application do for a bulk-delete requirement? Contact Clerk Support, as recommended by the documentation.
clerkClientgetUser()createUser()Backend APIBAPI endpoint