Skip to content
Skip to Content
Coder Docs

Send chat message

POST
/api/v2/chats/{chat}/messages

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

chat*string

Chat ID

Formatuuid

Request Body

Create chat message request

application/json
  1. body
busy_behavior?string
Value in"queue""interrupt"
content?array<>
inline_mcp_servers?array<>

InlineMCPServers replaces the inline MCP servers. nil: no change, empty: remove all.

mcp_server_ids?array<>
model_config_id?string
Formatuuid
plan_mode?"plan"

PlanMode switches the chat's persistent plan mode. nil: no change, ptr to "plan": enable, ptr to "": clear.

Value in"plan"
reasoning_effort?string

Response Body

OK

application/json
  1. response
message?
messages?array<>

Messages contains all user-visible messages inserted by the send, in insertion order. A queued send on an errored chat may promote the previous queue head, so clients must upsert the full batch.

queued?boolean
queued_message?
warnings?array<string>

The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.

curl -X POST \	"$CODER_URL/api/v2/chats/{chat}/messages" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN" \	-H "Content-Type: application/json" \	-d '{  "busy_behavior": "queue",  "content": [    {      "content": "string",      "end_line": 0,      "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",      "file_name": "string",      "skill_name": "string",      "skill_source": "personal",      "start_line": 0,      "text": "string",      "type": "text",      "workspace_file_media_type": "string",      "workspace_file_name": "string",      "workspace_file_path": "string",      "workspace_file_size": 0,      "workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"    }  ],  "inline_mcp_servers": [    {      "allow_in_subagents": true,      "forward_coder_headers": true,      "headers": {        "property1": "string",        "property2": "string"      },      "slug": "string",      "tool_allow_list": [        "string"      ],      "tool_deny_list": [        "string"      ],      "url": "string"    }  ]}'
Example Response200
{  "message": {    "chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",    "content": [      {        "args": [          0        ],        "args_delta": "string",        "completed_at": "2019-08-24T14:15:22Z",        "content": "string",        "context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",        "context_file_content": "string",        "context_file_directory": "string",        "context_file_os": "string",        "context_file_path": "string",        "context_file_skill_meta_file": "string",        "context_file_truncated": true,        "created_at": "2019-08-24T14:15:22Z",        "data": [          0        ],        "end_line": 0,        "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",        "file_name": "string",        "hook_rewritten": true,        "is_error": true,        "is_media": true,        "mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",        "media_type": "string",        "name": "string",        "narration": true,        "parsed_commands": [          [            "string"          ]        ],        "provider_executed": true,        "provider_metadata": [          0        ],        "reasoning_delta": "string",        "result": [          0        ],        "result_delta": "string",        "result_reset": true,        "skill_description": "string",        "skill_dir": "string",        "skill_name": "string",        "skill_source": "personal",        "source_id": "string",        "start_line": 0,        "text": "string",        "title": "string",        "tool_call_id": "string",        "tool_name": "string",        "type": "text",        "url": "string",        "workspace_file_media_type": "string",        "workspace_file_name": "string",        "workspace_file_path": "string",        "workspace_file_size": 0,        "workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"      }    ],    "created_at": "2019-08-24T14:15:22Z",    "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",    "id": 0,    "model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",    "queued_message_id": 0,    "role": "system",    "usage": {      "cache_creation_tokens": 0,      "cache_read_tokens": 0,      "context_limit": 0,      "input_tokens": 0,      "output_tokens": 0,      "reasoning_tokens": 0,      "total_tokens": 0    }  },  "messages": [    {      "chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",      "content": [        {          "args": [            0          ],          "args_delta": "string",          "completed_at": "2019-08-24T14:15:22Z",          "content": "string",          "context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",          "context_file_content": "string",          "context_file_directory": "string",          "context_file_os": "string",          "context_file_path": "string",          "context_file_skill_meta_file": "string",          "context_file_truncated": true,          "created_at": "2019-08-24T14:15:22Z",          "data": [            0          ],          "end_line": 0,          "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",          "file_name": "string",          "hook_rewritten": true,          "is_error": true,          "is_media": true,          "mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",          "media_type": "string",          "name": "string",          "narration": true,          "parsed_commands": [            [              "string"            ]          ],          "provider_executed": true,          "provider_metadata": [            0          ],          "reasoning_delta": "string",          "result": [            0          ],          "result_delta": "string",          "result_reset": true,          "skill_description": "string",          "skill_dir": "string",          "skill_name": "string",          "skill_source": "personal",          "source_id": "string",          "start_line": 0,          "text": "string",          "title": "string",          "tool_call_id": "string",          "tool_name": "string",          "type": "text",          "url": "string",          "workspace_file_media_type": "string",          "workspace_file_name": "string",          "workspace_file_path": "string",          "workspace_file_size": 0,          "workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"        }      ],      "created_at": "2019-08-24T14:15:22Z",      "created_by": "ee824cad-d7a6-4f48-87dc-e8461a9201c4",      "id": 0,      "model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205",      "queued_message_id": 0,      "role": "system",      "usage": {        "cache_creation_tokens": 0,        "cache_read_tokens": 0,        "context_limit": 0,        "input_tokens": 0,        "output_tokens": 0,        "reasoning_tokens": 0,        "total_tokens": 0      }    }  ],  "queued": true,  "queued_message": {    "chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",    "content": [      {        "args": [          0        ],        "args_delta": "string",        "completed_at": "2019-08-24T14:15:22Z",        "content": "string",        "context_file_agent_id": "2e577c68-2ec9-4c84-a77a-5b3e1d7eae09",        "context_file_content": "string",        "context_file_directory": "string",        "context_file_os": "string",        "context_file_path": "string",        "context_file_skill_meta_file": "string",        "context_file_truncated": true,        "created_at": "2019-08-24T14:15:22Z",        "data": [          0        ],        "end_line": 0,        "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767",        "file_name": "string",        "hook_rewritten": true,        "is_error": true,        "is_media": true,        "mcp_server_config_id": "a9f436ed-69e7-459c-8308-a67ff5387e3e",        "media_type": "string",        "name": "string",        "narration": true,        "parsed_commands": [          [            "string"          ]        ],        "provider_executed": true,        "provider_metadata": [          0        ],        "reasoning_delta": "string",        "result": [          0        ],        "result_delta": "string",        "result_reset": true,        "skill_description": "string",        "skill_dir": "string",        "skill_name": "string",        "skill_source": "personal",        "source_id": "string",        "start_line": 0,        "text": "string",        "title": "string",        "tool_call_id": "string",        "tool_name": "string",        "type": "text",        "url": "string",        "workspace_file_media_type": "string",        "workspace_file_name": "string",        "workspace_file_path": "string",        "workspace_file_size": 0,        "workspace_file_workspace_id": "74c05446-1c56-4543-82a9-03f2bf73b2ab"      }    ],    "created_at": "2019-08-24T14:15:22Z",    "id": 0,    "model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"  },  "warnings": [    "string"  ]}