> 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.12/rest-api/chat/edit-chat.md).

# Edit chat

This endpoint allows the user to edit some attributes of a specific chat identified by the \<chat\_id>.

## 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 %}
