header API

API: Add appendices

Loading contract appendices



[With appendix in HTTP Part (multipart/form-data)]


To upload an attachment whose option id is 1866.

Content-Length 54164	 	
Content-Type multipart/form-data; 

[the image file "Annexe.png"]



But how do I find the option_id?

A SELL&SIGN contract template can contain several options and appendices, which can have types and semantics. In order to add an appendix to your contract, you must first create an option dependent on the contract and the element definition.

Here are the steps to be carried out:

  1. Retrieve the ID of the option definition "hub.selling.contract.default.picture.option" with the getOptionDefinitionByName
  2. Then, retrieve the list of element definitions associated with this option using getElementDefinitionByName by passing the ID of the previous option definition
  3. Next, create the option using GetOrCreateOption by passing the ID of the first element definition from the previous list
  4. As seen above: call uploadPicture by passing the ID of the option just created

1) Find the OptionDefinitionId of the option definition that will host the Appendix

If you are working on a particular contract template, you need to know which optionDefinitionId to use. But most people start with a PDF ADHOC contract (generic PDF contract). If this is your case, our team has provided you with the ContractDefinitionId of the generic PDF contract of your license, and you can retrieve the optionDefinitionId from there:

If you want more information about the options, please refer to the pre-requisite documentation, by clicking on the red link below:

Defining option values and Smartfields


JSON input in the Body:
    "option_definition_name": "hub.selling.contract.default.picture.option",
    "contract_definition_id": [ContractDefinitionId]



In this example the ID of the definition option of interest is "281021".

2) Find the ElementDefinitionId of the option element that will host the appendix

For reasons that are too long to explain, it is now necessary to find the ID of the element of the option that will host the Appendix.


JSON input in the Body:
    "option_definition_id": 281021,
    "element_definition_name": ""



In this example the ID of the definition element we are interested in is "419401".

3) Create the Option that will carry the appendix(es)

Phew! We have the identifier we need to create the option that will carry the appendix(s) (and that will have the famous option_id).


json input:
  "contract_id" : [Contract Id],
  "element_definition_id": [the element id of the option, which is 419401],
  "value": [value to be assigned to the option]


    "id": 555555,
    "contractId": [ContractId],
    "elementDefinitionId": 419401,
    "syncTimer": 1589462203184,
    "value": "",
    "lastModificationPlace": "SERVER"

That's it! So the option ID is "555555". You just have to pass it as a parameter of the "uploadPicture" call at the top of the page to add an appendix!

In case of HTTP error

In case of HTTP error An HTTP 400 error may indicate the absence of a required parameter or an inappropriate value. The message attached to the error will allow you to find the cause of the error. In the case of an HTTP 500 error, you can contact support on our support portal.