Skip to main content
POST
Add a new message to a specific chat via API key

Authorizations

Authorization
string
header
required

Enter your LeanMCP API key

Path Parameters

chatId
string
required

Chat ID

Example:

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

Body

application/json
role
enum<string>
required

Role of the message sender

Available options:
system,
assistant,
user
Example:

"user"

content
string
required

Content of the message

Example:

"Hello, can you help me with my project?"

metadata
object

Optional metadata as key-value pairs

Example:
fileIds
string[]

Array of file IDs to associate with this message

Example:

Response

Message added to chat successfully

id
string
required

Unique message identifier (UUID)

chatId
string
required

Chat ID this message belongs to (UUID)

Example:

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

userId
string
required

User ID who owns this message

role
enum<string>
required

Role of the message sender

Available options:
system,
assistant,
user
content
string
required

Message content/text

messageIndex
number
required

Order of message in the chat (0-based)

Required range: x >= 0
createdAt
string
required

Timestamp when message was created

updatedAt
string
required

Timestamp when message was last updated

metadata
object

Additional metadata for the message