Skip to main content
Version: 2.3.0

Fill document data

Updated date: 22/10/2026
Updated by: VNPT eContract's team


Purpose​

Fills document fields in a workflow step with Fill data permission (accessPermission.value = 5, permission code F). Supports plain text, single select, multiple select, checkbox fields...

The API can fill data for review without completing the step, or confirm the filled data and advance the workflow.

  • Request URL: {{HOST}}/documents/fill-process
  • HTTP method: POST
  • HTTP content-type: application/json
  • Authorize: Bearer token

Parameters​

KeyTypeRequiredDescription
processIdstringYesID of the data-filling workflow step, such as waitingProcess.id or the corresponding processes[].id. This is not the document ID.
isFillPreviewbooleanNotrue: fill the document for review without completing the step. false: confirm the filled data, complete the step, and advance to the next step. Defaults to false when omitted.
fillingItemsArray[object]YesList of fields to fill.
fillingItems[].keystringYesExact field key, including the double braces, for example {{f1.cua_hang}}.
fillingItems[].valuestringFor plain textText to fill into a plain text field.
fillingItems[].selectedIndexintFor single selectIndex of the selected option in the field's option.availableValues list. Indexes start at 0.
fillingItems[].selectedIndexesArray[int]For multiple selectIndexes of the selected options in the field's option.availableValues list. Indexes start at 0.
fillingItems[].isCheckedbooleanFor checkboxtrue: checked; false: unchecked.

Use the value property corresponding to each field type: value, selectedIndex, selectedIndexes, or isChecked.

Review and confirmation behavior​

isFillPreviewBehavior
trueFills the document so the data can be reviewed. The data-filling step remains pending; the workflow does not advance.
falseConfirms and applies the filled data to the document, completes the data-filling step, and advances to the next step. No further review is required.
OmittedSame as false.

To review before confirming, first call the API with isFillPreview: true. After reviewing, call the same API with the same processId, the data to confirm in fillingItems, and isFillPreview: false.

Sample requests​

Plain text​

{
"processId": "6ba8ccd8-4fb4-4083-4d79-08dbce1fbecf",
"isFillPreview": true,
"fillingItems": [
{
"key": "{{f1.hobby}}",
"value": "Glamping with my friend"
}
]
}

Single select​

selectedIndex: 1 selects the second option in option.availableValues.

{
"processId": "6ba8ccd8-4fb4-4083-4d79-08dbce1fbecf",
"isFillPreview": true,
"fillingItems": [
{
"key": "{{f1.product}}",
"selectedIndex": 1
}
]
}

Multiple select​

selectedIndexes: [0, 1] selects the first and second options in option.availableValues.

{
"processId": "6ba8ccd8-4fb4-4083-4d79-08dbce1fbecf",
"isFillPreview": true,
"fillingItems": [
{
"key": "{{f1.npk}}",
"selectedIndexes": [0, 1]
}
]
}

Checkbox​

{
"processId": "6ba8ccd8-4fb4-4083-4d79-08dbce1fbecf",
"isFillPreview": true,
"fillingItems": [
{
"key": "{{f1.dk_goi1}}",
"isChecked": true
},
{
"key": "{{f1.dk_goi2}}",
"isChecked": false
},
{
"key": "{{f1.dk_goi3}}",
"isChecked": false
},
{
"key": "{{f1.dk_goi4}}",
"isChecked": false
}
]
}

Confirm data and complete the step​

This request confirms the plain text data and advances to the next workflow step. Omitting isFillPreview has the same effect.

{
"processId": "6ba8ccd8-4fb4-4083-4d79-08dbce1fbecf",
"isFillPreview": false,
"fillingItems": [
{
"key": "{{f1.hobby}}",
"value": "Glamping with my friend"
}
]
}

Sample response body​

info

The response below is shortened from a separate checkbox example using the keys {{f1.ck1_1}} and {{f1.ck1_2}}. It illustrates isFillPreview: true: the data has been filled successfully, but the workflow step is still waiting and has not been completed.

{
"data": {
"id": "f6c3932b-f943-4118-7a36-08df2f5c2a87",
"no": "NOS.4",
"subject": "Tiêu đề NO.1",
"status": {
"value": 2,
"description": "Ready"
},
"waitingProcess": {
"id": "8079daeb-5ed2-4a3e-a709-08df2f5c2a8c",
"orderNo": 1,
"accessPermission": {
"value": 5,
"description": "Fill data"
},
"status": {
"value": 1,
"description": "Waiting"
},
"documentId": "f6c3932b-f943-4118-7a36-08df2f5c2a87",
"fillingItems": [
{
"key": "{{f1.ck1_1}}",
"value": "☑",
"displayName": "{{f1.ck1_1}}",
"option": {
"key": "{{f1.ck1_1}}",
"type": "checkbox",
"required": true,
"multiple": false,
"defaultValue": "",
"availableValues": ["☑", "☐"]
},
"positions": [
{
"page": 28,
"x": 176.208,
"y": 459.34097,
"width": 76.257996,
"height": 14,
"mergeFileOrderNo": 1
}
],
"groupName": "f1.ck1_",
"isChecked": true,
"type": "checkbox"
},
{
"key": "{{f1.ck1_2}}",
"value": "☐",
"displayName": "{{f1.ck1_2}}",
"option": {
"key": "{{f1.ck1_2}}",
"type": "checkbox",
"required": true,
"multiple": false,
"availableValues": ["☑", "☐"]
},
"positions": [
{
"page": 28,
"x": 249.316,
"y": 459.34097,
"width": 76.258,
"height": 14,
"mergeFileOrderNo": 1
}
],
"groupName": "f1.ck1_",
"isChecked": false,
"type": "checkbox"
}
],
"attachments": []
},
"processInOrder": true,
"isWaitToFillData": true,
"isFillable": true,
"downloadUrl": "{{HOST}}/Api/Download?token=..."
},
"success": true,
"code": 0,
"messages": [
"Fill document success"
]
}

Response description​

KeyTypeDescription
successbooleantrue: successful; false: failed. Check this field to determine the result, because both success and error examples return code: 0.
codeintSystem response code.
messagesArray[string]Result or error messages. The success message is Fill document success.
dataobjectDocument details after filling. The full response may also contain waitingProcesses, processes, and document-level fillingItems.
data.waitingProcessobjectPending workflow step in the preview example.
data.waitingProcess.fillingItemsArray[object]Fields for the pending step, including filled values, field options, positions, and checkbox states.

Error response body​

Field key not found:

{
"success": false,
"code": 0,
"messages": [
"Fill item key not found",
"{{f1.ck3_2d}}"
]
}

The data-filling step has already been processed:

{
"success": false,
"code": 0,
"messages": [
"Process has been processed"
]
}

Error description​

Error messageCauseHow to handle
Fill item key not foundA submitted field key was not found. The following entry in messages identifies the key.Check the step's current fillingItems and send the exact key, including double braces.
Process has been processedThe data-filling step has already been completed.Retrieve the current document/workflow state and use the appropriate pending data-filling step, if any.