Skip to main content

Delete a user with the Java SDK

permit.api.users.delete() deletes a user from your Permit environment. This reference is for Java developers who keep Permit users in sync with their identity provider from code. The examples assume an initialized Permit client named permit, as set up in Check permissions with the Java SDK.

Signature

void delete(String userKey) throws IOException, PermitApiError, PermitContextError

Parameters

ParameterTypeRequiredDescription
userKeyStringYesThe key or the ID (UUID) of the user. The Permit API accepts either value.

Example

Replace [USER KEY OR ID] with the key or ID of the user to delete.

permit.api.users.delete("[USER KEY OR ID]");

Return value

delete() returns nothing (void).

warning

Deleting a user also deletes all data related to the user, including the user's role assignments and attributes.

Exceptions

All exception classes except IOException are in the io.permit.sdk.api package.

ExceptionThrown when
IOExceptionThe HTTP request to the Permit API fails, for example because of a network error.
PermitApiErrorThe Permit API returns an error status code. getResponseCode() returns the HTTP status code and getRawResponse() returns the response body.
PermitContextErrorThe SDK context does not include an environment, for example because the API key is scoped to an organization or project.