Delete a User API

On this page

This API is used to delete a User. You must specify the Id of the User on the URI. You can also specify whether or not the User is soft or hard deleted. A soft delete deactivates the User. A hard delete permanently deletes a User's data.

Soft deleted users are marked as inactive but not deleted from FusionAuth. Deactivated users have their data retained but they are unable to authenticate. Users who have been deactivated can be reactivated; see Reactivate a User for more.

The data of a User who has been hard deleted is permanently removed from FusionAuth. The User's data cannot be restored via the FusionAuth API or the Admin UI. If you need to restore the User's data, you must retrieve it from a database backup.

Request#

Choose a soft delete to deactivate the User, or add hardDelete=true to permanently remove their data.

API Key Authentication
Deactivate a User (Soft Delete)
DELETE/api/user/{userId}
OpenAPI Spec
API Key Authentication
Permanently Delete a User
DELETE/api/user/{userId}?hardDelete=true
OpenAPI Spec

Path Parameters#

userId
  • Type: UUID
  • Required

The Id of the User to delete.

Query Parameters#

hardDelete
  • Type: Boolean
  • Optional
  • Defaults to false

To Permanently delete a user from FusionAuth set this value to true. Once a user has been permanently deleted, the action cannot be undone. When this value is set to false the user is marked as inactive and the user will be unable log into FusionAuth. This action may be undone by reactivating the user.

Request Headers#

X-FusionAuth-TenantId
  • Type: String
  • Optional

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon other values in the request or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See Making an API request using a Tenant Id for additional information.

Request Body#

eventInfo
  • Type: Object
  • Optional

Information about the request. FusionAuth adds the information to the events the request triggers, as event.info. For more information, see Pass Context From API Requests to Webhooks.

eventInfo.data
  • Type: Object
  • Optional

An object that holds any JSON you choose, such as a trace Id. FusionAuth copies the object to event.info.data without changes.

eventInfo.deviceDescription
  • Type: String
  • Optional

A description of the end user's device.

eventInfo.deviceName
  • Type: String
  • Optional

The name of the end user's device.

eventInfo.deviceType
  • Type: String
  • Optional

The type of the end user's device.

eventInfo.ipAddress
  • Type: String
  • Optional

The IP address of the end user. When your server calls FusionAuth for the end user, set this value to the end user's IP address. When this value is omitted, FusionAuth uses the IP address of the client that sent the request.

eventInfo.os
  • Type: String
  • Optional

The operating system of the end user's device.

eventInfo.userAgent
  • Type: String
  • Optional

The user agent of the end user's browser.

Response#

This API does not return a JSON response body.

Response Codes
CodeDescription
200The request succeeded.
400The request was invalid or malformed. The response contains an Errors JSON object with the specific errors. FusionAuth also returns a 400 when the request needs a paid FusionAuth license and no license is present.
401FusionAuth didn't authorize the request. The Authorization header is missing, the API key isn't valid, or the API key doesn't have permission for this endpoint and method. The response is empty. For more information, see Unauthorized Responses.
404The object you requested doesn't exist. The response is empty.
500FusionAuth had an internal error and logged a stack trace in the FusionAuth log files. The response is empty.
503The search index is unavailable or returned an error, so FusionAuth can't complete the request. The response contains a JSON body.
504One or more webhook endpoints returned an invalid response or didn't respond. Because of the transaction configuration for the event, FusionAuth can't complete the request. FusionAuth logs a stack trace in the FusionAuth log files.