New
Boost Developer Productivity & Streamline Onboarding with CDE's

Download the Whitepaper

Home
/
API
/
Files

Files

Files

Upload file

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/files \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/x-tar' \
  -H 'Coder-Session-Token: API_KEY'

POST /files

Body parameter

file: string

Parameters

NameInTypeRequiredDescription
Content-TypeheaderstringtrueContent-Type must be application/x-tar or application/zip
bodybodyobjecttrue
» filebodybinarytrueFile to be uploaded

Example responses

201 Response

{
  "hash": "19686d84-b10d-4f90-b18e-84fd3fa038fd"
}

Responses

StatusMeaningDescriptionSchema
201CreatedCreatedcodersdk.UploadResponse

To perform this operation, you must be authenticated. Learn more.

Get file by ID

Code samples

# Example request using curl
curl -X GET http://coder-server:8080/api/v2/files/{fileID} \
  -H 'Coder-Session-Token: API_KEY'

GET /files/{fileID}

Parameters

NameInTypeRequiredDescription
fileIDpathstring(uuid)trueFile ID

Responses

StatusMeaningDescriptionSchema
200OKOK

To perform this operation, you must be authenticated. Learn more.

See an opportunity to improve our docs? Make an edit.