Digital Signature API: Quickstart: send a contract in 1 call

To quickly create a contract and send it for signature, you can use the method « sendCommandPacket »

An easy way to call this method is to use the REST API with a single HTTP POST.

Prerequisites for the using the API

In order to use our API, you must have your API token, your contract as a PDF file and your « sellsign » file.

The « sellsign » file is formatted in JSON and contains your contract_definition_id and information about your contractor such as the number of the contract recipient and her identity information, as well as the name of the PDF.

Here is an example of the « sellsign » file:

    "customer": {
        "number": "mycustomer65778", // identifier of your customer
        "mode": 3, // desired signature mode: 3=e-mail+OTP
        "contractor_id": -1,
        "vendor": "",
        "fields": [{
                "key": "firstname",
                "value": "{{firstname}}"
                "key": "lastname",
                "value": "Dupont"
                "key": "civility",
                "value": "Mr"
                "key": "email",
                "value": "" // for testing purpose, you may use your own e-mail address here
                "key": "cellPhone",
                "value": "00000000000" // for testing purpose, you may use your own mobile phone number here
    "contractors": [],
    "contract": {
        "contract_definition_id": 2, // !!!CAUTION!!! this identifier depends on your environment and is provided to you with your API descriptor document, or available on your subscriber home page
                                      // It is used to identify which contract template is used and to associate specific behaviors with it (such as callbacks on contract validation)
        "pdf_file_path": "my_contract.pdf", // name of the PDF file as it is supplied in the HTTP request      
        "contract_id": -1,
        "message_title": "Your XYZ contract for signature",
        "message_body": "Please sign the contract using the button below"		
    "contract_properties": [
        "key": "internal_contract_id", // you may use this key to store your internal contract id, it will be provided to you when getting the signed contract back, making it easier to reconcile operations on your side
        "value": "my transaction identified", // your value for this key
        "to_fill_by_user": 0
    "files": [],
    "options": [],

    "to_sign": 1 // 1 to trigger the sending of the e-mail

Using the API in PHP

Using the cURL PHP library is not enough to interact with the API because it doesn’t give you the possibility to specify the appropriate « mime types » for each file.

Therefore, you must add an external library. We recommend the use of « Guzzle », a client that makes the sending of HTTP easy. Click here to access the documentation of the Guzzle library.

You have to add your API token in the header of your HTTP request. Then you should add the files and the application will ask you the « name » and « filename ». Both of these fields are the same and must match the name of the imported file. Carefully use the same name for the PDF file as the name indicated in the « sellsign » file.

Finally, you must add the content of the file by using the fopen function.

$response = $client->request('POST', '', [
    'headers' => [
        'j_token' => $token

    'multipart' => [
            'name'     => 'adhoc_light.sellsign',
            'contents' => fopen('C:\\xampp\htdocs\BridgeExample\\ressource/adhoc_light.sellsign', 'r'),
            'filename' => 'adhoc_light.sellsign',
            'headers'  => [
                'Content-type' => 'application/json'
            'name'     => 'my_contract.pdf',
            'contents' => fopen('C:\\xampp\htdocs\BridgeExample\\ressource/my_contract.pdf', 'r'),
            'filename' => 'my_contract.pdf',
            'headers'  => [
                'Content-type' => 'application/pdf'

Sample PHP code

Using the API in Java

You first have to add the API token in the header of your HTTP request. Then you should add the files. You need to provide the value of the field « filename », and it must match the name of the file provided in the HTTP request. Carefully use the same name for the PDF file as the name indicated in the « sellsign » file.

 HttpPost post = new HttpPost(""); // url of the service
post.setHeader("j_token", "0025514|ccssccscqdcdxesdvdsd/6Gcj/23CEB16hmg=" ); // authentication token

MultipartEntity mpe = new MultipartEntity();
// add the .sellsign file
String json_filename = "adhoc_light.sellsign";
InputStreamBody isb = new InputStreamBody( loadResource( json_filename ), "application/json", json_filename );
mpe.addPart( json_filename, isb);
// add the .pdf file
String pdf_filename = "my_contract.pdf"; // this name is the same as the name in the JSON generated above (see the example adhoc_list.sellsign)
isb = new InputStreamBody( loadResource( pdf_filename ), "application/pdf", pdf_filename );
mpe.addPart( pdf_filename, isb);

// Submit the request
HttpResponse response = client.execute(post);

Sample Java code