Skip to main content

Send Message

Send a message to a thread and receive an AI response.

POST /api/v1/threads/:id/messages

Required Scopes: agents:execute, threads:write

Request

Path Parameters

ParameterTypeDescription
idstringThread ID

Body Parameters

ParameterTypeRequiredDescription
contentstringYesMessage content
streambooleanNoStream response (default: false)

Example

curl -X POST "https://api.flowmaestro.io/api/v1/threads/thread_xyz789/messages" \
-H "X-API-Key: fm_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"content": "What is my order status for order #12345?"
}'

Response

{
"data": {
"id": "msg_004",
"thread_id": "thread_xyz789",
"role": "assistant",
"content": "Your order #12345 is currently being shipped and is expected to arrive on January 20th.",
"tool_calls": [
{
"id": "call_001",
"name": "search_orders",
"arguments": { "order_id": "12345" }
}
],
"usage": {
"prompt_tokens": 150,
"completion_tokens": 45,
"total_tokens": 195
},
"created_at": "2024-01-15T10:30:18.000Z"
},
"meta": {
"request_id": "...",
"timestamp": "..."
}
}

Errors

StatusCodeDescription
404resource_not_foundThread not found
400validation_errorInvalid message content