cURL Python JavaScript PHP Go Java
curl --request POST \
--url https://api.langtail.com/v2/threads/{ threadId} /messages \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '{
"message": {
"role": "assistant",
"name": "<string>",
"content": "<string>",
"function_call": {
"name": "<string>",
"arguments": "<string>"
},
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"tool_choice": "auto",
"tool_call_id": "<string>"
},
"metadata": {
"user_id": "user_123",
"conversation_topic": "product_inquiry",
"priority": "high"
}
}'
{
"id" : "<string>" ,
"createdAt" : "2023-11-07T05:31:56Z" ,
"threadId" : "<string>" ,
"content" : [
{
"role" : "user" ,
"content" : "Hello"
}
] ,
"metadata" : { } ,
"requestLog" : {
"id" : "<string>" ,
"createdAt" : "2023-11-07T05:31:56Z" ,
"request" : { } ,
"response" : { }
} ,
"requestLogId" : "<string>"
}
Use this endpoint to add a message to a thread without calling the LLM.
In most cases, you should use the Invoke Assistant API to add messages and get a response from the LLM.
However, this endpoint is useful when you need to add messages without immediate LLM processing, such as for creating placeholder messages or updating thread content separately.
Message that will be added to the thread.
Available options:
assistant
,
user
,
system
,
function
,
tool
message. content
string | null object[] | null any | null
required message.function_call. name
message.function_call. arguments
Available options:
function
message.tool_calls. function
message.tool_calls.function. name
message.tool_calls.function. arguments
message. tool_choice
Option 1 · enum<string> Option 2 · enum<string> Option 3 · object
A set of key-value pairs that can be attached to the message.
The unique identifier for the message.
The timestamp when the message was created.
The ID of the thread this message belongs to.
Additional messages. These will be appended to the Prompt Template.
Available options:
assistant
,
user
,
system
,
function
,
tool
content. content
string | null object[] | null any | null
required content.function_call. name
content.function_call. arguments
Available options:
function
content.tool_calls. function
content.tool_calls.function. name
content.tool_calls.function. arguments
content. tool_choice
Option 1 · enum<string> Option 2 · enum<string> Option 3 · object
A key-value store for additional metadata associated with the message.
Information about the request log, if available.
The unique identifier for the request log.
The timestamp when the request log was created.
Details of the request made.
Details of the response received.
The unique identifier for the request log, if available.