> 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/export-chat.md).

# Export chat

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

### Url

```
POST 
https://wilson.40mat.com/apif/v2/chat/<chat_id>/messages/export
```

### Headers

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

### Parameters

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

### Body

```json
{
    "export_type": "text",
    "title": "Chat title exported",
    "summary_type": "ai",
    "summary": null
}
```

The request body is in JSON format contain following properties:

* `export_type` (string, required): Type of export: `text` or `markdown`
* `title` (string, required): Title of filename to export
* `summary_type` (string, required): Type of summary: `ai` or `custom`
* `summary` (string): If `summary_type = custom`, user can pass the summary content

***

## Response&#x20;

```
# Chat title exported

**Chat creation:** 2025-05-12 16:40:50

**Export time:** 2025-05-16 18:52:07

## Summary

The conversation focused on the assistance provided for industrial machines, covering main areas: 
1. Maintenance: Emphasized the importance of having maintenance and replacement operations performed by experienced technicians, adhering to safety regulations and environmental considerations. It is recommended that extraordinary maintenance be carried out by the manufacturer or an authorized specialized center. Before any intervention, the machine's power must be turned off and isolators locked. 
2. Cleaning: Stressed the necessity of cleaning the machine's components, specifically the portafiliere, every six months by removing caps and cleaning the nozzles and channels for emulsification. After cleaning, the machine's protections should be closed, and the pump activated for thorough cleaning. 
3. Safety: Highlighted the need to activate all safety devices before maintenance and to inform relevant personnel. Proper signage and access restrictions to potentially dangerous devices are crucial to prevent unexpected hazards. 
4. Spare Parts: Stressed the importance of using only original spare parts for replacements to avoid liability for damages caused by non-original parts or unauthorized modifications that could compromise safety. 

---

## Chat transcription:

#### user *(2025-05-12 15:22:03)*
> Hello, how you can help me?

#### Default *(2025-05-12 15:22:39)*
> I can provide assistance on various aspects of industrial machines, including:\n1. **Maintenance**: I provide details on how to properly perform routine and non-routine machine maintenance, following safety and environmental regulations.\n2. **Cleaning**: I offer specific instructions for cleaning components such as wire racks, including steps for cleaning nozzles and emulsion delivery channels.\n3. **Safety**: Advice on safety measures to take before performing maintenance work, such as turning off the machine's power supply and locking the disconnect switches.\n4. **Spare Parts**: Guidance on how to request and use genuine spare parts to avoid damage and maintain machine safety.
```

The response is plain text with the exported chat and summary on top.

***

## Code example

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

```python
import requests
import json

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

payload = json.dumps({
  "export_type": "text",
  "title": "Chat title exported",
  "summary_type": "ai"
})
headers = {
  'Authorization': '••••••'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}

{% tab title="cURL" %}

```powershell
curl --location 'https://wilson.40mat.com/apif/v2/chat/<chat_id>/messages/export' \
--header 'Authorization: ••••••' \
--data '{
    "export_type": "text",
    "title": "Chat title exported",
    "summary_type": "ai"
}'
```

{% 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/export-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.
