> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ns.rocks/llms.txt
> Use this file to discover all available pages before exploring further.

# Destroy

> Tear down a machine when work is complete.

Destroy stops a machine and releases its active runtime resources. Use it when
you do not need the current VM state anymore, or after you have hibernated or
copied out the state you want to keep.

## What state changes

* The machine leaves the running set and stops accepting commands.
* Public port routing for that machine is removed.
* Shared volumes and snapshots remain independent resources until deleted.

## Usage

<CodeGroup>
  ```python Python SDK theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  from nullspace import Machine

  machine = Machine.create(template="base")
  try:
      print(machine.commands.run("hostname", shell=True).stdout.strip())
  finally:
      machine.kill()
  ```

  ```bash CLI theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  nullspace machine kill mch_123
  ```

  ```bash HTTP API theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  curl -fsS -X DELETE \
    -H "Authorization: Bearer ${NULLSPACE_API_KEY}" \
    "${NULLSPACE_API_URL}/v1/machines/${MACHINE_ID}"
  ```
</CodeGroup>

API reference: [destroyMachine](../api-reference) (`DELETE /v1/machines/{id}`).

Guide: [Machines](../guides/python-sdk/machines). Example:
[Examples](../examples).
