Adding contracts

Use the API to securely upload contracts and attachments.

  1. Add a new empty contract
  2. Add a new contract with title

1. Add an empty contract

Create a new empty contract object:

import requests

ZEFORT_APIKEY = "ySLE1mhh6lfRsYa..."
response = requests.post('https://sandbox.zefort.com/api/contracts/', 
                         auth=(ZEFORT_APIKEY, ''))
print(response.json())
ZEFORT_APIKEY="ySLE1mhh6lfRsYa..."

curl -X POST "https://sandbox.zefort.com/api/contracts/" \
     -u $ZEFORT_APIKEY:

Zefort API calls always return the created or modified object. In this case, you get your new contract object:

{
    "id": "ct_1JrjJRTzEMlHVHls",
    "attributes": {
        "title": null,
        "end_date": null,
        "effective_date": null,
        "signed_date": null,
        "main_language": null
    },
    "cover_document": null,
    "num_emails": 0,
    "num_files": 0,
    ...
}

The contract you just created is visible in the sandbox user interface:

An empty contract card in the Zefort user interface

An ID for the contract has been allocated: ct_1JrjJRTzEMlHVHls

Other fields are still undefined (null) or empty. We'll fill in some information soon.

2. Add a contract with title

You can create new contracts with title by including a payload-json to your request:

import requests

ZEFORT_APIKEY = "ySLE1mhh6lfRsYa..."
payload = {'title': 'Important contract1'}

response = requests.post('https://sandbox.zefort.com/api/contracts/', 
                         auth=(ZEFORT_APIKEY, ''),
                         json=payload)

print(response.json())
ZEFORT_APIKEY="ySLE1mhh6lfRsYa..."

curl -X POST "https://sandbox.zefort.com/api/contracts/" \
     -u $ZEFORT_APIKEY: \
     -H "Content-Type: application/json" \
     -d '{"title": "Important contract1"}'


Response:

{
    "id": "ct_1JrjJRTzEMlHVHls",
    "attributes": {
        "title": "Important contract1",
        "end_date": null,
        "effective_date": null,
        "signed_date": null,
        "main_language": null
    },
    "cover_document": null,
    "num_emails": 0,
    "num_files": 0,
    ...
}

Next steps

Now you are able to create new contracts with titles!

Next, check out how to add documents to contracts.