Deleting tenants
Deleting a tenant is permanent. Truto enforces one important guard: a tenant with any integrated accounts can't be deleted. Delete (or bulk-delete) its accounts first, then delete the tenant.
Skip the reading — fast path for coding agents
truto tenants list
/skill truto
The delete guard
DELETE /tenant/:id returns 409 Conflict with the message "Can't delete tenant with connected accounts." if any integrated account still references this tenant in this environment. This is a hard rule enforced by the API — the same guard runs whether you're calling from the dashboard, API, or CLI.
The guard keeps a tenant's accounts and their credentials from being left behind under a tenant you no longer track.
If the tenant uses the Connections widget, revoke its sessions before you delete it, with DELETE /session-token ({"tenant_id": "acme-corp"}) or truto session-tokens revoke --tenant-id acme-corp. Deleting the tenant doesn't end them, and a widget left open can connect a new account and re-create the tenant. See Renew, inspect, and revoke sessions.
From the dashboard
- Open Tenants.
- Click into the tenant you want to delete. The detail page lists every integrated account owned by this tenant.
- If the tenant has integrated accounts:
- Select accounts individually with the checkbox column, or click the header checkbox to select all.
- Click Delete N selected and confirm.
- When the tenant has no accounts, open the … menu on its row in the Tenants list and choose Delete, then confirm. Delete is greyed out while any account remains.
The tenant is gone from the list. This is an irreversible operation.
From the API
Delete a tenant that has no accounts:
curl --location --request DELETE 'https://api.truto.one/tenant/acme-corp' \
--header 'Authorization: Bearer <your-api-token>'# Asks you to confirm; add -f to skip the prompt
truto tenants delete acme-corpdeleted = await truto_api.tenants.delete("acme-corp")Response (200 OK):
{ "id": "acme-corp", "environment_id": "…", "name": "Acme Corp", "metadata": { "tier": "gold" }, "created_at": "…", "updated_at": "…" }If the tenant still has accounts (409 Conflict):
{ "statusCode": 409, "error": "Conflict", "message": "Can't delete tenant with connected accounts." }Bulk-deleting accounts first
If the tenant has many accounts, delete them with POST /integrated-account/bulk-delete (capped at 1000 accounts per request — repeat until matched_count < 1000):
curl --location 'https://api.truto.one/integrated-account/bulk-delete' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your-api-token>' \
--data '{
"tenant_id": "acme-corp"
}'Response:
{
"deleted_count": 3,
"matched_count": 3,
"deleted_integrated_account_ids": ["79a39d69-e27e-49cb-b9a9-79f5eea7aa26", "…", "…"],
"matched_integrated_account_ids": ["79a39d69-e27e-49cb-b9a9-79f5eea7aa26", "…", "…"]
}Or delete up to 99 accounts by ID per request:
{ "ids": ["79a39d69-e27e-49cb-b9a9-79f5eea7aa26", "0c74a4ad-7b8e-4f3a-9c1d-2e4f5a6b7c8d"] }Exactly one of tenant_id or ids must be supplied. The tenant_id branch is capped at 1000 accounts per request; if the tenant has more, repeat the call until matched_count is less than 1000. Once all accounts are gone, DELETE /tenant/:id succeeds.
From the CLI
# List the accounts first
truto accounts list --tenant-id acme-corp
# Delete them via bulk-delete (curl; no CLI subcommand yet), then delete the tenant
# curl -X POST https://api.truto.one/integrated-account/bulk-delete \
# -H "Authorization: Bearer $TRUTO_API_TOKEN" -H 'Content-Type: application/json' \
# -d '{"tenant_id":"acme-corp"}'
# -f skips the confirmation prompt
truto tenants delete acme-corp -fSee Admin resources — Tenants.
Recovery
There is no undelete. If you delete a tenant and need it back, re-create it with the same id; it comes back with a new created_at and no metadata. Integrated accounts that referenced it are already gone — they don't come back with the tenant.
Next
To re-create a tenant, or create new ones one at a time or in bulk, see Creating tenants and Bulk import.