> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trusset.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Bot

> Relabel a liquidation bot, or archive or restore its record

Changes the bot's record in Trusset: its label, or whether it is archived. Nothing goes on-chain.

<Warning>
  Archiving hides the bot from the default [List Liquidation Bots](/endpoints/lending/list-bots) and changes nothing else. The contract stays deployed with its float, its market roles and its enabled markets, and any caller can still liquidate through it. To stop it, pause it with [Bot Owner Action](/endpoints/lending/bot-action) or disconnect it with [Connect Bot to Market](/endpoints/lending/connect-bot).
</Warning>

## Path Parameters

<ParamField path="botId" type="string" required>Bot ID.</ParamField>

## Body Parameters

<ParamField body="label" type="string | null">
  Display label, at most 64 characters. Surrounding whitespace is trimmed. `null` or an empty label clears it.
</ParamField>

<ParamField body="archived" type="boolean">
  `true` hides the bot from the default list, `false` restores it. The current value counts as no change.
</ParamField>

A body that changes nothing returns `VALIDATION_ERROR` with the message `Nothing to update`. That covers an empty body and one carrying only `archived` at its current value.

## Response Fields

<ResponseField name="data" type="object">
  <Expandable>
    <ResponseField name="bot" type="object">The updated record: `id`, `instanceId`, `botAddress`, `ownerWallet`, `label`, `archived`, `deployTxHash`, `createdAt` and `updatedAt`. On-chain state is not included.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.trusset.org/lending-external-securities-v2/api/liquidation-bots/{botId}" \
    -H "X-API-Key: trusset_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{"label": "Retired keeper", "archived": true}'
  ```

  ```typescript TypeScript theme={null}
  const res = await fetch(
    `https://api.trusset.org/lending-external-securities-v2/api/liquidation-bots/${botId}`,
    {
      method: 'PATCH',
      headers: {
        'X-API-Key': 'trusset_your_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ archived: false })
    }
  );
  const { data } = await res.json();
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "bot": {
        "id": "clx_bot_001",
        "instanceId": "inst_abc123",
        "botAddress": "0xc40dea7387a290e7ce71784a65ae0ed6bb1ae555",
        "ownerWallet": "0x1234f9a07c6b53d81e2a4f70c9b385d6014a7e52",
        "label": "Retired keeper",
        "archived": true,
        "deployTxHash": "0x1a2531f9e02d8b3660364d25a982585f822fbe8689e811e7b967cbd1d670ba7b",
        "createdAt": "2026-09-20T10:00:00.000Z",
        "updatedAt": "2026-09-25T12:00:00.000Z"
      }
    },
    "error": null,
    "metadata": {
      "timestamp": "2026-09-25T12:00:00.000Z",
      "requestId": "550e8400-e29b-41d4-a716-446655440000",
      "instanceId": "inst_abc123"
    }
  }
  ```

  ```json Error - Nothing To Update theme={null}
  {
    "success": false,
    "data": null,
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Nothing to update"
    }
  }
  ```
</ResponseExample>

## Error Codes

| Code                | HTTP  | Cause                                                                                                          |
| ------------------- | ----- | -------------------------------------------------------------------------------------------------------------- |
| `VALIDATION_ERROR`  | `400` | `label` is longer than 64 characters or not a string, `archived` is not a boolean, or the body changes nothing |
| `BOT_NOT_FOUND`     | `404` | No bot with this ID belongs to your instance                                                                   |
| `BOT_UPDATE_FAILED` | `500` | An unexpected failure. The message is generic; retry                                                           |
