# Change how many agents may run at once.

> https://koi.dog/docs/api/crews/resize-crew/

`POST /api/v1/crews/{id}/resize` · Scope: `crews`

No query parameters.

## Path parameters.

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

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Makes a retry safe: the same key with the same request returns the first answer and does nothing else. |

## Body.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `maxAgents` | `1–100` | yes | The most agents the crew runs at once. Shrinking releases queued agents beyond it, newest first. |

## Response.

200 OK: a `CrewView`. The example has placeholder values.

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

## Request.

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

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

```python
import os
import uuid

import requests

r = requests.post(
    f"https://app.koi.dog/api/v1/crews/{os.environ['ID']}/resize",
    headers={
        "Authorization": f"Bearer {os.environ['KOIDOG_API_KEY']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "maxAgents": 4,
    },
)
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,
  "managerNote": "string",
  …
}
```
