Home > API Reference > Document Preparation > Add TextBox Field

Add TextBox Field

Business applications can use this service API to add a text input field to a document in a package.

At least one user must exist in a workflow before fields (input and signature) 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.

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/text

HTTP Verb

POST

Authorization

Bearer {access_token}

Content-Type

application/json

Accept

application/json

Response Headers

Request Body

{
   "order": 1,
   "page_no": 1,
    "field_name": "Text field 1",
   "type": "TEXT",
   "format": "dd/mm/yy",
   "placeholder": "",
   "value": "",
   "max_length": 100,
    "multiline":true
   "field_type": "NUMBER | TEXT",
   "validation_rule": "MANDATORY",
   "font": {
      "name": "HELVETICA",
      "size": 12,
      "embedded_size": 7.5
   },
   "dimensions": {
      "x": 200,
      "y": 200,
      "width": 200,
      "height": 300
   }
}

Status Code

Message

Response Body 

200

OK

{
  "field_name": "Text field 1"
}
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"
}

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 the "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.

 package_id Package ID to which the document is added.

 document_id The document ID for which the action is to be taken.

 order
The order of the user in workflow for which the field is being added. 

 page_no Page number on which the field is to be created. 

 field_name (optional) Name of the field that is to be added. If not provided, system will assign an unique auto generated name to the field. 

 type Type of the field, possible values are "TEXT", "NAME", "EMAIL", "COMPANY", "JOBTITLE", "DATE". All text fields other then TEXT are auto filled in pending mode with the attributes/data of the recipient. 

 format Text format of the field. Used for the date type field only. Possible values are
  • m/d

  • m/d/yy

  • m/d/yyyy

  • mm/dd/yy

  • mm/dd/yyyy

  • mm/yy

  • mm/yyyy

  • d-mmm

  • d-mmm-yy
  • d-mmm-yyyy

  • dd-mmm-yy

  • dd-mmm-yyyy

  • yy-mm-dd

  • yyyy-mm-dd

  • mmm-yy

  • mmm-yyyy

  • mmmm-yy

  • mmmm-yyyy

  • mmmm d, yyyy

  • dd/mm/yy
  • ddmmmyyyy
 placeholder Placeholder text for the text field. For name, email, company, job title and date, placeholder value can be "NAME", "EMAIL", "COMPANY", "JOBTITLE", "DATE". Developers can send their own placeholders to overwrite the default values. For "TEXT" developers can provide a their own placeholder texts. These placeholders appear in the text fields while viewing the document in viewer. 

 value Value of the field.
For type=DATE, the value is expected to follow ISO 8601 format. Following the format YYYY-MM-DD hh:mm:ss +00. As the values are for date fields client applications can send YYYY-MM-DD and ignore hh:mm:ss +00. If value is not in proper format an error will be returned. 

 max_length

Maximum length of the value allowed in the field.

 multiline If set to true, multilne text field would be created
 field_type Field type with respect to accepting the type of values, possible values are "NUMBER" or "TEXT".

 validation_rule One or more rules for validation of the fields possible values are "MANDATORY" or "OPTIONAL".

 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 > x Left location of the field in pixel.

 dimensions > y Top location of the field in pixel.

 dimensions > width Width of the field in pixel.

 dimensions > height Height of the field in pixel.

 Response Parameters:
 field_name Name of the field created in the document. 

 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
Get Document Fields
Assign Document Field
Add Digital Signature Field
Add Electronic Signature Field
Add In-person Field
Add Initials Field
Add RadioBox Field
Add CheckBox Field
Autoplace Fields
Update Digital Signature Field
Update Electronic Signature Field
Update In-person Field
Update Initials Field
Update TextBox Field
Update RadioBox Field
Update CheckBox Field
Delete Document Field