---
title: "Save or update a chat history"
method: POST
path: "/ai_assistant/chat/save"
tags: ["AI Assistant"]
---

# Save or update a chat history

`POST /ai_assistant/chat/save`

## Request

- Base URL: `https://api.foudroyer.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.foudroyer.com/ai_assistant/chat/save`
- Auth: HTTP bearer

Saves or updates a chat history. If the chat ID already exists, it will update the existing chat and preserve the created_at timestamp. Otherwise, it creates a new chat.

## Request body

- AiChatHistorySaveDto
  - `id` string, required: Unique identifier of the chat history
  - `website_id` string, required: Website ID associated with the chat
  - `messages` string, required: Array of messages in the chat
  - `name` string, required: Name of the chat

## Response `200`

The saved chat history.

- AiChatHistoryGetResponseDto
  - `id` string, required: Unique identifier of the chat history
  - `user_id` string, required: User ID who owns the chat
  - `website_id` string, required: Website ID associated with the chat
  - `messages` unknown[], required: Array of messages in the chat
    - unknown
  - `name` string, required: Name of the chat
  - `created_at` string, date-time, required: Creation timestamp
  - `updated_at` string, date-time, required: Last update timestamp

---

[API](https://skmtc.dev/foudroyer/apis/foudroyer-api.md) - [All operations](https://skmtc.dev/foudroyer/apis/foudroyer-api/llms.txt) - [OpenAPI document](https://skmtc.dev/foudroyer/apis/foudroyer-api/revisions/5b917c67e013?raw)
