# Change install-wide settings.

> Raising `cloudBudgetCapUsd`, `maxVms` or `loadTestApprovalThreshold` lets more be spent, so a key needs `approve` as well as `config` for that; lowering them needs only `config`.
> https://koi.dog/docs/api/costs-and-settings/update-settings/

`PATCH /api/v1/settings` · Scope: `config`

When an API key calls it, the timeline records who did what and the outcome. No path or query parameters.

## Body.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `cloudBudgetCapUsd` | `0–10000` | no | Hard cap on cloud compute for the whole install, in dollars. |
| `maxVms` | `0–100` | no | The most cloud VMs open at once across every crew. |
| `defaultVmType` | `enum` | no | The size of new cloud VMs. One of `small`, `default`, `large`. |
| `agentsPerVm` | `1–32` | no | Agents each cloud VM runs. At most `agentsPerVmMax`. |
| `agentsPerVmMax` | `1–32` | no | The ceiling on `agentsPerVm`. |
| `defaultTimeoutMinutes` | `1–1440` | no | The time limit the dashboard's launch form starts with. The API does not use it: every launch sets `limits.timeoutMinutes`. |
| `loadTestApprovalThreshold` | `1–100` | no | A crew whose agent cap is at or above this needs your approval (a load test) before it starts any cloud VM. |
| `favoriteModels` | `array` | no | "<connectionId>:<modelId>"; trimmed and de-duplicated in order on save. At most 200 items. |

## Response.

200 OK: a JSON object. The example has placeholder values.

- **422 validation_failed**: The body does not match its schema; each problem is in `details`.

## Request.

```sh
curl -X PATCH https://app.koi.dog/api/v1/settings \
    -H "Authorization: Bearer $KOIDOG_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "maxVms": 2
    }'
```

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

```python
import os

import requests

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

## Response example.

```json
{
  "cloudBudgetCapUsd": 0,
  "maxVms": 0,
  "defaultVmType": "small",
  "agentsPerVm": 0,
  "agentsPerVmMax": 0,
  "defaultTimeoutMinutes": 0,
  "loadTestApprovalThreshold": 0,
  "publicUrl": "string",
  "favoriteModels": []
}
```
