# Chats

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

- [Connect to chat workspace desktop via WebSockets](/docs/reference/api/chats/connect-to-chat-workspace-desktop-via-websockets/): `GET /api/experimental/chats/{chat}/stream/desktop`
- [List chats](/docs/reference/api/chats/list-chats/): `GET /api/v2/chats`
- [Create chat](/docs/reference/api/chats/create-chat/): `POST /api/v2/chats`
- [List chats by workspace](/docs/reference/api/chats/list-chats-by-workspace/): `GET /api/v2/chats/by-workspace`
- [Get chat auto archive days](/docs/reference/api/chats/get-chat-auto-archive-days/): `GET /api/v2/chats/config/auto-archive-days`
- [Update chat auto archive days](/docs/reference/api/chats/update-chat-auto-archive-days/): `PUT /api/v2/chats/config/auto-archive-days`
- [Get chat debug logging setting](/docs/reference/api/chats/get-chat-debug-logging-setting/): `GET /api/v2/chats/config/debug-logging`
- [Update chat debug logging setting](/docs/reference/api/chats/update-chat-debug-logging-setting/): `PUT /api/v2/chats/config/debug-logging`
- [Get chat debug retention days](/docs/reference/api/chats/get-chat-debug-retention-days/): `GET /api/v2/chats/config/debug-retention-days`
- [Update chat debug retention days](/docs/reference/api/chats/update-chat-debug-retention-days/): `PUT /api/v2/chats/config/debug-retention-days`
- [Get chat personal model override settings](/docs/reference/api/chats/get-chat-personal-model-override-settings/): `GET /api/v2/chats/config/personal-model-overrides`
- [Update chat personal model override settings](/docs/reference/api/chats/update-chat-personal-model-override-settings/): `PUT /api/v2/chats/config/personal-model-overrides`
- [Get chat plan mode instructions](/docs/reference/api/chats/get-chat-plan-mode-instructions/): `GET /api/v2/chats/config/plan-mode-instructions`
- [Update chat plan mode instructions](/docs/reference/api/chats/update-chat-plan-mode-instructions/): `PUT /api/v2/chats/config/plan-mode-instructions`
- [Get chat system prompt](/docs/reference/api/chats/get-chat-system-prompt/): `GET /api/v2/chats/config/system-prompt`
- [Update chat system prompt](/docs/reference/api/chats/update-chat-system-prompt/): `PUT /api/v2/chats/config/system-prompt`
- [Get user chat debug logging setting](/docs/reference/api/chats/get-user-chat-debug-logging-setting/): `GET /api/v2/chats/config/user-debug-logging`
- [Update user chat debug logging setting](/docs/reference/api/chats/update-user-chat-debug-logging-setting/): `PUT /api/v2/chats/config/user-debug-logging`
- [Get user chat custom prompt](/docs/reference/api/chats/get-user-chat-custom-prompt/): `GET /api/v2/chats/config/user-prompt`
- [Update user chat custom prompt](/docs/reference/api/chats/update-user-chat-custom-prompt/): `PUT /api/v2/chats/config/user-prompt`
- [Get chat workspace time to live](/docs/reference/api/chats/get-chat-workspace-time-to-live/): `GET /api/v2/chats/config/workspace-ttl`
- [Update chat workspace time to live](/docs/reference/api/chats/update-chat-workspace-time-to-live/): `PUT /api/v2/chats/config/workspace-ttl`
- [Upload chat file](/docs/reference/api/chats/upload-chat-file/): `POST /api/v2/chats/files`
- [Get chat file](/docs/reference/api/chats/get-chat-file/): `GET /api/v2/chats/files/{file}`
- [Watch chat events for a user via WebSockets](/docs/reference/api/chats/watch-chat-events-for-a-user-via-websockets/): `GET /api/v2/chats/watch`
- [Get chat by ID](/docs/reference/api/chats/get-chat-by-id/): `GET /api/v2/chats/{chat}`
- [Update chat](/docs/reference/api/chats/update-chat/): `PATCH /api/v2/chats/{chat}`
- [List chat attachments](/docs/reference/api/chats/list-chat-attachments/): `GET /api/v2/chats/{chat}/attachments`
- [Refresh chat context](/docs/reference/api/chats/refresh-chat-context/): `PUT /api/v2/chats/{chat}/context`
- [Get chat cost](/docs/reference/api/chats/get-chat-cost/): `GET /api/v2/chats/{chat}/cost`
- [Get chat diff contents](/docs/reference/api/chats/get-chat-diff-contents/): `GET /api/v2/chats/{chat}/diff`
- [Interrupt chat](/docs/reference/api/chats/interrupt-chat/): `POST /api/v2/chats/{chat}/interrupt`
- [List chat messages](/docs/reference/api/chats/list-chat-messages/): `GET /api/v2/chats/{chat}/messages`
- [Send chat message](/docs/reference/api/chats/send-chat-message/): `POST /api/v2/chats/{chat}/messages`
- [Edit chat message](/docs/reference/api/chats/edit-chat-message/): `PATCH /api/v2/chats/{chat}/messages/{message}`
- [List chat user prompts](/docs/reference/api/chats/list-chat-user-prompts/): `GET /api/v2/chats/{chat}/prompts`
- [Delete chat queued message](/docs/reference/api/chats/delete-chat-queued-message/): `DELETE /api/v2/chats/{chat}/queue/{queuedMessage}`
- [Promote chat queued message](/docs/reference/api/chats/promote-chat-queued-message/): `POST /api/v2/chats/{chat}/queue/{queuedMessage}/promote`
- [Reconcile invalid chat state](/docs/reference/api/chats/reconcile-invalid-chat-state/): `POST /api/v2/chats/{chat}/reconcile-invalid`
- [Stream chat events via WebSockets](/docs/reference/api/chats/stream-chat-events-via-websockets/): `GET /api/v2/chats/{chat}/stream`
- [Watch chat workspace git state via WebSockets](/docs/reference/api/chats/watch-chat-workspace-git-state-via-websockets/): `GET /api/v2/chats/{chat}/stream/git`
- [Propose chat title](/docs/reference/api/chats/propose-chat-title/): `POST /api/v2/chats/{chat}/title/propose`
- [Submit chat tool results](/docs/reference/api/chats/submit-chat-tool-results/): `POST /api/v2/chats/{chat}/tool-results`
- [Upload a file to a chat's workspace](/docs/reference/api/chats/upload-a-file-to-a-chats-workspace/): `POST /api/v2/chats/{chat}/workspace-files`
- [Get organization chat system prompt](/docs/reference/api/chats/get-organization-chat-system-prompt/): `GET /api/v2/organizations/{organization}/chats/config/system-prompt`
- [Update organization chat system prompt](/docs/reference/api/chats/update-organization-chat-system-prompt/): `PUT /api/v2/organizations/{organization}/chats/config/system-prompt`
- [List AI models and provider descriptors in an organization](/docs/reference/api/chats/list-ai-models-and-provider-descriptors-in-an-organization/): `GET /api/v2/organizations/{organization}/chats/models`
- [Create an AI model in an organization](/docs/reference/api/chats/create-an-ai-model-in-an-organization/): `POST /api/v2/organizations/{organization}/chats/models`
- [List user AI provider key configurations](/docs/reference/api/chats/list-user-ai-provider-key-configurations/): `GET /api/v2/users/{user}/ai-provider-keys`
- [Update user AI provider key](/docs/reference/api/chats/update-user-ai-provider-key/): `PUT /api/v2/users/{user}/ai-provider-keys/{aiProvider}`
- [Delete user AI provider key](/docs/reference/api/chats/delete-user-ai-provider-key/): `DELETE /api/v2/users/{user}/ai-provider-keys/{aiProvider}`
