Upload a file to a chat's workspace
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.
CoderSessionTokenCoder-Session-Token<token>chat*stringChat ID
uuidContent-Disposition*stringFilename of the file (attachment; filename=...)
Raw file binary data
body*string*/*Created
application/json- response
media_type?stringMediaType is the client-declared content type for display.
name?stringName is the final basename of the uploaded file.
path?stringPath is the absolute path of the file on the workspace.
size?integerSize is the number of bytes written to the workspace.
workspace_id?stringWorkspaceID is the workspace whose filesystem received the bytes. Message parts referencing this upload must carry it.
uuidThe samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X POST \ "$CODER_URL/api/v2/chats/{chat}/workspace-files" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Disposition: {Content-Disposition}" \ -H "Content-Type: */*" \ --data-binary "@{file}"{ "media_type": "string", "name": "string", "path": "string", "size": 0, "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9"}