Deleting documents to contracts

Use the API to move documents and contracts to trash

  1. Delete document
  2. Delete contract

1. Delete document

Deleting documents is really simple.

Here is an example of a simple delete document -procedure using request method delete:

import requests

ZEFORT_APIKEY = 'ySLE1mhh6lfRsYa...'
DOCUMENT_ID = 'doc_1Jq361GT0IIKsx354Vo'

response = requests.delete(f'https://sandbox.zefort.com/api/documents/{DOCUMENT_ID}/', 
                           auth=(ZEFORT_APIKEY, ''))
print(response)
ZEFORT_APIKEY="ySLE1mhh6lfRsYa..."
DOCUMENT_ID="doc_1Jq361GT0IIKsx354Vo"

curl -X "DELETE" "https://sandbox.zefort.com/api/documents/$DOCUMENT_ID/" \
     -u $ZEFORT_APIKEY:

When you have your document succesfully deleted, you'll get a <Response [204]> with no additional json content.

2. Delete contract

As you will see, most of the functions you can perform using Zefort API obey the same basic rules, making it easy to derive your code from one method to another.

Here's an example of deleting a contract:

import requests

ZEFORT_APIKEY = 'ySLE1mhh6lfRsYa...'
CONTRACT_ID = 'ct_1JrjJRTzEMlHVHls'

response = requests.delete(f'https://sandbox.zefort.com/api/contracts/{CONTRACT_ID}/', 
                           auth=(ZEFORT_APIKEY, ''))
print(response)
ZEFORT_APIKEY="ySLE1mhh6lfRsYa..."
CONTRACT_ID="ct_1JrjJRTzEMlHVHls"

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

With only changing the url endpoint from /documents/ to /contracts/ and using the corresponding contract id, we have managed to succesfully delete a whole contract. <Response [204]> will once more be your sign of success.

Deleting a contract is not a permanent action. You can find your deleted contracts from trash.