Skip to content
Skip to Content
Coder Docs

Stream chat events via WebSockets

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

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

chat*string

Chat ID

Formatuuid

Query Parameters

after_id?integer

Skip snapshot messages with id at or before this cursor

Response Body

OK

application/json
  1. response
[index: integer]?

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

curl -X GET \	"$CODER_URL/api/v2/chats/{chat}/stream" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN"
Example Response200
[  {    "action_required": {      "tool_calls": [        {          "args": "string",          "tool_call_id": "string",          "tool_name": "string"        }      ]    },    "chat_id": "efc9fe20-a1e5-4a8c-9c48-f1b30c1e4f86",    "error": {      "detail": "string",      "kind": "generic",      "message": "string",      "provider": "string",      "retryable": true,      "status_code": 0    },    "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      }    },    "message_part": {      "generation_attempt": 0,      "history_version": 0,      "part": {        "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"      },      "role": "system",      "seq": 0    },    "queued_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",        "id": 0,        "model_config_id": "f5fb4d91-62ca-4377-9ee6-5d43ba00d205"      }    ],    "retry": {      "attempt": 0,      "delay_ms": 0,      "error": "string",      "kind": "generic",      "provider": "string",      "retrying_at": "2019-08-24T14:15:22Z",      "status_code": 0    },    "status": {      "status": "waiting"    },    "type": "message_part"  }]