Autoplace Fields
Business applications can call this API to add signature or user defined form fields to a document based upon the search criterion supplied. The placement options are: to the left, to the right, top and bottom. The document is search and all instances of the search criteria met are processed. This allows you to add multiple fields with one call. For example, upload a document and automatically place a signature field to the right of all instances of the word "Sign here:". This saves time and ensures no signatures are missed from the workflow.
The API call supports all types of fields; namely electronic, digital, in-person, initials, and text field etc.
In addition, the API call supports the "order" variable. This means you can assign a set of signature fields automatically to a single user. Hence, the call can be repeated to place and assign signature fields to more than one user in the workflow.
At least one user must exist in a workflow before signature fields can be added to the document in this way. The order number corresponds to the recipient in the workflow. Therefore, this number must be equal or less than the total number of users in the workflow. The below example assigns this new signature field to the first person in the workflow.
This API call can be used multiple times on the same document. The reason for doing so is to cater for multiple signatories on a document. The recipient or signatory is identified by the "order" variable passed in the call.
See Add Users to Workflow for more information. Note if you have a document with a template applied, or have applied one using the APIs, then the workflow will already contain users.
https://api.signinghub.com/v3/packages/{package_id}/documents/{document_id}/fields/autoplace |
||
HTTP Verb |
POST |
|
Authorization |
Bearer {access_token} |
|
Content-Type |
application/json |
|
Accept |
application/json |
|
Request Body |
{ "search_text" : "Sign here" , "placement" : "LEFT" , "order" :1, "field_type" : "ELECTRONIC_SIGNATURE" , "multiline" : "false" , "value" : "false" , "max_length" :100, "validation_rule" : "MANDATORY" , "radio_group_name" : "RadioButton_Group1" , "placeholder" : "Department Head" , "format" : "yyyy-mm-dd" , "font" :{ "name" : "HELVETICA" , "size" :12, "embedded_size" :7.5 }, "dimensions" :{ "width" :200, "height" :300 } } |
|
Status Code |
Message |
Response Body |
200 |
OK |
[{ "field_name" : "SH_SIGNATURE_731593" }, { "field_name" : "SH_SIGNATURE_95738" }] |
403 | Forbidden |
{ "Message" : "You are not allowed to perform this action on locked workflow" } |
{ "Message" : "Account is disabled" } |
||
{ "Message" : "You are not allowed to perform the requested operation" } |
||
{ "Message" : "You cannot add fields once the document has been signed" } |
||
{ "Message" : "You cannot add fields once the document is certified and signed" } |
||
{ "Message" : "You cannot add fields once the document is locked" } |
||
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 | OAuth access token obtained as a result of successful authentication via "client_credentials" grant type. |
search_text | Word that needs to be searched in the document. However, special characters are not supported if provided at the end of the search string. e.g. "SigningHub."|
placement (optional) | If the text is found, fields are to be placed in the document. Placement of the field can be mentioned in this attribute. Possible values of placement of a field are LEFT, RIGHT, TOP, BOTTOM. If no value is provided the default value will be LEFT. |
order | Order of the user to which the fields will be assigned automatically. Workflow in SigningHub orders recipients. This list begins with “1” for the first designated signer. |
field_type | Type of field to be created in the document. Possible values are "ELECTRONIC_SIGNATURE", "DIGITAL_SIGNATURE", "IN_PERSON_SIGNATURE", "INITIALS","TEXT", "NAME", "EMAIL", "COMPANY", "JOBTITLE", "RadioBox", "CheckBox", "DATE" |
multiline | This belongs to Text Area field type and If set to true, text area field would be created with multi line option. |
validation_rule | One or more rules for validation of the fields possible values are "MANDATORY" or "OPTIONAL". |
value | Value that user want to show in the field. |
radio_group_name | The group name required only when adding a Radio Box type field to group multiple Radio boxes together. |
max_length | Maximum length of the value allowed in the field. |
format | Text format of the field. Used for the date type field only. Possible values are
|
placeholder | Placeholder is needed for IN_PERSON_SIGNATURE or Text type form fields. Placeholder is shown as a collaborator name on the UI e.g., Customer, Doctor, Director. It helps to generally identify who is intended to sign or fill the field. |
font (optional) | Font of the fields text |
font > name | Name of the font selected for the text field. Possible values are "COURIER", "HELVETICA". |
font > size | Size of the font selected for the text field. Possible values are 8, 10, 12, 14, 16, 18, 20 |
font > embedded_size | Size of the font in the original PDF document. |
dimensions (optional) | Dimensions of a field to be created in the document. X and Y location is calculated automatically. API can only configure width and height for the field. If dimensions are not provided default dimensions will be followed. that is 200 x 80 in pixels. |
dimensions > width | Width of the field |
dimension > height | Height of the field |
Response Parameters | |
Message | The service specific error message returned by the API. This message provides useful information about why the service has returned an error response. |
field_name | Name of the field that was auto generated by the API. |