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
| Key | Type | Required | Description |
|---|---|---|---|
processId | string | Yes | ID of the data-filling workflow step, such as waitingProcess.id or the corresponding processes[].id. This is not the document ID. |
isFillPreview | boolean | No | true: 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. |
fillingItems | Array[object] | Yes | List of fields to fill. |
fillingItems[].key | string | Yes | Exact field key, including the double braces, for example {{f1.cua_hang}}. |
fillingItems[].value | string | For plain text | Text to fill into a plain text field. |
fillingItems[].selectedIndex | int | For single select | Index of the selected option in the field's option.availableValues list. Indexes start at 0. |
fillingItems[].selectedIndexes | Array[int] | For multiple select | Indexes of the selected options in the field's option.availableValues list. Indexes start at 0. |
fillingItems[].isChecked | boolean | For checkbox | true: checked; false: unchecked. |
Use the value property corresponding to each field type: value, selectedIndex, selectedIndexes, or isChecked.
Review and confirmation behavior
isFillPreview | Behavior |
|---|---|
true | Fills the document so the data can be reviewed. The data-filling step remains pending; the workflow does not advance. |
false | Confirms and applies the filled data to the document, completes the data-filling step, and advances to the next step. No further review is required. |
| Omitted | Same 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
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
| Key | Type | Description |
|---|---|---|
success | boolean | true: successful; false: failed. Check this field to determine the result, because both success and error examples return code: 0. |
code | int | System response code. |
messages | Array[string] | Result or error messages. The success message is Fill document success. |
data | object | Document details after filling. The full response may also contain waitingProcesses, processes, and document-level fillingItems. |
data.waitingProcess | object | Pending workflow step in the preview example. |
data.waitingProcess.fillingItems | Array[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 message | Cause | How to handle |
|---|---|---|
Fill item key not found | A 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 processed | The data-filling step has already been completed. | Retrieve the current document/workflow state and use the appropriate pending data-filling step, if any. |