Skip to main content

POST /uploads


Uploads a binary file to the server and returns a json object with the file id, name, and url

The route handles the POST multipart request made to the /uploads path.

HTTP methodRoute


The server needs to receive a binary file via the multipart/form-data request. As with all multipart MIME types, the request body should contain:

  • the Content-Disposition header that should be set to form-data
    • the name attribute with the upload value
    • filename - the original file name of the uploaded file
  • the Content-Type header - the type of the file data content

Only one file can be sent per request.


Content-Disposition: form-data; name="upload"; filename="Screenshot from 2022-11-11 12-35-01.png"
Content-Type: image/png



The route returns a json object with the file id, name, and url.


"id": 4,
"name": "cat.png",
"url": ""

The HTTP status code shows whether the request succeeds (response.status == 200) or fails (response.status == 500).

Related articles: Working with server