# Set how many warm VMs to keep.

> Planned.
> https://koi.dog/docs/api/cloud/update-cloud-pool/

`PATCH /api/v1/cloud/pool` · Scopes: `config`, `approve`

Keeping VMs warm spends money, so raising the target needs `approve`. The timeline records the key ID, action and outcome.

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Body.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `target` | `0–20` | yes | How many started VMs to keep ready; 0 turns the pool off. |

## Response.

`501 not_built` · Planned

- **422 validation_failed**: Each schema error appears in `details`.

## Request.

```sh
curl -X PATCH https://api.koi.dog/api/v1/cloud/pool \
    -H "Authorization: Bearer $KOIDOG_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "target": 1
    }'
```

```js
const res = await fetch("https://api.koi.dog/api/v1/cloud/pool", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    target: 1,
  }),
});
console.log(await res.json());
```

```python
import os

import requests

r = requests.patch(
    "https://api.koi.dog/api/v1/cloud/pool",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
    },
    json={
        "target": 1,
    },
)
r.raise_for_status()
print(r.json())
```
