Vault Documents API

Uploading a document to an employee’s vault

This method is used to upload a document directly to an employee’s vault. The employee receives an e-mail notification of the upload if they have activated their vault. If the vault has not been activated yet, users receive a notification that also contains the activation link.

Warning

This endpoint entered deprecation in July 2021. As per our deprecation policy, its sunset period started in January 2022 and retirement will occur in July 2022. Consider using the corresponding APIv2 endpoint instead.

URL

POST /api/v1/vault/documents/

Settings

Description of parameters

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

file (mandatory):

Binary file of the document to be uploaded. This document must be in PDF format.

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

May be a paper archive reference, for example.

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

Unique reference to a document in the client system (for example). If it is included in the request, a uniqueness verification is performed: if a document has already been uploaded with the same identifier, the method returns an HTTP 409 conflict error.

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

Title of the document as displayed in the employee vault.

Example: Employment contract Mathieu Martin - January 2012 - Ref: 457895

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

Tags associated with the uploaded document. To link this document to multiple tags, separate them with commas. The user may modify the classification of the document after receipt.

Example: Payslip

date (optional): Formatted character string, VARCHAR(40)

Date of document. Corresponds to the date used to file the documents by date in the employee vault. If this date is not specified, the filing date used is the date the document was uploaded (i.e. the API method call date)

Format: Date ISO 8601, including hours and minutes. Example: 2012-07-16T19 :20+01: 00

employee_technical_id (mandatory): Character string, VARCHAR(50)

Technical identifier of the employee.

Call samples

JSON view of a call (POST data parameter only):

POST /api/v1/vault/documents/

{
  'external_unique_id': "6789678GKVGHKVGHJK",
  'title': "Contrat de travail Jean Dupont Janvier 2013 - Dossier 678",
  'date': "2013-01-24",
  'tags': "Contart de travail",
  'employee_technical_id': "678967896789"
}

In cURL:

curl -v -X POST "https://api.novapost.net/api/v1/vault/documents/" \
    -H "Content-type: multipart/form-data" \
    -H "Accept: application/json" \
    -H "X-API-KEY: 4CF6FEEB9518E" \
    -F "file=@test.pdf" \
    -F "data={\"external_unique_id\": \"6789678GKVGHKVGHJK\",\"title\": \"Contrat de travail Jean Dupont Janvier 2013 - Dossier 678\",\"employee_technical_id\": \"678967896789\"}"

Response

Success

HTTP 201 Created: The document has been successfully uploaded

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 = 1408: mandatory parameter missing

  • code = 1409: incorrect parameter (e.g., the document type code does not exist)

  • code = 1421: Invalid date

  • code = 1426: Error during upload to archiving system

Example:

HTTP 400 Bad Request
{
  'code': xxxx,
  'message': "the email address jean@gmail@com is not a valid email address"
}

HTTP 409 Conflict: (if the parameter external_unique_id is passed in the call and already exists in the database).

HTTP 409 Conflict
{
  'code': xxxx,
  'message': "The docuement with the external_unique_id XXXXXXXXXXXXXXXXXX already exist",
}

HTTP 403 Forbidden: Authentication failed.