Skip to content
Skip to Content
Coder Docs

Watch chat events for a user via WebSockets

GET
/api/v2/chats/watch

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Response Body

OK

application/json
  1. response
changed_diff_status?

ChangedDiffStatus is set when Kind is ChatWatchEventKindDiffStatusChange. It identifies the ref that changed.

chat?
kind?codersdk.ChatWatchEventKind
Value in"status_change""summary_change""chat_summary_change""title_change""created""deleted""diff_status_change""action_required""context_dirty""project_change"
tool_calls?array<>

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

curl -X GET \	"$CODER_URL/api/v2/chats/watch" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN"
Example Response200
{  "changed_diff_status": {    "ref": {      "git_branch": "string",      "remote_origin": "string"    },    "status": {      "additions": 0,      "approved": true,      "author_avatar_url": "string",      "author_login": "string",      "base_branch": "string",      "changed_files": 0,      "changes_requested": true,      "chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",      "commits": 0,      "deletions": 0,      "git_branch": "string",      "head_branch": "string",      "pr_number": 0,      "pull_request_draft": true,      "pull_request_state": "string",      "pull_request_title": "string",      "refreshed_at": "2019-08-24T14:15:22Z",      "remote_origin": "string",      "reviewer_count": 0,      "stale_at": "2019-08-24T14:15:22Z",      "url": "string"    }  },  "chat": {    "agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",    "archived": true,    "build_id": "bfb1f3fa-bf7b-43a5-9e0b-26cc050e44cb",    "children": [      {}    ],    "client_type": "ui",    "context": {      "dirty": true,      "dirty_since": "2019-08-24T14:15:22Z",      "error": "string",      "resources": [        {          "error": "string",          "kind": "instruction_file",          "size_bytes": 0,          "skill_description": "string",          "skill_name": "string",          "source": "string",          "source_path": "string",          "status": "ok",          "tools": [            {              "description": "string",              "name": "string"            }          ]        }      ]    },    "created_at": "2019-08-24T14:15:22Z",    "diff_status": {      "additions": 0,      "approved": true,      "author_avatar_url": "string",      "author_login": "string",      "base_branch": "string",      "changed_files": 0,      "changes_requested": true,      "chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",      "commits": 0,      "deletions": 0,      "git_branch": "string",      "head_branch": "string",      "pr_number": 0,      "pull_request_draft": true,      "pull_request_state": "string",      "pull_request_title": "string",      "refreshed_at": "2019-08-24T14:15:22Z",      "remote_origin": "string",      "reviewer_count": 0,      "stale_at": "2019-08-24T14:15:22Z",      "url": "string"    },    "diff_statuses": [      {        "additions": 0,        "approved": true,        "author_avatar_url": "string",        "author_login": "string",        "base_branch": "string",        "changed_files": 0,        "changes_requested": true,        "chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",        "commits": 0,        "deletions": 0,        "git_branch": "string",        "head_branch": "string",        "pr_number": 0,        "pull_request_draft": true,        "pull_request_state": "string",        "pull_request_title": "string",        "refreshed_at": "2019-08-24T14:15:22Z",        "remote_origin": "string",        "reviewer_count": 0,        "stale_at": "2019-08-24T14:15:22Z",        "url": "string"      }    ],    "files": [      {        "created_at": "2019-08-24T14:15:22Z",        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "mime_type": "string",        "name": "string",        "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",        "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",        "size_bytes": 0      }    ],    "has_unread": true,    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "inline_mcp_servers": [      {        "allow_in_subagents": true,        "created_at": "2019-08-24T14:15:22Z",        "forward_coder_headers": true,        "has_custom_headers": true,        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",        "slug": "string",        "tool_allow_list": [          "string"        ],        "tool_deny_list": [          "string"        ],        "updated_at": "2019-08-24T14:15:22Z",        "url": "string"      }    ],    "labels": {      "property1": "string",      "property2": "string"    },    "last_error": {      "detail": "string",      "kind": "generic",      "message": "string",      "provider": "string",      "retryable": true,      "status_code": 0    },    "last_model_config_id": "30ebb95f-c255-4759-9429-89aa4ec1554c",    "last_reasoning_effort": "string",    "last_turn_summary": "string",    "mcp_server_ids": [      "6645753c-0a13-4667-8dd3-d80a8e4fd76f"    ],    "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6",    "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05",    "owner_name": "string",    "owner_username": "string",    "parent_chat_id": "c3609ee6-3b11-4a93-b9ae-e4fabcc99359",    "pin_order": 0,    "plan_mode": "plan",    "project_id": "405d8375-3514-403b-8c43-83ae74cfe0e9",    "queued_for_capacity": true,    "root_chat_id": "2898031c-fdce-4e3e-8c53-4481dd42fcd7",    "shared": true,    "status": "waiting",    "summary": "string",    "title": "string",    "title_source": "fallback",    "title_updated_at": "2019-08-24T14:15:22Z",    "updated_at": "2019-08-24T14:15:22Z",    "warnings": [      "string"    ],    "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"  },  "kind": "status_change",  "tool_calls": [    {      "args": "string",      "tool_call_id": "string",      "tool_name": "string"    }  ]}