Skip to main content
GET
/
api
/
chats
/
id
/
{id}
/
history
/
full
Get complete chat history (chat + messages) via API key
curl --request GET \
  --url https://api.leanmcp.com/api/chats/id/{id}/history/full \
  --header 'Authorization: Bearer <token>'
{
  "chat": {
    "id": "<string>",
    "userId": "<string>",
    "title": "<string>",
    "isPublic": false,
    "status": "active",
    "createdAt": "<string>",
    "updatedAt": "<string>",
    "messageCount": 1,
    "showcased": false,
    "summary": "<string>",
    "modelUsed": "<string>",
    "systemMessageId": "<string>",
    "metadata": {}
  },
  "messages": [
    {
      "id": "<string>",
      "chatId": "c1a83d84-7154-464c-bd19-a9f10e0a067f",
      "userId": "<string>",
      "role": "system",
      "content": "<string>",
      "messageIndex": 1,
      "createdAt": "<string>",
      "updatedAt": "<string>",
      "fileStates": [
        {
          "fileStateId": "<string>",
          "filePath": "<string>"
        }
      ],
      "metadata": {}
    }
  ],
  "totalMessages": 123,
  "retrievedAt": "<string>"
}

Authorizations

Authorization
string
header
required

Enter your LeanMCP API key

Path Parameters

id
string
required

Chat ID

Example:

"c1a83d84-7154-464c-bd19-a9f10e0a067f"

Response

Full chat history retrieved successfully

chat
object
required

Chat metadata

messages
object[]
required

Array of complete message objects with associated file states in chronological order

totalMessages
number
required

Total number of messages in chat

retrievedAt
string
required

Timestamp when history was retrieved