Update top-level information
Updating contract attributes
Using the PUT /contracts/{contract_id} endpoint, you can update the top-level attributes of an existing contract.
Currently, you can update the following attributes within the _private object of the request body:
namevaluesigning_period_expiration.
Note:If you run the PUT request with an empty request body,
{}or{"_private": {}}, the contract won't be updated.
Contract name
nameWhen updating the name attribute, pay attention to the following:
A PUT request with "_private": {"name": ""} will remove the contract name and will leave the other attributes unchanged.
Note:You can update the
nameattribute of a contract in thedraft,pending, andsignedstates.
Contract value
valueA PUT request with "_private": { "value": null} will remove the contract value and will leave the other attributes unchanged.
Note:You can update the
valueattribute of a contract in thedraft,pending, andsignedstates.
Contract signing_period_expiration
signing_period_expirationThere are three options available for signing_period_expiration:
neverdays_after_publishfixed_date.
Note:You can update the
signing_period_expirationattribute of a contract with thedraftstate. However,
it is also possible to partially update a contract in thependingstate: once the contract has been published, thesigning_period_expirationattribute can be set toneverorfixed_date.
When the contract is signed, thesigning_period_expirationcannot be updated.
Unlike name and value attributes, where you can use an empty string {""} or null to remove the current attribute value, to change the signing_period_expiration attribute, you need to specify the type attribute.
Note:Sending
"signing_period_expiration": nullwill result in an error.
Step 1. Obtain necessary information
In this tutorial, we will update all three top-level attributes described above:
namevaluesigning_period_expiration.
To run the script described in this step, 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
|
Your Oneflow user account email. |
| Path parameters | |
CONTRACT_ID |
The unique ID of the contract where you want to add a new participant. You can find the contract ID using the contracts endpoint. | Private |
_private [object]
|
|
name
|
The desired name of the existing contract. See Contract name. | Signing period expiration |
signing_period_expiration[object]
|
See Contract signing_period_expiration. |
type
|
Specify one of the three available types: never, days_after_publish, or fixed_date.
|
never
|
If you select the never type, the contract will have no expiration date.
|
days_after_publish
|
If you selected the days_after_publish type, the contract will be available for signing after the specified number of days after it has been published. You will need to specify the desired expire_days_after_publish along with this type (see the code example below).
|
fixed_date
|
If you selected the fixed_date type, the contract will be valid for signing till the specified day. You will need to indicate the desired expire_days_after_publish along with this type (see the code example below).
|
value[object]
|
|
amount
|
Specify the desired contract value (see the code example below). See also Contract value. |
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 PUT \
--url https://api.oneflow.com/v1/contracts/10015 \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-oneflow-api-token: 9841f1ee533681c3ea6a438560f2bb6c73b76675' \
--header 'x-oneflow-user-email: [email protected]' \
--data '
{
"_private": {
"name": "Support Agreement - Company AB",
"signing_period_expiration": {
"type": "days_after_publish",
"expire_days_after_publish": 21
},
"value": {
"amount": "500.10"
}
}
}import requests
url = "https://api.oneflow.com/v1/contracts/10015"
payload = {"_private": {
"name": "Support Agreement - Company AB",
"signing_period_expiration": {
"type": "days_after_publish",
"expire_days_after_publish": 21
},
"value": {"amount": "500.10"}
}}
headers = {
"Accept": "application/json",
"x-oneflow-api-token": "9841f1ee533681c3ea6a438560f2bb6c73b76675",
"x-oneflow-user-email": "[email protected]",
"Content-Type": "application/json"
}
response = requests.request("PUT", url, json=payload, headers=headers)
print(response.text)Expected response
{
"_links": {
"data_fields": {
"href": "https://api.oneflow.com/v1/contracts/10015/data_fields"
},
"events": {
"href": "https://api.oneflow.com/v1/contracts/10015/events"
},
"files": {
"href": "https://api.oneflow.com/v1/contracts/10015/files"
},
"parties": {
"href": "https://api.oneflow.com/v1/contracts/10015/parties"
},
"publish": {
"href": "https://api.oneflow.com/v1/contracts/10015/publish"
},
"self": {
"href": "https://api.oneflow.com/v1/contracts/10015"
},
"template": {
"href": "https://api.oneflow.com/v1/templates/11111"
},
"template_type": {
"href": "https://api.oneflow.com/v1/template_types/12222"
},
"workspace": {
"href": "https://api.oneflow.com/v1/workspaces/12345"
}
},
"_permissions": {
"contract:delete": true
},
"_private": {
"name": "Support Agreement - Company AB",
"signing_period_expiration": {
"type": "days_after_publish",
"expire_days_after_publish": 21
},
"value": {
"amount": "500.10",
"currency": "SEK"
},
"workspace_id": 12345
},
...
}Response codes
| Status | Meaning | Description |
|---|---|---|
| 200 | OK | Returns the contract with the created party. |
| 400 | Bad Request | Invalid format or content of the request. |
| 401 | Unauthorized | The API token or the user email is invalid. |
| 403 | Forbidden | The request is not authorized by the server. |
| 404 | Not Found | A required entity is missing. |
| 409 | Conflict | A conflict occurred with the current state of the target resource. |
Updated about 1 month ago
