Skip to main content

Delete a tenant with the Java SDK

permit.api.tenants.delete() deletes a tenant from your Permit environment. A tenant is an isolated group of users and resources, such as one customer organization in a multi-tenant application. This reference is for Java developers who manage tenants 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 tenantKey) throws IOException, PermitApiError, PermitContextError

Parameters

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

Example

Replace [TENANT KEY OR ID] with the key or ID of the tenant to delete.

permit.api.tenants.delete("[TENANT KEY OR ID]");

Return value

delete() returns nothing (void).

warning

Deleting a tenant also deletes all data related to the tenant, including the role assignments scoped to the tenant.

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.