Generate Document By Template

POST /esignglobal/v1/templates/createFileByTemplate

Interface Description

Asynchronously generate a PDF document using the TemplateId and the fields configured in the template.

Make sure the template is enabled before making the API call.

Request Parameters

Parameter

Type

Required

Description

templateId

string

true

Template ID

fileName

string

false

File name after generation

Note: The file name cannot include the following 9 special characters: / \ : * " < > | ? and any emojis.

fields

array

false

Field information in the template (Field ID and Field Key must be selected and transmitted.)

 

fieldId

string

false

Field ID (Automatically generated by the eSignGlobal system when setting the template)

 

fieldKey

string

false

Field Key (User-customized when setting the template.)

 

fieldValue

string

false

Field Fill Value

(1) can be filled according to the field type;

(2) When filling dynamic table fields, the insertRow parameter value must be true if a new row of data is required.

callBackUrl

string

false

Callback address (maximum length 500). It must be a valid https address.

Request Example

{
    "templateId": "1866fd459647435b98f7d40b2a9bc33e",
    "fields": [
        {
        	"fieldKey": "Number",
        	"fieldValue": "120000100101.001"
        },
        {
        	"fieldKey": "Date",
        	"fieldValue": "2025-07-07"
        },
        {
        	"fieldKey": "Checkbox",
        	"fieldValue": "[0,1,2]"
        },
        {
        	"fieldKey": "Radio",
        	"fieldValue": "1"
        },
        {
        	"fieldKey": "Select",
        	"fieldValue": "0"
        },
        {
        	"fieldKey": "Email",
        	"fieldValue": "test@gmail.com"
        },
        {
        	"fieldKey": "mergeFilling",
        	"fieldValue": "eSignGlobal"
        },
        {
        	"fieldKey": "tabkey",
        	"fieldId": "537c875667f24b9782a7bb42f1dc98b2",
        	"fieldValue": "[{\"row\":{\"column1\":\"Name\"}},{\"row\":{\"column1\":\"Jack\"}},{\"insertRow\":\"true\",\"row\":{\"column1\":\"Mike\"}}]"
        },
        {
        	"fieldId": "4d25013762f042758cdd727a9d4f8029",
        	"fieldKey": "",
        	"fieldValue": "123"
        }
    ]
}

Responses

Parameter

Type

Description

taskId

string

Document generation task id

Response Example

{
    "code": "0",
    "data": {
        "taskId": "7e6d1125dc164fa4b2c268f8bb809dea"
    },
    "message": "success"
}

Fields Filling Example

Fields

Fields Filling Example

Description

Text

"Specific Text"

Fill in specific text

Textarea

"Specific Text\nSpecific Text"

The specific text to be filled,

use \n for line breaks.

Number

"12345"

Accepts integers and decimals.

Date

"2025-01-01"

The default format is yyyy-MM-dd.

Support for specified formats:

yyyy年MM月dd日

yyyy-MM-dd

yyyy/MM/dd

dd.MM.yyyy

MM dd,yyyy

dd MM yyyy

Radio

"1"

The index starts from 0, where 0 represents Option 1, 1 represents Option 2, and so on.

Checkbox

"[0,1,2]"

The index starts from 0, where 0 represents Option 1, 1 represents Option 2, and so on.

Check

"0"  ,"1"  and "2"

0 represents unselected ,

1 represents checked,

2 represents crossed (available only if the "cross option" is enabled in the template configuration).

Select

"0"

The index starts from 0, where 0 represents Option 1, 1 represents Option 2, and so on.

Image

"URL"

Accepts image URLs

Table

[{\"row\":{\"column1\":\"Specifics\"}},{\"row\":{\"column1\":\"Specifics\"}},{\"insertRow\":\"true\",\"row\":{\"column1\":\"Specifics\"}}]

  • row represents the row data. The number of row objects equals the total rows added when creating the dynamic table.
  • row.column1 is the cell value under the column1 key for the current row.
  • row.column2 is the cell value under the column2 key for the same row.

Email

"123456@XX.com"

Email address

Interface Description
Request Parameters
Request Example
Responses
Response Example
Fields Filling Example