Skip to content
Skip to Content
Coder Docs

Chats

REST endpoints for Coder Agents Chats API (programmatic agent sessions).

Programmatic API for Coder Agents (the user-facing "Coder Agents" / "Chats" product). Use these endpoints to create, list, and manage AI coding agent sessions.

Endpoints

Connect to chat workspace desktop via WebSockets GET

/api/experimental/chats/{chat}/stream/desktop Raw binary WebSocket stream of the chat workspace desktop.

List chats GET

/api/v2/chats

Create chat POST

/api/v2/chats

List chats by workspace GET

/api/v2/chats/by-workspace

Get chat auto archive days GET

/api/v2/chats/config/auto-archive-days

Update chat auto archive days PUT

/api/v2/chats/config/auto-archive-days

Get chat debug logging setting GET

/api/v2/chats/config/debug-logging

Update chat debug logging setting PUT

/api/v2/chats/config/debug-logging

Get chat debug retention days GET

/api/v2/chats/config/debug-retention-days

Update chat debug retention days PUT

/api/v2/chats/config/debug-retention-days

Get chat personal model override settings GET

/api/v2/chats/config/personal-model-overrides

Update chat personal model override settings PUT

/api/v2/chats/config/personal-model-overrides

Get chat plan mode instructions GET

/api/v2/chats/config/plan-mode-instructions

Update chat plan mode instructions PUT

/api/v2/chats/config/plan-mode-instructions

Get chat system prompt GET

/api/v2/chats/config/system-prompt

Update chat system prompt PUT

/api/v2/chats/config/system-prompt

Get user chat debug logging setting GET

/api/v2/chats/config/user-debug-logging

Update user chat debug logging setting PUT

/api/v2/chats/config/user-debug-logging

Get user chat custom prompt GET

/api/v2/chats/config/user-prompt

Update user chat custom prompt PUT

/api/v2/chats/config/user-prompt

Get chat workspace time to live GET

/api/v2/chats/config/workspace-ttl

Update chat workspace time to live PUT

/api/v2/chats/config/workspace-ttl

Upload chat file POST

/api/v2/chats/files

Get chat file GET

/api/v2/chats/files/{file}

Get chat by ID GET

/api/v2/chats/{chat}

Update chat PATCH

/api/v2/chats/{chat}

List chat attachments GET

/api/v2/chats/{chat}/attachments Returns every file part in the user-visible user and assistant messages of a chat, newest first, so a client can list a chat's attachments without paging through every message in the chat.

Refresh chat context PUT

/api/v2/chats/{chat}/context

Get chat cost GET

/api/v2/chats/{chat}/cost Cost covers the whole chat tree: the root chat plus every subagent chat beneath it.

Get chat diff contents GET

/api/v2/chats/{chat}/diff

Interrupt chat POST

/api/v2/chats/{chat}/interrupt

List chat messages GET

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

Send chat message POST

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

Edit chat message PATCH

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

List chat user prompts GET

/api/v2/chats/{chat}/prompts Returns the user-authored prompts in a chat, newest first, with each prompt's text parts concatenated in the order they were authored.

Delete chat queued message DELETE

/api/v2/chats/{chat}/queue/{queuedMessage}

Promote chat queued message POST

/api/v2/chats/{chat}/queue/{queuedMessage}/promote

Reconcile invalid chat state POST

/api/v2/chats/{chat}/reconcile-invalid

Stream chat events via WebSockets GET

/api/v2/chats/{chat}/stream

Propose chat title POST

/api/v2/chats/{chat}/title/propose

Submit chat tool results POST

/api/v2/chats/{chat}/tool-results

Upload a file to a chat's workspace POST

/api/v2/chats/{chat}/workspace-files Streams the request body into the chat workspace's upload directory.

Get organization chat system prompt GET

/api/v2/organizations/{organization}/chats/config/system-prompt

Update organization chat system prompt PUT

/api/v2/organizations/{organization}/chats/config/system-prompt

List AI models and provider descriptors in an organization GET

/api/v2/organizations/{organization}/chats/models

Create an AI model in an organization POST

/api/v2/organizations/{organization}/chats/models

List user AI provider key configurations GET

/api/v2/users/{user}/ai-provider-keys

Update user AI provider key PUT

/api/v2/users/{user}/ai-provider-keys/{aiProvider}

Delete user AI provider key DELETE

/api/v2/users/{user}/ai-provider-keys/{aiProvider}