Skip to content
Skip to Content
Coder Docs

Upload file

POST
/api/v2/files

Swagger notice: Swagger 2.0 doesn't support file upload with a content-type different than application/x-www-form-urlencoded.

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Header Parameters

Content-Type*string

Content-Type must be application/x-tar or application/zip

Default"application/x-tar"

Request Body

application/x-www-form-urlencoded
  1. body
file*unknown

File to be uploaded. If using tar format, file must conform to ustar (pax may cause problems).

Response Body

Returns existing file if duplicate

application/json
  1. response
hash?string
Formatuuid

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

curl -X POST \	"$CODER_URL/api/v2/files" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN" \	-H "Content-Type: {Content-Type}" \	--data-binary "@{file}"
Example Response
{  "hash": "19686d84-b10d-4f90-b18e-84fd3fa038fd"}