How can we help?

How to Upload a File Using Our Public API

Noga Tubi
Noga Tubi
  • Updated
This article describes how to upload a file to Torii using our Public API.

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/v1.0/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/v1.0/files

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

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request