Home > API Reference > Document Package > Apply Workflow Template

Apply Workflow Template

Business applications can use this service API to apply a workflow template to a document. The document ID on which template has to be applied is provided in the resource URL. 

While applying the template it is important to remember these two important points:

Point  1 - If the template being applied is created using a PDF which already contained form fields then ensure that the document on which this template is now being applied must contain these form fields in advance and SigningHub will NOT create those form fields via the template rather only apply the form data and assign to the respective users.

Point 2 - If the template being applied is created where form fields are manually added (hence not present in the PDF originally) via SigningHub e.g. signature field, initial, in-person signature, check boxes, radio buttons, text fields etc. then on applying such a template, these form fields will be created on the target document even if these form fields were already present in the document. 


https://api.signinghub.com/v3/packages/{package_id}/documents/{document_id}/template

HTTP Verb

POST

Content-Type

application/json

Accept

application/json

Authorization

Bearer {access_token}

Request Body

{
   "template_name": "sales contract template",
   "apply_to_all": true
}

Status Code

Message

Response Body

200

OK

{
   "document_id": 123,
   "document_name": "sales contract 105",
   "document_order": 1,
   "document_type": "PDF",
   "document_source": "My App",
   "document_width": 600,
   "document_height": 800,
   "document_pages": 12,
   "uploaded_on": "2015-01-12T11:12:13",
   "modified_on": "2015-01-13T10:10:15",
   "form_fields": true,
   "lock_form_fields": true,
   "certify": {
      "enabled": true,
      "permission": "FORM_FILLING_ALLOWED"
   },
   "template": {
      "template_name": "Sales Contract Template",
      "read_only": true
   }
}

401

Unauthorized

{
  "Message": "Request authorization denied"
}
{
  "Message": "User authentication required"
}

403

Forbidden

{
  "Message": "Document does not belong to user"
}
{
  "Message": "Document is no longer in draft state"
}
{
  "Message": "Enterprise admin's role does not allow managing integration"
}
{
  "Message": "You are not authorized to view this template"
}
{
   "Message": "Account is disabled"
}

404

Not Found

{
  "Message": "Document not found"
}
{
  "Message": "Template not found"
}

500

Internal Server Error

{
   "Message": "An internal server error occurred while processing the request"
}

The detail of each item provided in the request and response is provided below:

 Item Details
 Names
 Description
 Request Parameters
 access_token The access token obtained as a result of successful authentication. If "scope" parameter was used in authentication request, then this service requires the access token to be obtained using the credentials of an Enterprise admin whose enterprise role has the application integration privileges.

 document_id
The document ID for which the document details are requested. 

 package_id The Package ID of the package to which the document is added. 

 template_name Name of template to be applied on the document.

 apply_to_all True, if template is to be applied on all the documents in the package. 

 Response Parameters
 document_name
The name of the document.

 document_type
Type of the document e.g. "PDF".

 document_status
The current status of the document e.g. "COMPLETED".

 document_source
Identifies where the document was uploaded e.g. "My App".

 document_width
Width of the document in PDF format.

 document_height
Height of the document in PDF format.

 document_pages
Total pages of the document.

 uploaded_on The date and time when the document was uploaded.

 modified_on
The date and time when the document was last modified.

 form_fields
True if document has form fields.

 lock_form_fields True if locking of form fields with the last signature is enabled. 

 certify Certified signature settings for the document.

 certify > enabled True if certify signature is enabled for the document.
 
 certify > permission It is the certify permissions to be applied on the PDF document when the first signature is created. The possible values are "NO_CHANGES_ALLOWED", "FORM_FILLING_ALLOWED" and "FORM_FILLING_WITH_ANNOTATIONS_ALLOWED".

 template Template details, if the template is applied on the document. 

 template > template_name Name of the template applied on the document. 

 template > read_only True if the applied template is read only. User will not be able to make any changes if a read only template is applied. 

 Message The service specific error message returned by the API. This message provides useful information about why the service has returned an error response.






See also
Add Package
Rename Package
Upload Document
Add Document from Library
Share Document Package
Change Document Package Owner
Get Document Details
Get Document Image
Get Document Image (base64)
Download Document
Download Document (base64)
Rename Document
Delete Document
Get Certify Policy for a document
Update Certify Policy for a document
Get Package Verification
Get Document Verification
Change Document Order
Get Packages
Delete Package
Download Package
Download Package (base64)
Open Document Package
Close Document Package