# Create Contract

To create a contract in development you need to make a POST call to the following URL : https://api-dev.deepblock.fr/api/contracts/create

To create a contract in production you need to make a POST call to the following URL : https://api.deepblock.fr/api/contracts/create

# Query Parameters

Field Type Optional/Required Description
recipients Array Required The list of the contract' signers. For each signer, you have to send at list the "email", "firstname", "lastname" and "phone_mobile". The mobile phone will be used to send the OTP code to sign the document. See the section below for more details on the parameters of the recipients array.
callbackUrl String Required The url on which sign action and document signed will be send (see section "Callback URL" for more information).
subject String Required This string is displayed on deepblock back office AND is send back on the callback URL. This string can be used as an external ID for your development.
from String Required The e-mail associated to your account
attachments Array Required The list of documents we submit for signatures. For each document, you have to send the "filename" (name of the file), the "content" (PDF file encoded in base64) and if the document is certified, you can add the field "isCertified" and set it to true but this field is not mandatory. Both of these fields are mandatory for each attachment.
signType Integer Optional Allow you to enable advanced signature. Signers will have to upload identity document before reading / signing the contract.
isPdfTag Integer Optional Allow you the possibility to use tag for signatures and place them wherever you want in the contract. In your PDF contract, just add |signer_firstname signer_lastname| and it will be replaced by the signature of the user.
eidasTimestamp Integer Optional A value of 1 add the Eidas certification to your document when signed.
isHandwrittenSignature Integer Optional Request the handwritten signature for all signers of the contract
needVerification Boolean Optional If set to true, once all signers—except the recipient flagged as "verificator" have signed, the callback URL will be triggered with the action "verification" and the list of signers who signed the contract.
EXAMPLE WITH REQUIRED PARAMETERS ONLY
{
	"recipients": [
		{
			"email":"john_doe@deepblock.eu",
			"firstname":"John",
			"lastname":"Doe",
			"phone_mobile":"0600000000",
			"comment":"Test",
            "verificator": true
		}
	],
	"callbackUrl":"https://webhook.site/5b85412e-f4f2-4245-bec8-204cee765d27",
	"subject":"First test",
	"from":"john_doe@deepblock.eu",
    "needVerification": true,    
	"attachments": [
		{
			"filename":"contrat-type.pdf",
			"content":"JVBERi0xLjMKJcTl8uXr/*** File in base64 ***/IF0gPj4Kc3RhcnR4cmVmCjEwMTgzCiUlRU9GCg=="
		}
	]
}

# Attachment Parameters Details

Here is a list of all the parameters available in the attachments array

Parameter Type Optional/Required Description
filename String Required the name of the file. This is the name that will be displayed in the signing page.
content String Required the file content encoded in base64.
isCertified Boolean Optional add the stamp "Conforme à l'original" on the final PDF file.

# Recipients Parameters Details

Here is a list of all the parameters available in the recipients array

Parameter Type Optional/Required Description
email String Required -
firstname String Required -
lastname String Required -
phone_mobile Integer Required The mobile phone will be used to send the OTP code to sign the document.
comment String Optional -
signPosition Integer Optional When added, this parameter allow you to define the order in which the signers will access the document to view and sign it. Rank 1 signers will all receive the signing link first. When the contract is signed by all of them, rank 2 signers will access the signing link and so on. (see example below).
searchAndReplace Array Optional You can create tags and place them in your document by putting |pipes| around any word you want to use as the name tag. Then, using the tag as a value to the "find" parameter inside the searchAndReplace array, allow you to replace the tag in the document by any string put in the "replace" parameter. You can also add style to these informations (See example below)
verificator Boolean Optional If set to true, this recipient will be the verificator of the contract. Once all other recipients have signed the contract, the callback URL will be triggered with the action "verification" and the list of signers who signed the contract.
CONTRACT WITH RANKS EXAMPLE
{
	"recipients": [
		{
			"email":"john_doe@deepblock.eu",
			"firstname":"John",
			"lastname":"Doe",
			"phone_mobile":"0600000000",
			"comment":"Test",
            "signPosition":1
		},

        {
			"email":"teri.edou@gmail.com",
			"firstname":"Teri",
			"lastname":"EDOU",
			"phone_mobile":"0600000000",
			"comment":"Test",
            "signPosition":1
		},

        {
			"email":"gia.len@gmail.com",
			"firstname":"Gia",
			"lastname":"LEN",
			"phone_mobile":"0600000000",
			"comment":"Test",
            "signPosition":2
		}
	],
	"callbackUrl":"https://webhook.site/5b85412e-f4f2-4245-bec8-204cee765d27",
	"subject":"First test",
	"from":"john_doe@deepblock.eu",
	"attachments": [
		{
			"filename":"contrat-type.pdf",
			"content":"JVBERi0xLjMKJcTl8uXr/*** File in base64 ***/IF0gPj4Kc3RhcnR4cmVmCjEwMTgzCiUlRU9GCg=="
		}
	]
}
CONTRACT WITH SEARCH AND REPLACE OPTIONS EXAMPLE
{
	"recipients": [
		{
			"email":"john_doe@deepblock.eu",
			"firstname":"John",
			"lastname":"Doe",
			"phone_mobile":"0600000000",
			"comment":"Test",
            "searchAndReplace": [
                {
                    "find": "|adresse|",
                    "replace": "Rue de Penthièvre" 
                },
                {
                    "find": "|pays|",
                    "replace": "France" 
                },
                {
                    "find": "|date|",
                    "replace": "2022-01-02",
                    "fontSize": 15
                },
                {
                    "find": "|paragraphe|",
                    "charsPerLine": 90,
                    "replace": "Vestibulum hendrerit dictum metus. Fusce tincidunt felis arcu, nec maximus odio eleifend ut. Mauris dapibus aliquet massa at pretium. Nulla vel lorem commodo, convallis dolor id, lacinia enim. Fusce eget aliquet justo. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Vestibulum ac purus ipsum. Curabitur eget semper nisl. Sed blandit tellus vitae magna iaculis, quis pretium velit iaculis." 
                }
            ]
		}
	],

	"callbackUrl":"https://webhook.site/5b85412e-f4f2-4245-bec8-204cee765d27",
	"subject":"First test",
	"from":"john_doe@deepblock.eu",
	"attachments": [
		{
			"filename":"contrat-type.pdf",
			"content":"JVBERi0xLjMKJcTl8uXr/*** File in base64 ***/IF0gPj4Kc3RhcnR4cmVmCjEwMTgzCiUlRU9GCg=="
		}
	]
}