Introduction

Torii supports various features which involve uploading files, such as: importing contracts, uploading expense files and syncing custom integrations' data.

While it is possible to upload files via our user-interface, we also allow uploading files using our Public API.

Files are uploaded and stored securely on AWS's S3.

We follow best-practices and ensure maximum security during this process.

How-To Guide

To upload a file using our public API, you need to follow these 3 steps:

  1. Ask for an upload URL. This is a secure, temporary S3 URL:

    curl -H "Authorization: Bearer API_KEY" https://api.toriihq.com/beta/files/url?name={FILE_NAME}&type={CONTENT_TYPE}

    It returns a URL (used in step #2) and the file's path (used in step #3)

  2. Use the URL returned in step #1 to upload the file directly to S3:

    curl -H "Content-Type: {CONTENT_TYPE}" --data-binary @'PATH/TO/YOUR/FILE' -X PUT {S3_URL}

  3. Inform Torii that the file has been uploaded successfully:

    curl -d '{"path":"{FILE_PATH}","type":"{FILE_TYPE}"}' -H "Authorization: Bearer API_KEY" -H "Content-Type: application/json" https://api.toriihq.com/beta/files

    It returns a unique file identifier which can be used to get additional information about this upload.

Did this answer your question?