Skip to main content

Delete

Deletes an existing tenant.

Examples​

Basic usage:

octo-cli -c Delete -tid "newtenant"

Non-interactive:

octo-cli -c Delete -tid "newtenant" -y

Clean up a scratch tenant: switch its capabilities off, then delete it:

octo-cli -c Delete `
-tid "scratch1" `
-df `
-y

Options​

ShortLongRequiredDescription
-tid--tenantIdyesId of tenant
-y--yesnoSkip confirmation prompt
-df--disable-featuresnoSwitch off every capability the tenant has enabled (Stream Data, Communication, Reporting, AI Services) with your token for that tenant, then delete it. Requires -y.
-ofo--override-foreign-ownershipnoDeliberately drop a tenant database that only carries the ownership marker of another OctoMesh instance (an orphaned marker: no other instance registers it; refused without this flag). The service logs the override. Never drops another instance's system database or a database another instance still registers.

Notes​

Refused with HTTP 409 while Stream Data, Communication, Reporting or AI Services is still enabled for the tenant; the error names the enabled capabilities. Disable them first with DisableStreamData / DisableCommunication / DisableReporting / DisableAi. Those commands act on the tenant of the active context, so switch to the tenant being deleted with UseContext or pass --context <name> - or let --disable-features do it.

--disable-features switches off every enabled capability for you and deletes the tenant afterwards. The capability endpoints belong to the tenant's own administrator, so the command uses YOUR token for the tenant being deleted: with a client-credentials session (OCTO_CLI_CLIENT_ID and a secret set) the client's mirror in that tenant - the creator of a scratch tenant (Create --scratch) is its administrator - authenticates with OCTO_CLI_CHILD_CLIENT_SECRET (the secret of the mirror in the child) when set, else with OCTO_CLI_CLIENT_SECRET, which only works while the child still accepts the inherited parent secret; with a user session the user's token is exchanged for the tenant and the user must be its administrator. It requires -y, prints the capabilities it switched off, and never deletes archives: when Stream Data stays enabled because archives are still activated, the command reports them, does NOT delete the tenant and exits with an error (DisableArchive keeps the data, DeleteArchive removes the archive).

If the tenant's data is still needed, take a backup with Dump before disabling the capabilities and deleting; Dump works regardless of capability state.

Answers 404 when the tenant is not a child of the current tenant.

A 409 is also answered while the tenant is still being created; that message names the lifecycle state, not capabilities - retry once the tenant is active or failed.

A delete whose database belongs to another OctoMesh instance on the same MongoDB server (its ownership marker names another instance, or another instance's system database registers it) is refused with the uniform 409 "Database name '...' is not available."; the owner is in the server log only. To end a double registration, Detach the tenant in the instance that does not use it - detach keeps the database. --override-foreign-ownership drops a database with an orphaned foreign marker (no other instance registers it) deliberately and is logged by the service; another instance's system database and a database another instance still registers are never dropped.