Chats

Upload a file to a chat's workspace

Changed on

Streams the request body into the chat workspace's upload directory. The request Content-Type header is recorded as the file's media type. There is no server-imposed size cap; client cancellation aborts the stream and the agent leaves no partial target file behind.

post/api/v2/chats/{chat}/workspace-files

Request

  • Base URL
    / (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    /api/v2/chats/{chat}/workspace-files
  • Auth
    API key in header Coder-Session-Token

Path parameters

chatstring uuid required

Chat ID

Headers

Content-Dispositionstring required

Filename of the file (attachment; filename=...)

Request body */*

string required

Response

Created

media_typestring

MediaType is the client-declared content type for display.

namestring

Name is the final basename of the uploaded file.

pathstring

Path is the absolute path of the file on the workspace.

sizeinteger

Size is the number of bytes written to the workspace.

workspace_idstring uuid

WorkspaceID is the workspace whose filesystem received the bytes. Message parts referencing this upload must carry it.

Changes