Adding documents to contracts

Use the API to securely upload contracts and attachments.

  1. Upload the cover document
  2. Delete document

1. Upload the cover document

Contracts can have any number of files attached to them. Typically they are documents in PDF or office formats, but you can add any type of file.

Let's upload a document. You can use this sample PDF file, or one of your own.

You can upload files with a multipart/form-data HTTP POST to the api/documents/ endpoint. Include the file in the blob field and the parent contract ID in the contract field:

import requests

ZEFORT_APIKEY = "ySLE1mhh6lfRsYa..."
FILE = open('file/path/to/Sample_NDA.pdf','rb')

response ='', 
                         auth=(ZEFORT_APIKEY, ''),
                         files=[("blob", FILE)],
                         data={"contract": CONTRACT_ID})
Notice how the auth, files and data parameters are presented.
For example: files needs to be a tuple inside a list, while auth is just a tuple consisting of your API key and an empty string.


curl -X POST "" \
     -u $ZEFORT_APIKEY: \
     -F "blob=@Sample_NDA.pdf" \
     -F contract=$CONTRACT_ID


    "id": "doc_1Jq361GT0IIKsx354Vo",
    "content_type": "application/pdf",
    "role": "contract",
    "status": "queued",
    "filename": "Sample_NDA.pdf",
    "receive_time": "2021-10-13T07:16:56.521828Z",

Again, an ID has been allocated: doc_1Jq361GT0IIKsx354Vo. Note how Zefort objects IDs have a short prefix indicating the type of the object.

If you refresh the user interface, you'll see that the contract card is updated with a thumbnail view of our document.

A contract card with our sample NDA document as the cover document

The role of the document will be determined automatically: the first file will have role contract, and subsequent files will have role attachment.

Next steps

Now that you know how to attach documents to your contracts, it's time to update contract metadata.