Docs

Basic Upload

The basic upload feature lets you upload small files quickly and with simplicity. Unlike the Resumable Upload process, you only need to send a single POST request to the API.

POST /files

Request Headers

The following request headers must be set.

Content-Type: application/json; charset=utf-8
X-Upload-Content-Length => 9999,
X-Upload-Content-Type => application/octet-stream
X-Api-Key: your_api_key
  • Content-Type defines the MIME type of the request. Since you are sending data as JSON, its value must be application/json; charset=utf-8.
  • X-Upload-Content-Length defines the number of bytes that will be uploaded. Its value must be equal to the size of the file you are uploading.
  • X-Upload-Content-Type defines the MIME type of the file that you are uploading. It can also be set to application/octet-stream by default.

Request Body

Then, here is the request body. That's where you are able to specify the file metadata and its content.

{
    "filename": "your_file.exe",
    "description": "Hello world.",
    "visibility": "public",
    "contents": {base64EncodedFileContents}
}

The contents attribute must contain the file contents, encoded as Base64.

Response

If the request succeeds, the API will respond with a 201 Created status code, and the response will include a Location header that specifies the file URL. This means that the upload is complete and successful.

Otherwise, if the request did not succeed, you should find a pretty straightforward error message. Also, don't forget to take a look at the Response Codes section in order to learn more about JSON-based error messages.