> For the complete documentation index, see [llms.txt](https://docs.flowiseai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowiseai.com/api-reference/chat-message.md).

# Chat Message

## List all chat messages

> Retrieve all chat messages for a specific chatflow.

```json
{"tags":[{"name":"chatmessage"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ChatMessage":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["apiMessage","userMessage"]},"chatflowid":{"type":"string","format":"uuid"},"content":{"type":"string"},"sourceDocuments":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/Document"}},"usedTools":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/UsedTool"}},"fileAnnotations":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/FileAnnotation"}},"agentReasoning":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/AgentReasoning"}},"fileUploads":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/FileUpload"}},"action":{"type":"array","nullable":true,"items":{"$ref":"#/components/schemas/Action"}},"chatType":{"type":"string","enum":["INTERNAL","EXTERNAL"]},"chatId":{"type":"string"},"memoryType":{"type":"string","nullable":true},"sessionId":{"type":"string","nullable":true},"createdDate":{"type":"string","format":"date-time"},"leadEmail":{"type":"string","nullable":true}}},"Document":{"type":"object","properties":{"pageContent":{"type":"string"},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}},"UsedTool":{"type":"object","properties":{"tool":{"type":"string"},"toolInput":{"type":"object","additionalProperties":{"type":"string"}},"toolOutput":{"type":"string"}}},"FileAnnotation":{"type":"object","properties":{"filePath":{"type":"string"},"fileName":{"type":"string"}}},"AgentReasoning":{"type":"object","properties":{"agentName":{"type":"string"},"messages":{"type":"array","items":{"type":"string"}},"nodeName":{"type":"string"},"nodeId":{"type":"string"},"usedTools":{"type":"array","items":{"$ref":"#/components/schemas/UsedTool"}},"sourceDocuments":{"type":"array","items":{"$ref":"#/components/schemas/Document"}},"state":{"type":"object","additionalProperties":{"type":"string"}}}},"FileUpload":{"type":"object","properties":{"data":{"type":"string"},"type":{"type":"string"},"name":{"type":"string"},"mime":{"type":"string"}}},"Action":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"mapping":{"type":"object","properties":{"approve":{"type":"string"},"reject":{"type":"string"},"toolCalls":{"type":"array"}}},"elements":{"type":"array"}}}}},"paths":{"/chatmessage/{id}":{"get":{"tags":["chatmessage"],"operationId":"getAllChatMessages","summary":"List all chat messages","description":"Retrieve all chat messages for a specific chatflow.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"Chatflow ID"},{"in":"query","name":"chatType","schema":{"type":"string","enum":["INTERNAL","EXTERNAL"]},"description":"Filter by chat type"},{"in":"query","name":"order","schema":{"type":"string","enum":["ASC","DESC"]},"description":"Sort order"},{"in":"query","name":"chatId","schema":{"type":"string"},"description":"Filter by chat ID"},{"in":"query","name":"memoryType","schema":{"type":"string"},"description":"Filter by memory type"},{"in":"query","name":"sessionId","schema":{"type":"string"},"description":"Filter by session ID"},{"in":"query","name":"startDate","schema":{"type":"string","format":"date-time"},"description":"Filter by start date"},{"in":"query","name":"endDate","schema":{"type":"string","format":"date-time"},"description":"Filter by end date"},{"in":"query","name":"feedback","schema":{"type":"boolean"},"description":"Filter by feedback"},{"in":"query","name":"feedbackType","schema":{"type":"string","enum":["THUMBS_UP","THUMBS_DOWN"]},"description":"Filter by feedback type. Only applicable if feedback is true"}],"responses":{"200":{"description":"A list of chat messages","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ChatMessage"}}}}},"500":{"description":"Internal error"}}}}}}
```

## Delete all chat messages

> Delete all chat messages for a specific chatflow.

```json
{"tags":[{"name":"chatmessage"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/chatmessage/{id}":{"delete":{"tags":["chatmessage"],"operationId":"removeAllChatMessages","summary":"Delete all chat messages","description":"Delete all chat messages for a specific chatflow.","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"Chatflow ID"},{"in":"query","name":"chatId","schema":{"type":"string"},"description":"Filter by chat ID"},{"in":"query","name":"memoryType","schema":{"type":"string"},"description":"Filter by memory type"},{"in":"query","name":"sessionId","schema":{"type":"string"},"description":"Filter by session ID"},{"in":"query","name":"chatType","schema":{"type":"string","enum":["INTERNAL","EXTERNAL"]},"description":"Filter by chat type"},{"in":"query","name":"startDate","schema":{"type":"string"},"description":"Filter by start date"},{"in":"query","name":"endDate","schema":{"type":"string"},"description":"Filter by end date"},{"in":"query","name":"feedbackType","schema":{"type":"string","enum":["THUMBS_UP","THUMBS_DOWN"]},"description":"Filter by feedback type"},{"in":"query","name":"hardDelete","schema":{"type":"boolean"},"description":"If hardDelete is true, messages will be deleted from the third party service as well"}],"responses":{"200":{"description":"Chat messages deleted successfully"},"400":{"description":"Invalid parameters"},"404":{"description":"Chat messages not found"},"500":{"description":"Internal error"}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flowiseai.com/api-reference/chat-message.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
