Download contract documents

Contracts in Torii may store multiple documents such as PDF files. To download them from the API, use the following API calls:

Step 1

Use the List contracts API to get the unique file identifier of the documents stored in the contract:

curl -H "Authorization: Bearer API_KEY" \
     https://api.toriihq.com/v1.0/contracts?fields=id,documents

This will show contracts with their id and documents list:

[
  {
    "id": 1,
    "documents": [
      "name": "file.pdf",
      "idUpload": 179281
    ]
  }
]

Step 2

Use the Download file API to download the file. Replace the ID_UPLOAD with the idUpload from the previous step:

curl -L -H "Authorization: Bearer API_KEY" \
     -o downloaded_file.json \
     "https://api.toriihq.com/v1.0/files/ID_UPLOAD/download"

The file will be saved as downloaded_file.json.