Skip to main content

deleteUser()

Delete a user. Requires a service_role key.

This function should only be called on a server. Never expose your service_role key in the browser.

const { data: user, error } = await supabase.auth.api.deleteUser(
'715ed5db-f090-4b8c-a067-640ecee36aa0',
'YOUR_SERVICE_ROLE_KEY'
)

Parameters#

  • uidrequiredstring

    The user uid you want to remove.

  • jwtrequiredstring

    A valid JWT. Must be a full-access API key (e.g. service_role key).

Notes#

  • Requires a service_role key.
  • This function should be called on a server. Never expose your service_role key in the browser.

Examples#

Remove a user completely.#

const { data: user, error } = await supabase.auth.api.deleteUser(
'715ed5db-f090-4b8c-a067-640ecee36aa0',
'YOUR_SERVICE_ROLE_KEY'
)