Signatures API

Warning

This endpoint entered deprecation in 21 February 2023. As per our deprecation policy, its sunset period started in 21 August 2023 and retirement will occur in 21 February 2025. Consider using the corresponding APIv2 endpoint instead.

Schematics

Schematic example of a signature process via API:

../../_images/SignatureAPI.png

Insertion of the signature fields in the PDFs

If your UKG HR Service Delivery configuration requires Keynectis to sign documents and in order to see the signatures on the final document, the PDF file must include a signature field by signatory (including a field for an “organization” if the delegation is used). Therefore, these fields must be included after generating the document to be signed and before sending it to the signature creation method (Creating a Signature).

The iText library allows form fields (and therefore signature fields) to be inserted into a PDF document. The fields must be positioned in the document where the handwritten signatures would be inserted if handwritten signatures were used.

For more information on iText, see the ‘API Java Documentation

If you are not sure your configuration requires Keynectis, please contact the Project Manager or CSM in charge of your account.

Sample Java Code:

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;

   public void AddTwoSignatureField() throws IOException, DocumentException, SymException {
     // File in which the fields are inserted
     File contract = new File("path/to/the/file.pdf");
     // New file with the fields
     File contractWithField = File.createTempFile("file_with_fields", ".pdf");
     PdfReader reader = null;
     PdfStamper stamper = null;
     try {
         reader = new PdfReader(contrat.getAbsolutePath());
         stamper = new PdfStamper(reader, new FileOutputStream(contractWithField));
         stamper.addSignature("FIELD_1", 6, 74f, 550f, 274f, 600f);
         stamper.addSignature("FIELD_2", 6, 355f, 550f, 555f, 600f);
     } finally {
             stamper.close();
             reader.close();
             contrat.delete();
             contratWithField.delete();
         }
     }

Sample file with integrated signature fields:

Download the sample, ready-to-sign PDF

Creating a Signature

URL

POST /api/v1/signatures/

Settings

This POST call must be encoded in multipart/form-data. All parameters must be encoded in JSON (serialized) in the POST data field, with the exception of the POST parameter file containing the binary file.

file (mandatory, but not expected for DocuSign template mode only):

Binary file of the document to be signed. This document must be in PDF format and if Opentrust or Keynectis technologies are used, it could include as many signature fields as there are signatories indicated in the signers field.

Note

If the PDF file does not contain any signature field, it is possible to create them alongside the signature by adding them in the generate_pdf_sign_field field (see below).

external_id (optional): Character string, VARCHAR(100)

Unique signature identifier reported by your system. If this parameter is present, our system performs a check: if there is already a signature with the external_id passed in the call parameter, UKG HR Service Delivery responds with a 409 CONFLICT with the identifier of the previously existing signature in the parameter (see the error message below)

signature_type (optional): Character string, VARCHAR(100)

Signature type code to obtain from the Project Manager in charge of your account. When using a signature with delegation, an organization type signatory must be present in the signers field. This code is a string of alphanumeric characters with no spaces and no accents, but dashes and underscores are allowed. For example: delegation001

document_type (mandatory): Character string, VARCHAR(100)

Document type code to be signed. Please contact the Project Manager in charge of your account to obtain the list of document type codes implemented on your platform. This parameter refers to the technical code of a document type as defined on UKG HR Service Delivery. For certain types of documents, some meta data or custom fields are required (see document_type_metas and document_type_filters below).

Example: employment_contract

document_type_metas (optional or mandatory depending on the configuration of the document type):

If the document type requires additional parameters (classification criteria), they must be indicated in this field. Each additional field is identified by a “technical code” (a string of alphanumeric characters without spaces or accents, but dashes and underscores are permitted). It could have for value an integer, a string or a date. The string could be a free entry or a value from a predefined list.

Example:

{
    'contract_starting_date': '2016-07-01',
    'contract_end_date': '2020-06-30'
}

document_type_filters (optional or mandatory depending on the configuration of the document type):

If the type of document requires custom fields (formerly referred as filters), they must be indicated in this field. Custom fields are configured by document type and share the same behaviour as the “document_type_metas” fields. Each field is identified by a “technical code” and can have for value an integer or a string. The string could be a free entry or a value from a predefined list. However they are rather used to limit access to the document as a user on UKG HR Service Delivery could have a restriction access on documents based on its values.

Example:

{
    'level': '4',
    'confidential': '1'
}

document_organization_codes (optional): Array

List of organization codes of the document.

If this parameter is specified in the call, the document is associated with all of the organizations.

For signatures involving an employee: the employee must belong to these organizations via an active or an inactive registration references. Otherwise, the method returns an HTTP 400 error.

If this parameter is not specified, the document is associated with all of the employee’s “active” organizations for current employees or with all of the employee’s “inactive” organizations for terminated employees.

For signatures without employees, pass the organization codes to copy on the document to restrict the access to the documents in the list of documents sent for signature.

Example: ["RM92", "MHC"]

title (mandatory): Character string, VARCHAR(255)

Title of the document. This title is the one displayed on UKG HR Service Delivery interface to identify the signature. It is also used to name the document when archived in the employee folder and distributed in the electronic vault.

Example: Employment contract Mathieu Martin - July 2016 - Ref: 457895

reason (mandatory): Character string, VARCHAR(255)

Reason for signing the document. This field is included in each electronic signature placed in the document and can be viewed under the signature details in Adobe Reader.

location (mandatory): Character string, VARCHAR(255)

Where the signature is taking place. This field is included in each electronic signature placed in the document and can be viewed under the signature details in Adobe Reader.

requestor_description (optional): Character string, VARCHAR(255)

Description of the ‘requestor’. See requestor_technical_id below.

requestor_technical_id (mandatory for AdobeSign, else optional): Character string, VARCHAR(50)

Technical Id of the ‘requestor’ (user) who initiates the signature. If a valid Tech Id is provided then the signature is attached to the user with this Tech Id. See also requestor_description above.

requestor_notification_when_signed (optional): true / false

If requestor_technical_id is known, send a notification by email to the requestor when all the signatories have signed the document (default: false). Ignored if auto_send is set to false

requestor_notification_when_rejected (optional): true / false

If requestor_technical_id is known, send a notification by email to the requestor when one of the signatories have rejected to sign the document (default: true).

expiration_date (mandatory): Formatted character string, VARCHAR(40)

Expiration date of the signature. Beyond this date, it is impossible for all the remaining signatories to sign the document. Once this expiration date has passed, the ‘Expired’ callback is ran: End of process or error callback.

Format: Date ISO 8601. Example: 2016-07-12. The expiration date must be today or after, but no more than one year from the signature’s creation date.

message (optional): Long text

Message inserted in the notification email sent to the signatories.

auto_archive (deprecated): true / false

See auto_send

Format: true or false

auto_send (optional): true / false

Automatically send the signed document to all signatories at the end of the signature process (true). Or notify the creator of the signature at the end of the process to connect to the interface to send the document manually (false).

In relation to auto_archive (deprecated):

  • If auto_send is set to true then whatever the value of auto_archive passed, auto_archive is set to true

  • If auto_send is set to false or not defined then if auto_archive is set, the value of auto_send is equal to auto_archive

Format: true or false. Default: false

callback_url (optional): Character string, VARCHAR(1000)

If indicated, this URL is called at the end of the signing process, when all signatories have signed the document, when one of the signatories has refused to sign, or when the signature period has expired. See:ref:callback.

billing_tag (optional): Character string, VARCHAR(255)

If indicated, this label is added to the signature to enhance billing categorization.

signers (mandatory): JSON

List of signatories, with their contact information. Each signatory is represented by a JSON object. There are 4 different types of signatories: organization, employee, manager (user), or external to be indicated in the “type” field. For every type of signatory, the following fields must be passed:

type (mandatory):

Type of signatory. This parameter can be one of organization, employee, manager, or external.

  • organization or organisation: in this case, the type of signature (‘signature_type’) must be different than standard. Maximum of one signatory for this type. For this signatory, a certification signature is added “by delegation” after the first signature.

  • employee: refers to an employee defined in UKG HR Service Delivery and identified by his/her employee number (field registration_reference).

  • manager: refers to a user (HR manager / manager with access to Document Manager) defined in UKG HR Service Delivery.

  • external: for any other person external to the company.

pdf_sign_field (mandatory):

Name of the signature field in the PDF file.

role_name (mandatory for DocuSign template mode only):

Name of the DocuSign role declared in the template.

generate_pdf_sign_field (mandatory for OpenTrust only):

If specified, an empty signature field is created for this signatory, named with the value of the parameter, pdf_sign_field and at the coordinates specified by the parameters below. The coordinates must be given in “point” form, originating at the lower left corner of the page.

  • page: page on which the field must be inserted, defaults to last page

  • llx: X-axis in points of the lower left corner of the signature field to be created

  • lly: Y-axis in points of the lower left corner of the signature field to be created

  • urx: X-axis in points of the upper right corner of the signature field to be created

  • ury: Y-axis in points of the upper right corner of the signature field to be created

Note

The coordinates of the signature fields have to be in points.

1 point = 1 inch/72, 1 inch = 2.54 cm. A4 page = 842 * 595 points

signing_order (integer, mandatory):

Signing order. The signatories are assigned in the order defined by this parameter.

registration_reference (mandatory when type = employee and technical_id is not indicated):

Employee number (the employee number must be unique for each employee defined in UKG HR Service Delivery).

technical_id (mandatory if type = employee and registration_reference is not indicated, or if type = manager):

Technical identifier of the employee or user (manager).

email_address (mandatory if type = external or organization):

Email address of the signatory. If the email address is not indicated, and if the signatory is an employee or manager, the email address defined in UKG HR Service Delivery under the user or employee’s profile is used.

phone_number (optional if type = employee or manager or external, mandatory if with_sms_notification and/or with_sms_authentication are true):

Telephone number of the signatory in the international format, without spaces or other separators, for example: 0033600000000. If this number is not provided and if the signatory is a an employee or manager, the phone number defined in UKG HR Service Delivery under the user or employee’s profile is used.

first_name (mandatory if type = external), VARCHAR(70):

First name of the signatory.

last_name (mandatory if type = external), VARCHAR(70):

Last name of the signatory.

language (applicable only if type = external): Character string, VARCHAR(10)

IETF language code <https://en.wikipedia.org/wiki/IETF_language_tag> Codes to define the language used when communicating with the signatory (email, text message). Please note that the languages available on the platform at the time of writing are de, es, en, fr, it, nl, nb, pt_BR. Only a subset of these languages might be available on your site. If you don’t provide a language code or if you provide one that is neither available nor correct, there is a fallback to the default language activated for the client. In the response, you can see the language set for the signatory after the creation of the signature

with_sms_notification (boolean, optional)

If not specified, the notification by text message is enabled if it is set by default in the signature type. Please contact the Project Manager in charge of your account for more information. If true the signatory is notified by text message.

with_sms_authentication (boolean, optional)

If not specified, the double authentication via text message is enabled if it is set by default in the signature type. Please contact the Project Manager in charge of your account for more information. If true the signatory receives a code by text message for confirm their identity.

send_signed_document (boolean, optional)

Only taken into account if the type of the signatory is manager. If it is set to true, it sends an email at the end of the signature process to the signatory with the signed document attached. Default value: false

notify_other_employees (Array, optional)

List of employee technical IDs. All employees in this list are notified when the signature process is completed. Default value: empty list.

Example of data parameter

{
  "external_id": "YOUR_SIGNATURE_ID",
  "signature_type": "delegation_01",
  "document_type": "contract",
  "document_type_metas": {
    "contract_starting_date": "2017-09-01",
  },
  "document_organization_codes": ["RM92", "MHC"],
  "title": "Job Contract John Doe",
  "reason": "Permanent Job Contract",
  "location": "Paris",
  "requestor_description": "Natalie Dupond",
  "expiration_date": "2017-08-31",
  "callback_url": "https://your-domain.com/signing_callback/",
  "auto_send": true,
  "notify_other_employees": ["some-tech-id"],
  "signers":
    [
      {
        "type": "organization",
        "pdf_sign_field": "FIELD_0",
        "signing_order": 1
      },
      {
        "type": "employee",
        "registration_reference": "007", // or: "technical_id": "007"
        "email_address": "signer_01@mail.com",
        "phone_number": "0033600000000",
        "signing_order": 2,
        "pdf_sign_field": "FIELD_1",
        "with_sms_notification": true,
        "with_sms_authentication": false,
      },
      {
        "type": "external",
        "signing_order": 3,
        "pdf_sign_field": "FIELD_2",
        "generate_pdf_sign_field": {
          "page": 1,
          "llx": 150,
          "lly": 100,
          "urx": 250,
          "ury": 150
        },
        "first_name": "John",
        "last_name": "Doe",
        "with_sms_notification": false,
        "with_sms_authentication": false,
        "language": "es"
      },
      {
        "type": "manager",
        "technical_id": "001",
        "email_address": "signer_2@mail.com",
        "phone_number": "0033600000000",
        "signing_order": 4,
        "pdf_sign_field": "FIELD_3",
        "with_sms_notification": false,
        "with_sms_authentication": true,
      }
    ]
}

Exemple of curl command

$ curl -XPOST http://api.people-doc.com/api/v1/signatures/
        -H "X-API-KEY: xxxxxxxxxxxxxxx" \
        -F "data=<-"
        -F file=@/path/to/file.pdf
        {
            "title": "Job Contract John Doe",
            "reason"': "Permanent Job Contract",
            "location": "Paris",
            "signers":[
                {
                    "type": "organization",
                    "pdf_sign_field": "FIELD_1",
                    "signing_order": 1,
                    "email_address": "organization@mail.com"
                },
                {
                    "type": "employee",
                    "pdf_sign_field": "FILED_2",
                    "signing_order": 2,
                    "registration_reference": "007",
                    "first_name": "John",
                    "last_name": "Doe",
                    "phone_number": "0033600000000",
                    "with_sms_authentication": true,
                    "with_sms_notification": false,
                    "sms_notification_sent": true,
                    "sms_authentication_sent": false
                }
            ],
            "signature_type":"contract",
            "document_type":"contract",
            "expiration_date":"2018-08-31",
            "auto_send": true
        }

Response

Success

The response is encoded in the JSON format with the following parameters:

id:

Returned if the creation of the signature was successful (code HTTP 201 CREATED). Identifier of the created signature process. This identifier is the one used in the callback. See: End of process or error callback.

uuid:

Returned if the creation of the signature was successful (code HTTP 201 CREATED). Universally unique identifier of the created signature process.

external_id (optional, if provided in the signature creation call):

Unique signature identifier as defined in your system

status:

Signature status. One of the following values:

  • pending: signing in progress, all signatories have not yet signed the document

  • signed: all signatories have signed the document, but the document has not been archived in the employee’s folder on UKG HR Service Delivery, and the signatories have not yet received the final signed version of the document (see auto_send parameter)

  • rejected: one of the signatories has refused to sign

  • archived: all signatories have signed the document and the document is archived in the employee’s folder on UKG HR Service Delivery. The document has been sent to all signatories to their vault (for employees with an active subscription) or, alternatively, by email

  • expired: the signature period has expired

  • canceled: the signature was cancelled through the UKG HR Service Delivery interface

  • error: an error has occurred during the signing process

signers:

The signatories, as well as the contact information actually used during the signing process, are returned in the response, with a signatory identifier id. This identifier may be used to send a reminder to any signatory who has not yet signed the document. See:ref:resend. The status of each signatory is also specified. This status may take the values pending, signed or rejected.

HTTP 201 Created

{
  "id": 15648512,
  'uuid': 'd5eacad8-359e-4091-9f53-e066bc8ea22c',
  "external_id": "YOUR_SIGNATURE_ID",
  "signature_type": "delegation_01",
  "document_type": "contract",
  "document_type_metas": {
    "contract_starting_date": "2017-09-01",
  },
  "document_organization_codes": ["RM92", "MHC"],
  "title": "Job Contract",
  "reason": "Permanent Job Contract",
  "location": "Paris",
  "requestor_description": "Natalie Dupond",
  "requestor_notification_when_signed": false,
  "requestor_notification_when_rejected": false,
  "expiration_date": "2017-08-31",
  "auto_send": true,
  "callback_url": "https://your-domain.com/signing_callback/",
  "status": "pending", // or ``signed``, ``archived``, ``error``, ``expired``, ``rejected``, ``canceled``,
  "notify_other_employees": ["some-tech-id"],
  "signers" :
    [
      {
        "id": "6789679",
        "type": "organization",
        "pdf_sign_field": "FIELD_0",
        "signing_order": 1,
        "status": "pending",
        "with_sms_authentication": null,
        "with_sms_notification": null,
        "sms_notification_sent": false,
        "sms_authentication_sent": false

      },
      {
        "id": "6789673",
        "type": "employee",
        "registration_reference": "007", // or: "technical_id": "007"
        "email_address": "signer_02@mail.com",
        "phone_number": "0033600000000",
        "signing_order": 2,
        "pdf_sign_field": "FIELD_1",
        "status": "pending",
        "with_sms_authentication": true,
        "with_sms_notification": false,
        "sms_notification_sent": true,
        "sms_authentication_sent": false
      },
      {
        "id": "67896764",
        "type": "manager",
        "technical_id": "67967890",
        "email_address": "signer_2@mail.com",
        "phone_number": "0033600000000",
        "signing_order": 3,
        "pdf_sign_field": "FIELD_2",
        "status": "pending",
        "with_sms_authentication": false,
        "with_sms_notification": true,
        "sms_notification_sent": false,
        "sms_authentication_sent": true
      }
    ]
}
  • sms_notification_sent: details if a notification was sent by text message. The value of this field can be different from the one requested (with_sms_notification). Indeed if null is passed, the behaviour is to use the value set by default on the signature type. Please contact the Project Manager in charge of your account for more information.

  • sms_authentication_sent: details if a sms authentication code was sent by text message. The value of this field can be different from the one requested (with_sms_authentication). Indeed if null is passed, the behaviour is to use the value set by default on the signature type. Please contact the Project Manager in charge of your account for more information.

Errors

HTTP 400 Bad Request: Invalid parameters.

List of errors in JSON format:

Each error is represented by its JSON object {'code': 1001, 'message': 'Invalid ...'}. The error message is given as an indication (debug).

  • code = 1400: Invalid email format

  • code = 1401: Employee identified by registration_reference or technical_id not found

  • code = 1402: User (manager) identified by technical_id not found

  • code = 1403: File format not valid

  • code = 1404: Can not have more than one signer of type organization

  • code = 1405: This signature_type does not accept signer of type organization

  • code = 1406: signing_order must be unique

  • code = 1407: Signer of type organization must be the first signer

  • code = 1408: Missing mandatory parameters: param1, param2, …

  • code = 1409: Invalid param param1

  • code = 1410: Date $date format invalid. Please use the ISO 8601 format

  • code = 1411: Param param1 invalid, type expected

  • code = 1412: Missing parameters, expecting param1

  • code = 1413: Please set signer for each role: role1, role2, …

  • code = 1414: The employee involved in this signature must belong to the organizations orga1, orga2, … via an active or an inactive registration references

  • code = 1415: Missing meta document dynamic attribute meta_data

  • code = 1416: Unknown meta dynamic attribute meta_data

  • code = 1417: Value custom_field_value is not allowed for this custom field custom_field, should be one of custom_field_value_1, custom_field_value_2, ..

  • code = 1418: Missing parameters in required document_type_metas expecting param_name

  • code = 1419: Meta code is not allowed for this doctype document_type

  • code = 1420: Value value is not allowed for this meta meta_data

  • code = 1422: No email found for this signer

  • code = 1423: Unknown type of signer of type

  • code = 1424: field_1 is required for signer of type type

  • code = 1425: Invalid phone number format. Please use the international phone number format with 00 before the country code

  • code = 1426: Error during upload

  • code = 1427: Error during signature fields generation

  • code = 1428: The signature with the external_id external_id already exist

  • code = 1429: Error during signature creation

  • code = 1430: Manager identified by requestor_technical_id not found

  • code = 1431: Signature cannot involve more than one employee

  • code = 1432: The expiration date date must be today or after, but no more than one year from the document's creation date.

  • code = 1434: The Technical IDs tech_ids do not match any Technical IDs known by UKG HR Service Delivery.

  • code = 3400: Signature process can not be canceled

  • code = 3401: Signature process is already canceled

  • code = 4400: Signature process can not be sent

  • code = 4401: Signature process is already sent

  • code = 5400: Signer already signed

  • code = 5401: Email can not be resent to signer

  • code = 5402: We can't proceed with this signature process because the person who created it is no longer in the system. Please initiate a new signature creation.

  • code = 6400: Signature process can not be deleted

Example:

HTTP 400 Bad Request
{
  "code": 1400,
  "message": "invalid email format"
}

HTTP 409 Conflict: (if the external_id has already been used to create an other signature). The signature details are then added to the error message in the data parameter:

HTTP 409 Conflict
{
  "code": 1428,
  "message": "The signature with the external_id YOUR_SIGNATURE_ID already exist",
  "data": {
    "id": 15648512,
    "external_id": "YOUR_SIGNATURE_ID",
    "signature_type": "delegation_01",
    "document_type": "contract",
    "document_type_metas": {
      "contract_starting_date": "2017-09-01",
    },
    "document_organization_codes": ["RM92", "MHC"],
    "title": "Job Contract",
    "reason": "Permanent Job Contract",
    "location": "Paris",
    "requestor_description": "Natalie Dupond",
    "expiration_date": "2017-08-31",
    "auto_send": true,
    "callback_url": "https://your-domain.com/signing_callback/",
    "status": "pending", // or ``signed``, ``archived``, ``error``, ``expired``, ``rejected``, ``canceled``
    "signers" :[
      {
        "id": "6789679",
        "type": "organization",
        "pdf_sign_field": "FIELD_0",
        "signing_order": 1,
        "status": "signed"
      },
      {
        "id": "6789673",
        "type": "employee",
        "registration_reference": "007", // or : "technical_id": "007"
        "email_address": "signer_2@mail.com",
        "phone_number": "0033600000000",
        "signing_order": 2,
        "pdf_sign_field": "FIELD_1",
      }
    ]
  }
}

HTTP 403 Forbidden: Authentication failed.

cURL example

curl -v -X POST "http://api.people-doc.com/api/v1/signatures/" \
    -H "Content-type: multipart/form-data" \
    -H "Accept: application/json" \
    -H "X-API-KEY: xxxxxxxxxxxxxxx" \
    -F "file=@contract.pdf" \
    -F "data={\"signature_type\": \"delegation_01\", \"document_type\": \"contract\", \"title\": \"Job Contract\", \"reason\": \"Permanent Contract\",\"location\": \"Paris\", \"expiration_date\": \"2017-08-31\", \"signers\": [{\"type\": \"organization\", \"pdf_sign_field\": \"FIELD_1\", \"signing_order\": \"1\", \"email_address\": \"signer_1@mail.com\"}, {\"type\": \"external\", \"pdf_sign_field\": \"FIELD_2\", \"signing_order\": \"2\", \"email_address\": \"signer_2@mail.com\", \"phone_number\": \"0033600000000\", \"first_name\": \"John\", \"last_name\": \"Doe\"}] }"

End of process or error callback

This URL is called:

  • At the end of the signature process which could be either when all signatories have signed the document or either when one of the signatories has refused to sign or when the signature period has expired

  • If an ‘error’ occurs during the signing process after the creation of the signature

  • If the signature is cancelled on the UKG HR Service Delivery interface

Settings

signature_id (deprecated):

Identifier of the signing process returned by APIv1

signature_uuid:

Identifier of the signing process returned by APIv2

file_number:

File number of the document to sign. This file number is referenced in all the notifications sent to the signers

external_id (optional):

Unique signature identifier reported by your system during the call for signature creation.

status:

Signature status. One of the following values:

  • pending: signing in progress, all signatories have not yet signed the document <!– In Progress in the UI –>

  • signed: all signatories have signed the document, but the document has not been archived in the employee’s folder on UKG HR Service Delivery, and the signatories have not yet received the final signed version of the document <!– Signing in Progress in the UI –>

  • archive in progress: the document is being sent to the signatories <!– Signed, sending in progress in the UI –>

  • sent: the document signed has been sent to the signatories and is waiting to be archived <!– Sent, pending for archive in the UI –>

  • archived: all signatories have signed the document and the document is archived in the employee’s folder on UKG HR Service Delivery. The document has been sent to all signatories to their vault (for employees with an active subscription) or, alternatively, by email <!– Signed and archived in the UI –>

  • rejected: one of the signatories has refused to sign

  • expired: the signature period has expired

  • canceled: the signature was cancelled through the UKG HR Service Delivery interface <!– Error or canceled in the UI –>

  • error: an error has occurred during the signing process <!– Error or canceled in the UI –>

comments (optional):

If status = rejected, contains the comment of the signatory who refused to sign the document if any

document_download_url (optional):

If status = signed, the document download URL

errors (optional):

If status = error, a list of errors in JSON format. See above for the list of possible errors

Example:

{
    "signature_id": "1",
    "external_id": "YOUR_SIGNATURE_ID",
    "status": "signed",
    "document_download_url": "http://api.people-doc.com/signature/xxx",
    "errors": [],
}

or

{
    "signature_id": "2",
    "external_id": "YOUR_SIGNATURE_ID",
    "status": "error",
    "document_download_url": "",
    "errors": [ {"code": 1400, "message": "Invalid ..."},],
}

or

{
    "signature_id": "3",
    "external_id": "YOUR_SIGNATURE_ID",
    "status": "rejected",
    "document_download_url": "",
    "comments": [{
      "signer_id": 567967,
      "comment": "There is a typo in my last name on page 3"
    }],
    "errors": [],
}

Authentication of the document download request

The URL received in the parameter document_download_url requests authentication on UKG HR Service Delivery before offering to download the document.

In certain cases, it is possible to bypass this authentication by “signing” the URL returned in the ‘document_download_url’ parameter of the callback.

The signature is included in the hash parameter, to be added to the URL returned.

The format of this signature is as follows:

SHA256 (token, signature_id, timestamp)

or

HASHMAC_SHA256 (token, signature_id, timestamp)

  • timestamp:

    Date of request generation, GMT timestamp in unix format in seconds. Decimals (if milliseconds are added for example) are also supported. Example: 1172960204 or 1172960204.2 or 1172960204.02. The generated URL remains valid for 5 minutes. Note, this timestamp must be based on a UTC+0 date.

  • hash:

    Signature (hash SHA256) of the concatenation (in this order) of the parameters: token, signature_id, timestamp). This security parameter therefore is used to ensure that the request originates from an authorized application (since it possesses a token). When UKG HR Service Delivery receives the request, this hash is recalculated locally and compared to that received. See the following paragraph for the generation of this parameter.

  • hash_method (optional):

    Function used for the hash parameter. If empty, the function used is hashmac. Possible values: ‘sha256’, ‘hmac’

Sample Python

Using the sha256 function: hash_method = sha256

import hmac
import hashlib
import time

# Secret Key shared between the HRIS and HR Service Delivery
secret_key = "TOKEN"

# Request parameters
signature_id = "007"

# Timestamp
timestamp = time.time()

print(timestamp)

# Preparation of the message string to sign
data = u'%s%s%s' % (secret_key, signature_id, timestamp)

# Hash calculation
built_hash = hashlib.sha256(data).hexdigest()

print(built_hash)

url = 'https://api.people-doc.com/api/v1/signatures/%s/download/?timestamp=%s&hash=%s&hash_method=sha256' % (signature_id, timestamp, built_hash)

print(url)

If the download URL returned in the callback is: https://api.people-doc.com/api/v1/signatures/signature_id/download/, then the single-use authenticated URL is:

https://api.people-doc.com/api/v1/signatures/signature_id/download/?timestamp={timestamp}&hash={hash}&hash_method=sha256

Using the hmac function, with hash_method not specified:

import hmac
import hashlib
import time

# Secret Key shared between the HRIS and HR Service Delivery
secret_key = "TOKEN"

# Request parameters
signature_id = ""007"

# Timestamp
timestamp = time.time()

print(timestamp)

# Preparation of the message string to sign
data = u'%s%s%s' % (secret_key, signature_id, timestamp)

# Hash calculation
built_hash = hmac.new(secret_key.encode('ascii'), msg=data.encode('utf-8'), digestmod=hashlib.sha256).hexdigest()

print(built_hash)

url = 'https://api.people-doc.com/api/v1/signatures/%s/download/?timestamp=%s&hash=%s&hash_method=hmac' % (signature_id, timestamp, built_hash)

print(url)

If the download URL returned in the callback is: https://api.people-doc.com/api/v1/signatures/signature_id/download/, then the single-use authenticated URL is:

https://api.people-doc.com/company/signatures/signature_id/download/?timestamp={timestamp}&hash=hmac

Signature Details

This method is used to obtain information and the status of a previously created signature process

URL

GET /api/v1/signatures/{signature_id}/

Settings

signature_id (GET parameter):

Identifier of a signature process

Response

Success

The response is encoded in JSON format with the following parameters (in addition to the parameters passed during the call):

id:

Returned if the creation of the signature was successful (code HTTP 201 CREATED). Identifier of the created signature process. This identifier is the one used in the callback. See: End of process or error callback.

uuid:

Returned if the creation of the signature was successful (code HTTP 201 CREATED). Universally unique identifier of the created signature process.

external_id (optional, if provided in the signature creation call):

Unique signature identifier as defined in your system

status:

Signature status. One of the following values:

  • pending: signing in progress, all signatories have not yet signed the document

  • signed: all signatories have signed the document, but the document has not been archived in the employee’s folder on UKG HR Service Delivery, and the signatories have not yet received the final signed version of the document

  • archived: all signatories have signed the document and the document is archived in the employee’s folder on UKG HR Service Delivery. The document has been sent to all signatories to their vault (for employees with an active subscription) or, alternatively, by email

  • rejected: one of the signatories has refused to sign

  • expired: the signature period has expired

  • canceled: the signature was cancelled through the UKG HR Service Delivery interface

  • error: an error has occurred during the signing process

comment:

Comment entered by a signatory when refusing to sign the document. Available in the details of the signer who refused to sign the document.

HTTP 200

{
  'id': 15648512,
  'uuid': 'd5eacad8-359e-4091-9f53-e066bc8ea22c',
  'external_id': 'YOUR_SIGNATURE_ID',
  'signature_type': 'delegation_01',
  'document_type': 'contract',
  'document_type_metas': {
    'contract_starting_date': '2017-09-01',
  },
  'document_organization_codes': ['RM92', 'MHC'],
  'title': 'Job Contract',
  'reason': 'Permanent Contract',
  'location': 'Paris',
  'requestor_description': 'Natalie Dupond',
  'expiration_date': '2017-08-31',
  'auto_send': true,
  'callback_url': 'https://your-domain.com/signing_callback/',
  'status': 'pending', // or ``signed``, ``archived``, ``error``, ``expired``, ``rejected``, ``canceled``,
  'notify_other_employees': ['some-tech-id'],
  'signers' :
    [
      {
        'id': '6789679',
        'type': 'organization',
        'pdf_sign_field': 'FIELD_0',
        'signing_order': 1,
        'status': 'signed'
      },
      {
        'id': '6789673',
        'type': 'employee',
        'registration_reference': '007', // or : 'technical_id': '007'
        'email_address': 'signer_2@mail.com',
        'phone_number': '0033600000000',
        'signing_order': 2,
        'pdf_sign_field': 'FIELD_1',
        'status': 'signed'
      },
      {
        'id': '67896764',
        'type': 'manager',
        'technical_id': '67967890',
        'email_address': 'signer_2@mail.com',
        'phone_number': '0033600000000',
        'signing_order': 3,
        'pdf_sign_field': 'FIELD_2',
        'status': 'rejected',
        'comment': 'I have good reasons.'
      }
    ]
}

Errors

HTTP 403 Forbidden:

Authentication failed

HTTP 404 Not Found:

The signature_id signature process does not exist

cURL example

curl -v -X GET "https://api.novapost.net/api/v1/signatures/yyyy/" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-API-KEY: xxxxxxxxxx"

List of signing processes

This method is used to obtain the list of signing processes created on UKG HR Service Delivery. The list of processes is returned in descending order by creation date.

URL

GET /api/v1/signatures/?state={state}&page={page}&external_id={external_id}

Settings

page (GET parameter, optional):

Current page, the results are paginated (20 results per page)

state (GET parameter, optional):

Signature status. One of the following values:

  • pending: signing in progress, all signatories have not yet signed the document

  • signed: all signatories have signed the document, but the document has not been archived in the employee’s folder on UKG HR Service Delivery, and the signatories have not yet received the final signed version of the document

  • archived: all signatories have signed the document and the document is archived in the employee’s folder on UKG HR Service Delivery. The document has been sent to all signatories to their vault (for employees with an active subscription) or, alternatively, by email

  • rejected: one of the signatories has refused to sign

  • expired: the signature period has expired

  • canceled: the signature was cancelled through the UKG HR Service Delivery interface

  • error: an error has occurred during the signing process

external_id (optional, if provided in the signature creation call):

Unique signature identifier as defined in your system

Response

Success

HTTP 200

{
  'data': [
    {
      'id': 15648512,
      'uuid': 'd5eacad8-359e-4091-9f53-e066bc8ea22c',
      'external_id': 'YOUR_SIGNATURE_ID',
      'signature_type': 'delegation_01',
      'document_type': 'contract',
      'document_type_metas': {
        'contract_starting_date': '2017-09-01',
      },
      'document_organization_codes': ['RM92', 'MHC'],
      'title': 'Job Contract',
      'reason': 'Permanent Contract',
      'location': 'Paris',
      'requestor_description': 'Natalie Dupond',
      'requestor_notification_when_signed': false,
      'requestor_notification_when_rejected': false,
      'expiration_date': '2017-08-31',
      'auto_send': true,
      'callback_url': 'https://your-domain.com/signing_callback/',
      'status': 'pending', // or ``signed``, ``archived``, ``error``, ``expired``, ``rejected``, ``canceled``,
      'notify_other_employees': ['some-tech-id'],
      'signers' :
        [
          {
            'id': '6789679',
            'type': 'organization',
            'signing_order': 1,
            'pdf_sign_field': 'FIELD_0',
            'status': 'signed'
          },
          {
            'id': '6789673',
            'type': 'employee',
            'registration_reference': '007', // or : 'technical_id': '007'
            'email_address': 'signer_2@mail.com',
            'phone_number': '0033600000000',
            'signing_order': 2,
            'pdf_sign_field': 'FIELD_1',
            'status': 'signed'
          },
          {
            'id': '67896764',
            'type': 'manager',
            'technical_id': '67967890',
            'email_address': 'signer_2@mail.com',
            'phone_number': '0033600000000',
            'signing_order': 3,
            'pdf_sign_field': 'FIELD_2',
            'status': 'pending'
          }
        ]
    },
    {...},
  ],
  'next_page': '/api/v1/signatures/?state={state}&page=3',
  'prev_page': '/api/v1/signatures/?state={state}&page=1'
]

Errors

HTTP 400 Bad Request:

Invalid parameters

HTTP 403 Forbidden:

Authentication failed

HTTP 416 Requested Range Not Satisfiable:

Error in the pagination

cURL example

curl -v -X GET "https://api.novapost.net/api/v1/signatures/" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-API-KEY: xxxxxxxxxxxxxx"

Canceling a signature

This method is used to cancel a signature process. The signature window for the document is therefore no longer accessible by the signatories who have not yet signed the document. In UKG HR Service Delivery management interface, the signature process is considered terminated with a status of cancelled. The document remains accessible “as it is” (signed by all or only some of the signatories at the time of cancellation).

This action is available for signature processes with a status of pending or signed

URL

PUT /api/v1/signatures/{id}/cancel/

Settings

id (GET parameter):

Identifier of the created signature process

Response

Success

HTTP 200

{
  'id': 15648512,
  'uuid': 'd5eacad8-359e-4091-9f53-e066bc8ea22c',
  'external_id': 'YOUR_SIGNATURE_ID',
  'signature_type': 'delegation_01',
  'document_type': 'contract',
  'document_type_metas': {
    'contract_starting_date': '2017-09-01',
  },
  'document_organization_codes': ['RM92', 'MHC'],
  'title': 'Job Contract',
  'reason': 'Permanent Contract',
  'location': 'Paris',
  'requestor_description': 'Natalie Dupond',
  'requestor_notification_when_signed': false,
  'requestor_notification_when_rejected': false,
  'expiration_date': '2017-08-31',
  'auto_send': true,
  'callback_url': 'https://your-domain.com/signing_callback/',
  'status': 'canceled'
  'signers' :
    [
      {
        'id': '6789679',
        'type': 'organization',
        'pdf_sign_field': 'FIELD_0',
        'signing_order': 1,
        'status': 'signed'
      },
      {
        'id': '6789673',
        'type': 'employee',
        'registration_reference': '007', // ou : 'technical_id': '007'
        'email_address': 'signer_2@mail.com',
        'phone_number': '0033600000000',
        'signing_order': 2,
        'pdf_sign_field': 'FIELD_1',
        'status': 'pending'
      },
      {
        'id': '67896764',
        'type': 'manager',
        'technical_id': '67967890',
        'email_address': 'signer_2@mail.com',
        'phone_number': '0033600000000',
        'signing_order': 3,
        'pdf_sign_field': 'FIELD_2',
        'status': 'pending'
      }
    ]
}

Errors

HTTP 400 Bad Request:

Invalid parameters

errors

List of errors in JSON format. See above for the list of possible errors

HTTP 403 Forbidden:

Authentication failed

HTTP 404 Not Found:

The signature_id signature process does not exist

cURL example

curl -v -X PUT "https://api.novapost.net/api/v1/signatures/yyyyyyyyy/cancel/" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-API-KEY: xxxxxxxxxxxxxxx"

Archiving a signature

This method is used to archive a signature process once all signatories have signed the document. The employee signatories receive an email notification that the signed document has been uploaded to their vault if they have an active subscription else the document is sent by email. The external signatories receive the signed document by email.

This method is only available for signature processes with a status of signed.

URL

PUT /api/v1/signatures/{id}/archive/

Settings

id (GET parameter):

Returned if the creation of the signature was successful (code HTTP 201 CREATED). Identifier of the created signature process. This identifier is the one used in the callback. See: End of process or error callback

Response

Success

HTTP 200

{
  'id': 15648512,
  'uuid': 'd5eacad8-359e-4091-9f53-e066bc8ea22c',
  'external_id': 'YOUR_SIGNATURE_ID',
  'signature_type': 'delegation_01',
  'document_type': 'contract',
  'document_type_metas': {
    'contract_starting_date': '2017-09-01',
  },
  'document_organization_codes': ['RM92', 'MHC'],
  'title': 'Job Contract',
  'reason': 'Permanent Contract',
  'location': 'Paris',
  'requestor_description': 'Natalie Dupond',
  'requestor_notification_when_signed': false,
  'requestor_notification_when_rejected': false,
  'expiration_date': '2017-08-31',
  'auto_send': true,
  'callback_url': 'https://your-domain.com/signing_callback/',
  'status': 'archived'
  'signers' :
    [
      {
        'id': '6789679',
        'type': 'organization',
        'pdf_sign_field': 'FIELD_0',
        'signing_order': 1,
        'status': 'signed'
      },
      {
        'id': '6789673',
        'type': 'employee',
        'registration_reference': '007', // or : 'technical_id': '007'
        'email_address': 'signer_2@mail.com',
        'phone_number': '0033600000000',
        'signing_order': 2,
        'pdf_sign_field': 'FIELD_1',
        'status': 'signed'
      },
      {
        'id': '67896764',
        'type': 'manager',
        'technical_id': '67967890',
        'email_address': 'signer_2@mail.com',
        'phone_number': '0033600000000',
        'signing_order': 3,
        'pdf_sign_field': 'FIELD_2',
        'status': 'signed'
      }
    ]
}

Errors

HTTP 400 Bad Request:

Invalid parameters

errors

List of errors in JSON format. See above for the list of possible errors

HTTP 403 Forbidden:

Authentication failed

HTTP 404 Not Found:

The signature_id signature process does not exist

cURL example

curl -v -X PUT "https://api.novapost.net/api/v1/signatures/yyyyyyyyy/archive/" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-API-KEY: xxxxxxxxxxxxxxx"

Sending a reminder

This method is used to send a reminder by email to one of the signatories of a signature process. By using this method, the targeted signatory receives an email containing a new link for signing the document.

URL

PUT /api/v1/signatures/{id}/resend/{signer_id}/

Settings

id (GET parameter):

Identifier of the created signature process

signer_id (GET parameter):

Identifier of the signer (received in response to the request for creation)

Response

Success

HTTP 200

{
  'id': 15648512 // signature process id
}

Errors

HTTP 400 Bad Request:

Invalid parameters

errors

List of errors in JSON format. See above for the list of possible errors

HTTP 403 Forbidden:

Authentication failed

HTTP 404 Not Found:

The signature_id signature process does not exist

cURL example

curl -v -X PUT "https://api.novapost.net/api/v1/signatures/yyyyyyyyy/resend/zzzzzz/" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-API-KEY: xxxxxxxxxxxxxxx"

Deleting a signature

Warning

Delete a signature process. Conversely to the cancellation of a signature process, when using this method, the signatories aren’t notified that the signature process has been deleted. The signature isn’t listed on UKG HR Service Delivery interface (List of signing processes).

Only possible on signature processes with the pending, sent, archived, expired, rejected, error or canceled state.

URL

DELETE /api/v1/signatures/{id}/

Settings

id (GET parameter):

Identifier of the created signature process

Response

Success

HTTP 202 (Accepted)

Errors

HTTP 400 Bad Request:

Invalid parameters

errors

List of errors in JSON format. See above for the list of possible errors

HTTP 403 Forbidden:

Authentication failed

HTTP 404 Not Found:

The signature_id signature process does not exist

cURL example

curl -X DELETE "https://api.people-doc.com/api/v1/signatures/yyyyyyyyyyyy/" \
    -H "Content-type: application/json" \
    -H "Accept: application/json" \
    -H "X-API-KEY: xxxxxxxxxxxxx"