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

# vastai cleanup machine

> Host command

Remove all expired storage instances from the machine, freeing up space

<Note>This is a **host** command, used for managing machines you are renting out on Vast.ai.</Note>

## Usage

```bash theme={null}
vastai cleanup machine ID [options]
```

## Arguments

<ParamField path="id" type="integer" required>
  id of machine to cleanup
</ParamField>

## Description

Instances expire on their end date. Expired instances still pay storage fees, but can not start.
Since hosts are still paid storage fees for expired instances, we do not auto delete them.
Instead you can use this CLI/API function to delete all expired storage instances for a machine.
This is useful if you are running low on storage, want to do maintenance, or are subsidizing storage, etc.

## Examples

```bash theme={null}
vastai cleanup machine <ID>
```

## Global Options

The following options are available for all commands:

| Option          | Description                                           |
| --------------- | ----------------------------------------------------- |
| `--url URL`     | Server REST API URL                                   |
| `--retry N`     | Retry limit                                           |
| `--raw`         | Output machine-readable JSON                          |
| `--explain`     | Verbose explanation of API calls                      |
| `--api-key KEY` | API key (defaults to `~/.config/vastai/vast_api_key`) |
