This guide explains how to make an upload request using Quatrix API. 

  1. Log in to the account using GET /session/login. 
  2. Get home_id from GET /profile

  3. Retrieve a link for uploading a file using POST /upload/link with the following parameters:

    Name TypeDefault ValueDescription

    name*

    string-

    file name

    parent_id*


    string-

    the ID of the folder where you would like to upload your file.

    parent_id = home_id  from the previous call

    resolve


    booleantrue

    if there is an existing file with the same name, the new file will not be overwritten and will have an extension in its name (e.g.: the existing file - test.pgp and the new file - test(1).pgp )

    if the value is false and the file with the same name already exists, you'll get an error: TypeError: Failed to fetch

    file_size

    number-file sizes are measured in bytes (B)

    * required parameters 

  4. Get the upload_key from the previous call and make POST /upload/chunked/{id}.
  5. Complete the chunked upload of the file using GET /upload/finalize/{id}.

Example Request URL


Request Payload

{
  "name": "file_name",
  "parent_id": "b5774c2a-82c2-4853-ada7-efcad4fdf325",
  "resolve": true,
  "file_size": 0
}
JS

Response Body

{
  "parent_id": "b5774c2a-82c2-4853-ada7-efcad4fdf325",
  "file_id": "30858a08-1016-4ef7-969c-173dcc836af3",
  "name": "file_name",
  "upload_key": "8d1f647e-be74-4f9a-969c-1dc5230d44cc"
}
JS


Copy the upload key and use it for the next call: POST /upload/multipart/{upload_key} or POST /upload/chunked/{upload_key}

Please note that this call cannot be executed in Swagger and you can check the example in Postman below.

Request URL 

https://test-api.quatrix.it/upload/multipart/8d1f647e-be74-4f9a-969c-1dc5230d44cc (where 8d1f647e-be74-4f9a-969c-1dc5230d44cc is the upload key)

Once you enter the upload key, choose files and hit the Send button. 

The upload key is valid for 15 minutes and is invalidated once you make a POST /upload/multipart/{upload_key} call.