# The VM object

> A VM. Create, get, update, the actions and copy answer with it; list answers with a list of it.

```json Example
{
  "name": "web1",
  "tenant": "acme",
  "id": 12,
  "vm_id": "vm_3f9a1c0b7d2e4f6a",
  "state": "awake",
  "vcpus": 1,
  "mem_mib": 2048,
  "disk_gb": 10,
  "image": "2026.10.27.1",
  "sleep_policy": "auto",
  "idle_minutes": 15,
  "ip": "10.200.0.50",
  "ssh": "web1.acme.shako.dev",
  "created_at": 1793491200,
  "last_active": 1793494800,
  "last_active_reason": "SSH",
  "snapshot": null,
  "snap_at": null,
  "awake_hours": 12.5,
  "gb_hours": 25,
  "disk_gb_hours": 1240,
  "last_error": null,
  "agents": [
    "claude"
  ],
  "desktop": false,
  "next_wake": null,
  "wake_on_cron": true,
  "wake_on_chat": true,
  "backup": true,
  "after_delete": "keep-7d",
  "resources": [
    {
      "id": "ram",
      "used": 805306368,
      "total": 2147483648,
      "pct": 37,
      "limit_pct": 90,
      "over": false
    },
    {
      "id": "disk",
      "used": 3221225472,
      "total": 10737418240,
      "pct": 30,
      "limit_pct": 90,
      "over": false
    }
  ],
  "role": "contributor"
}
```

## Fields

**name** `string`

The VM's name, unique in its tenant.

**tenant** `string`

The VM's tenant.

**id** `number`

The number of the VM on its host. Use the name to call the API.

**vm_id** `string | null`

The VM's id in Shako. It stays the same after a rename.

**state** `VmState`

The state of the VM: see the table of the states.

**vcpus** `number`

The vCPUs.

**mem_mib** `number`

The memory, in MiB.

**disk_gb** `number`

The disk, in GB.

**image** `string`

The image release that the VM booted.

**sleep_policy** `SleepPolicy`

auto: the VM sleeps when it is quiet. never: it stays on.

**idle_minutes** `number`

The quiet minutes before the VM sleeps, with the sleep policy auto.

**ip** `string`

The VM's address in its host's private network. A program outside Shako does not need it.

**ssh** `string`

The VM's SSH name: ssh web1.acme.shako.dev.

**created_at** `number`

When the VM was created, as a Unix time in seconds.

**last_active** `number`

The time of the VM's last activity.

**last_active_reason** `string`

What the last activity was, for example SSH, HTTPS, CPU or scheduled wake.

**snapshot** `string | null`

The kind of the memory that a sleeping VM saved on its disk, or null when it has none.

**snap_at** `number | null`

When the VM saved its memory, or null.

**awake_hours** `number`

The hours that the VM was awake.

**gb_hours** `number`

The memory in GiB times the hours awake.

**disk_gb_hours** `number`

The disk in GB times the hours, awake and asleep.

**last_error** `string | null`

The last error of the VM, or null.

**agents** `AgentId[]`

The agents in the VM.

**desktop** `boolean`

true: the VM has a screen and a shared browser.

**next_wake** `NextWake | null`

When Shako wakes the sleeping VM before its next cron job, or null.

**wake_on_cron** `boolean`

true: after each sleep, the VM wakes 2 minutes before its next cron job.

**wake_on_chat** `boolean`

true: a chat message wakes the VM.

**backup** `boolean`

true: each night, Shako backs up the VM if its disk changed. false: no new backups, and the old backups go 7 days after they were taken.

**after_delete** `AfterDelete`

What happens to the VM's backups when the VM is deleted. keep-7d: they stay 7 days, then Shako erases them. erase: Shako erases them within a few minutes.

**resources** `ResourceUse[]`

The use of the memory and the disk inside the VM. [] when the VM is not awake.

**role** `VmRole` *optional*

The VM's role in its tenant: contributor or none.

## States

| State | Meaning |
|---|---|
| `creating` | Shako makes the VM's disk. |
| `booting` | The VM boots. |
| `awake` | The VM runs. Its memory and its disk use credit. |
| `sleeping` | The VM saves its memory on its disk. |
| `asleep` | The VM's memory is on its disk. Only the disk uses credit. An SSH login, a request to a public port, a cron job (wake_on_cron) or a chat message (wake_on_chat) wakes it. |
| `waking` | The VM loads its memory again. |
| `stopped` | The VM is off, with no memory on its disk. A wake boots it from its disk. |
| `deleting` | Shako deletes the VM. |
| `failed` | A create or a boot failed. last_error says why. |
