# deleteTenant

Audience: Programmer

Manually delete a tenant by setting deleted_at via soft-delete.

Manually delete a tenant by setting deleted_at via soft-delete. This
triggers the soft-delete half of the tenant lifecycle — the row
remains in the database and can be reactivated via restoreTenant
during the grace period. Nothing hard-deletes the row, so the tenant
keeps its name for good.

The target tenant is named by input.tenantId. The caller must hold
ROLE_ADMIN on it; ROLE_SYSTEM satisfies this for system flows. A
tenant in any registration status can be deleted; a registration
that is still running (status pending) notices the delete itself and
deactivates the organization it created. No other registration can
take the tenant's name.

**Served by:** [management](https://docs.pyck.cloud/latest/api/services/management.md)

## Arguments

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `input` | [DeleteTenantInput](https://docs.pyck.cloud/latest/api/inputs/deletetenantinput.md)! |  |  |

## Returns

[DeleteTenantResponse](https://docs.pyck.cloud/latest/api/types/deletetenantresponse.md)!

## Example

Manually triggers the soft-delete half of the tenant lifecycle by setting deleted_at. The tenant-lifecycle NATS subscriber observes the resulting CRUD event and starts DisableTenantWorkflow to deactivate the Zitadel org. A registration that is still running notices the delete itself. Returns an error when the tenant does not exist; idempotent on already-deleted tenants. The tenant row stays in the database and can be reactivated via restoreTenant during the grace period. The caller must hold ROLE_ADMIN on input.tenantId.

```graphql
mutation DeleteTenant($input: DeleteTenantInput!) {
  deleteTenant(input: $input) {
    success
  }
}
```

**Variables**

```json
{
  "input": {
    "tenantId": "<tenant ID>"
  }
}
```
