# Raise one crew's own budget.

> Raises `limits.budgetUsd` (cloud compute) and or `limits.toolUsd` (Monid tool calls) of this crew only; a lower value is refused (`422 validation_failed`, `messageKey` `error.invalid_body.budgetLower`, as any other body the route refuses).
> https://koi.dog/docs/api/crews/raise-crew-budget/

`POST /api/v1/crews/{id}/budget` · Scopes: `crews`, `approve`

Agents waiting for budget are placed again. Needs `approve` as well: it lets the crew spend more. The timeline records the key ID, action and outcome.

## Path parameters.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | yes | The crew's id. |

## 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 |
| --- | --- | --- | --- |
| `budgetUsd` | `0–100000` | no | The crew's new cloud compute budget (`limits.budgetUsd`), in US dollars. At least its current budget; left out, it stays as it is. |
| `toolUsd` | `0–10000` | no | The crew's new tool budget for Monid calls (`limits.toolUsd`), in US dollars. At least its current one (the workspace's default when the crew has none); left out, it stays as it is. |

## Response.

200 OK · `CrewView`

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

## Request.

```sh
curl -X POST "https://api.koi.dog/api/v1/crews/$ID/budget" \
    -H "Authorization: Bearer $KOIDOG_API_KEY" \
    -H "Idempotency-Key: $(uuidgen)" \
    -H "Content-Type: application/json" \
    -d '{
      "budgetUsd": 10
    }'
```

```js
const res = await fetch(`https://api.koi.dog/api/v1/crews/${process.env.ID}/budget`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KOIDOG_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    budgetUsd: 10,
  }),
});
console.log(await res.json());
```

```python
import os
import uuid

import requests

r = requests.post(
    f"https://api.koi.dog/api/v1/crews/{os.environ['ID']}/budget",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "budgetUsd": 10,
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "crew": {
    "id": "string",
    "projectId": "string",
    "goal": "string",
    "mode": "direct",
    "requestedSize": 0,
    "maxAgents": 0,
    …
  },
  "projectName": "string",
  "agents": { … },
  "tasks": {
    "total": 0,
    "done": 0,
    "failed": 0,
    "blocked": 0
  },
  "vmsRunning": 0,
  "spentUsd": 0,
  "statusLine": "string",
  "whereabouts": {
    "onMacs": 0,
    "onOtherMachines": 0,
    "inCloud": 0,
    "waiting": 0,
    "waitingReason": "string",
    "waitingCode": "looking",
    …
  },
  "managerNote": "string",
  …
}
```
