Skip to main content

Delete a tenant with the Node.js SDK

permit.api.tenants.delete() deletes a tenant, identified by key or ID, from the Permit.io environment that your Node.js SDK client is connected to. This reference is for backend developers who remove tenants from code, for example when a customer account closes.

Prerequisites

Method signature

MethodSignatureStatus
permit.api.tenants.deletedelete(tenantKey: string): Promise<void>Recommended
permit.api.deleteTenantdeleteTenant(tenantId: string): Promise<AxiosResponse<void>>Deprecated alias

Parameters

NameTypeRequiredDescription
tenantKeystringYesKey or ID of the tenant to delete.

Example

await permit.api.tenants.delete(tenantKey);

Return value

permit.api.tenants.delete() resolves to undefined when the tenant is deleted. The deprecated permit.api.deleteTenant() resolves to the Axios response of the delete request.

If the tenant doesn't exist or the Permit API returns another error status code, permit.api.tenants.delete() throws a PermitApiError. The deprecated permit.api.deleteTenant() rethrows the underlying Axios error.