Delete a contract

If the contract is no longer relevant, or you would rather start it from scratch than fixing a mistake, you can simply delete the contract.

❗️

Warning

Be careful when deleting a contract; once deleted, it cannot be restored!
Always double-check you are deleting the correct contract by checking its ID.

Step 1. Obtain necessary information

To run the script described in this tutorial, you’ll need the following data:

Headers
x-oneflow-api-token You will only be able to run the script by using a valid API token. You can create an API token in the Oneflow web application. Find out more in the Authentication section.
x-oneflow-user-email The Oneflow user account email on whose behalf you want to delete the contract. You can find all user-related information using the users endpoint.
Path parameter
CONTRACT_ID The unique ID of the contract you want to delete. You can find the contract ID using the contracts endpoint.

Step 2. Run the code

Replace the values of the parameters in the following command with the actual data from your account and run it.

curl --request DELETE \
  --url https://api.oneflow.com/v1/contracts/CONTRACT_ID \
  --header 'x-oneflow-api-token: API_TOKEN' \
  --header 'x-oneflow-user-email: USER_EMAIL'
import requests

headers = {
    'x-oneflow-api-token': API_TOKEN,
    'x-oneflow-user-email': USER_EMAIL
    }

response = requests.delete('https://api.oneflow.com/v1/contracts/CONTRACT_ID', 
                           headers=headers)

print(response.json())

Expected response

This operation will delete the specified contract and display an empty body in the response.

Please see the Contract section in the Data model category for more information about the output.

Response codes

StatusMeaningDescription
200OKThe contract was deleted successfully. This response is also returned if the contract does not exist.
400Bad RequestInvalid format or content of the request.
401UnauthorizedThe API token or the user email is invalid.