Docs navigation
Threads

Post Thread Messages

Post Thread Messages

POST/v2/threads/{thread_id}/messages

run defaults to true: posting starts a run. Set run to false to append context without starting one. Send an Idempotency-Key header (8 to 200 characters) to make a retry safe. It covers one plain-text user message with no model_options; any other body returns 422 with detail.code=message_idempotency_shape_unsupported. Reusing the key with the same content, metadata and run returns the original result with Idempotency-Replayed: true. A change returns 409 with detail.code=idempotency_key_reused, and 409 with detail.code=idempotency_request_in_progress and Retry-After: 1 means the original request is still being processed.

Path Parameters

thread_idstring · uuidrequired

Request Body

messagesarray<object>required
runbooleanoptional

Start a run after appending the messages (the default). Posting a message answers the agent and resumes the turn, so a thread left in need_more_info settles fresh. Set false to append context to the transcript without starting a run.

Request
curl --request POST \
  --url https://api.brainbaselabs.com/v2/threads/{thread_id}/messages \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "user",
      "content": null,
      "name": "string",
      "tool_calls": {},
      "tool_call_id": "string",
      "metadata": {}
    }
  ],
  "run": true
}'
Response
json
{
  "messages": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "task_id": "736fde4d-9029-4915-8189-01353d6982cb",
      "role": "string",
      "content": null,
      "name": "string",
      "tool_calls": {},
      "tool_call_id": "string",
      "metadata": {},
      "created_at": "2019-08-24T14:15:22Z"
    }
  ],
  "run_started": false
}