Skip to content
Skip to Content
Coder Docs

List chat messages

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

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

chat*string

Chat ID

Formatuuid

Query Parameters

before_id?integer

Return messages with id < before_id

after_id?integer

Return messages with id > after_id

limit?integer

Page size, 1 to 200. Defaults to 50.

Response Body

OK

application/json
  1. response
has_more?boolean
messages?array<>
queued_messages?array<>
turn_start_id?integer

TurnStartID is the ID of the user prompt that starts the turn containing the page's oldest message. Omitted for after_id-only polls and when no prompt is at or before that message.

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

curl -X GET \	"$CODER_URL/api/v2/chats/{chat}/messages" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN"
Example Response200
{  "has_more": true,  "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_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"    }  ],  "turn_start_id": 0}