> For the complete documentation index, see [llms.txt](https://40factory.gitbook.io/wilson/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://40factory.gitbook.io/wilson/3.11/rest-api/chat/edit-chat.md).

# Edit chat

## Request <a href="#request" id="request"></a>

### Url

```
PATCH 
https://wilson.40mat.com/apif/v2/chat/<chat_id>
```

### Headers

<pre><code><strong>AUTH
</strong>Bearer "eyJ0eXAiOiJKV1QiLCJub25jZSI6IndUZXphSTNjdTNVYj..."
</code></pre>

### Parameters

```
No parameters are required for this endpoint.
```

### Body

```json
{
    "title": "Updated chat title",
    "archived": false,
    "bot_id": "669105e81af7bc07e5..."
}
```

The request body is in JSON format contain following properties:

* `title` (string): New chat title.
* `archived` (boolean): If true, the chat will be archived; if false chat will be unarchived.
* `bot_id` (string): ID of bot to use.

{% hint style="warning" %}
**bot\_id**

Added bot\_id as optional parameter. It allows for personalized behavior by wilson.
{% endhint %}

***

## Response&#x20;

The response is in JSON format contain following properties:

* `archived` (boolean): Archived status of the chat
* `company_id` (string): Company ID.
* `create_at` (date): Date of creation.
* `id` (string): Generated chat ID.&#x20;
* `members` (array): Strings Array with members of chat. A member che be an id or an email.&#x20;
* `title` (string): Title of chat.&#x20;
* `update_at` (date): Date of last update.
* `bot_id` (string): ID of bot to use.

```json
{
    "archived": false,
    "company_id": "40factory",
    "create_at": "Thu, 12 Jun 2024 06:22:39 GMT",
    "id": "6673caafdf6f247417...",
    "members": [
        "6564c3d7532e41a123..."
    ],
    "title": "Updated chat title",
    "update_at": "Thu, 18 Jun 2024 06:22:39 GMT",
    "bot_id": "669105e81af7bc07e5..."
}
```

***

## Code example

{% tabs %}
{% tab title="Python" %}

```python
import requests

url = "https://wilson.40mat.com/apif/v2/chat/<chat_id>"

payload = {
  "title": "Updated chat title",
  "archived": false
}

headers = {
  'Authorization': '••••••'
}

response = requests.request("PATCH", url, headers=headers, json=payload)

print(response.text)
```

{% endtab %}

{% tab title="cURL" %}

```powershell
curl --location 'https://wilson.40mat.com/apif/v2/chat/<chat_id>' \
--header 'Authorization: ••••••' \
--data '{
  "title": "Updated chat title",
  "archived": false
}'
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://40factory.gitbook.io/wilson/3.11/rest-api/chat/edit-chat.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
