# Update a bot

Source: https://langbot.ai/docs/api/bots/update-bot

`PATCH /v1/bots/{bot_id}`

Rename a bot, change its venues or description, or link it to a Sim run (`null` unlinks).

**Auth.** An account token (`Authorization: Bearer lb_…`) or a signed-in web session. A report-only token (`lbr_…`) is refused here with `403 scope_denied`.

**Limits.** Counts against your plan's API requests (60, 600 or 3,000 a minute on Free, Builder and Standard).

## Parameters

### Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `bot_id` | string | yes | The bot id (`bot_…`). |

### Body

| Name | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | A new name, unique on your account. |
| `venues` | array of string | no | `kalshi`, `polymarket`, `polymarket_us`. Unlink wallets before removing `polymarket`. Up to 3 items. |
| `description` | string | no | Anything to remember it by. |
| `test_run_id` | string | no | A Sim run of yours to compare against; `null` unlinks. |

## Request

**curl**

```bash
curl -X PATCH "https://api.langbot.ai/v1/bots/bot_01M6G72RFQRQ8JGNG8T1447GGP" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"description": "Kalshi mention markets, v2"}'
```

**Python**

```python
from langbot import LangbotClient

async with LangbotClient() as lb:  # reads LANGBOT_API_TOKEN
    await lb.bots.update("bot_01M6G72RFQRQ8JGNG8T1447GGP", description="Kalshi mention markets, v2")
```

**TypeScript**

```ts
import { LangbotClient } from "@langbotai/sdk";

const lb = new LangbotClient(); // reads LANGBOT_API_TOKEN
await lb.bots.update("bot_01M6G72RFQRQ8JGNG8T1447GGP", { description: "Kalshi mention markets, v2" });
```

## Response

`200 OK`

```json
{
  "id": "bot_01M6G72RFQRQ8JGNG8T1447GGP",
  "name": "mention-sniper",
  "description": "Kalshi mention markets, v2",
  "venues": [
    "kalshi",
    "polymarket"
  ],
  "test_run_id": null,
  "status": "ok",
  "status_reason": "last heartbeat 4 s ago",
  "created_at": 1793693147639,
  "updated_at": 1793693150691,
  "last_event_at": 1793693146653,
  "last_heartbeat_at": 1793693146653,
  "halted_at": null,
  "halt_reason": null,
  "retention_days": 90,
  "wallets": []
}
```

## Errors

| Status | `code` | When |
|---|---|---|
| 404 | `not_found` | No bot with that id on your account (or it was deleted). |
| 409 | `conflict` | The name is taken, or wallets are still linked while removing `polymarket`. |
| 401 | `auth_required` | No token was sent. |
| 401 | `token_invalid` | The token was not recognised (mistyped, revoked or expired). |
| 422 | `validation_error` | A parameter failed validation; `detail[].loc` names it. |
| 429 | `rate_limited` | Over your request budget; wait `Retry-After` seconds. |

Every error body is `{"detail": …, "code": "…"}`; branch on `code`. All codes: [Errors](https://langbot.ai/docs/api#errors).
