Creating a contract

Introduction

This section is a collection of the most common issues that developers run into when using our API. Make sure to handle these issues user-friendly when designing your application to provide your users with a smooth and enjoyable experience.

General error format

Example:

{
		"detail": "You tried to add two identical participants to a contract. Check the documentation on how to avoid adding two participants to the same contract.",
		"parameter_problems": {
			"parties[1].participants[2].email": [
				"You tried to add a duplicate participant with the email address [email protected]."
			]
		},
		"request_id": "eLT8KV5aJj9qJK6q9vPojhqwnr4X8aM6FvCGC9iY42TH1szQt5GaIA==",
		"status": 400,
		"title": "Bad Request",
		"error_code": 4000003,
      "type": "https://api.oneflow.com/v1/error_codes/4000003",
}
AttributeDescription
detailA description of what caused the error and what can be done to prevent it.
parameter_problemsAn object that can contain the name of the problematic parameter as an attribute and a list of the causes of the problem as a value.
titleThe HTTP title of the error.
statusThe HTTP status code of the error.
request_idThe unique ID for the error you can provide to our support if you have trouble with a specific request.
error_codeA code to categorize the error.
typeAn optional URL to additional documentation regarding the error.

Access denied

AttributeValue
titleForbidden
status403
detailA description of what caused the error and what can be done to prevent it.

The user must have permission to create a contract in the specified workspace. To check that, log in to the Oneflow app with the corresponding credentials. Then select the workspace, and create a new contract from your template.

📘

Note:

Make sure the template is active on the Templates page.

Too many participants

AttributeValue
titleBad request
status400
detailA description of what caused the error and what can be done to prevent it.

🚧

Note:

It is not allowed to add more than 40 participants to a contract.

When you create a contract from a template, Oneflow will automatically add the participants from the templated to the new contract. The user who issues the contract create request will also be a participant in the contract. You can add additional participants to the contract create request when creating a contract.

The tip to avoid this error is to limit the number of participants to 29. If this option works for you, make sure the number of participants from the template and the number of participants you add explicitly in the contract create request never add up to more than 29 participants. This way, you do not have to worry about exceeding the number of participants added for the current user.

Duplicate participants

AttributeValue
titleBad request
status400
detailA description of what caused the error and what can be done to prevent it.
parameter_problemsThe name of the problematic parameter as an attribute and a list of the causes of the problem as a value.
AttributeValue
titleBad request
status400
detailA description of what caused the error and what can be done to prevent it.
parameter_problemsThe name of the problematic parameter as an attribute and a list of the causes of the problem as a value.

It is not allowed to add two participants with the same email address or phone number to a contract. To avoid this error, make sure that the participants you explicitly send with your request, the current user, and the participants of the template you are using, have unique email addresses and phone numbers.

Missing a delivery channel attribute

AttributeValue
titleBad request
status400
detailA description of what caused the error and what can be done to prevent it.

The delivery channel is used to send notifications to the contract participants. This error might occur if a participant lacks an email and the delivery channel is set to email. To prevent this error, make sure the participants with the specified delivery channel have all the required attributes for that delivery channel. You can view this information in the template before creating a contract from it.

Unknown value

AttributeValue
titleBad request
status400
detailA description of what caused the error and what can be done to prevent it.

The "unknown" value is used for enumeration variables on output for values that the API doesn't currently support and is used to keep backward compatibility in the future. It can never be used as an input value for an enumeration variable. The parameter_problem attribute will show you the attribute that you tried to set to "unknown," as in the example below:

"parameter_problems": {
    "parties[1].participants[2].sign_method": [
        "sign_method cannot be set to \"unknown\"."
    ]
}

Missing access to the template

AttributeValue
titleNot found
status404
detailA description of what caused the error and what can be done to prevent it.

This error occurs if the template you try to create your contract from does not exist or the current user does not have access to it. To check that the current user can access the object, you can get the template details from our contract_create_data helper endpoint.

Wrong workspace

AttributeValue
titleNot found
status404
detailA description of what caused the error and what can be done to prevent it.
parameter_problemsThe name of the problematic parameter as an attribute and a list of the causes of the problem as a value.

This error might occur if the workspace where you create your contract does not exist or the current user does not have access to it. To check that the current user has access to the specified workspace, use our contract_create_data helper endpoint.

Unavailable option

AttributeValue
titleConflict
status409
detailA description of what caused the error and what can be done to prevent it.

This error might occur if you use an option not listed as an available option in the template. For instance, if you pick the Danish MitID as the sign_method for a participant, but the extension for this sign method is not enabled in your Oneflow account, you will get an error with the following details in the parameter_problems attribute of the error:

"parameter_problems": {
    "parties[0].participants[2].sign_method": [
        "The sign method danish_mitid is not in the set of available sign methods: norwegian_bankid, sms, standard_esign, swedish_bankid."
    ]
}

Another example is that the same_device delivery channel requires a safe sign method and doesn't allow the sign method to be standard_esign.

To prevent this error, check if the specified sign_method is available for the template and the delivery_channel you want to use. You can verify this by sending a Get a template by ID request and checking the available_options attribute and the sign_methods in the response.