Nhảy tới nội dung
Phiên bản: 2.3.0

Import lô chứng từ nâng cao

Ngày cập nhật: 26 tháng 11, 2026
Người cập nhật: VNPT eContract's team


Mục đích​

API cho phép tạo hàng loạt chứng từ trong một lần gọi dựa trên mẫu chứng từ (documentTemplateId) đã được chuẩn bị trước trên hệ thống. Mỗi phần tử trong documents tạo thành một chứng từ; dữ liệu trong parameters được điền vào các trường tương ứng của mẫu. Quy trình xử lý của từng chứng từ được khai báo riêng trong workflow.

  • Request URL: /v3/batch-imports/create-advanced
  • HTTP method: POST
  • HTTP content-type: application/json
  • Authorize: Bearer token

Tham số request​

KeyTypeBắt buộcMô tả
namestringCóTên lô chứng từ
departmentIdintCóID bộ phận
documentTypeIdintCóID loại chứng từ
documentTemplateIdintCóID mẫu chứng từ dùng để tạo chứng từ
documentsarrayCóDanh sách chứng từ cần tạo; mỗi phần tử tương ứng với một chứng từ
documents[].fileNamestringCóTên file chứng từ; truyền "[AUTO]" để hệ thống tự sinh
documents[].nostringCóMã chứng từ; truyền "[AUTO]" để hệ thống tự sinh
documents[].subjectstringCóTiêu đề chứng từ; truyền "[AUTO]" để hệ thống tự sinh
documents[].expiryDatestringKhôngNgày hết hạn xử lý chứng từ
documents[].cusCodestringKhôngMã khách hàng
documents[].cusNamestringKhôngTên khách hàng
documents[].contractValuestringKhôngGiá trị hợp đồng
documents[].validFromstringKhôngNgày bắt đầu hiệu lực hợp đồng
documents[].validTostringKhôngNgày kết thúc hiệu lực hợp đồng
documents[].refDocsstringKhôngMã chứng từ liên quan; nhiều mã phân cách bằng dấu ;
documents[].descriptionstringKhôngMô tả chứng từ
documents[].attachmentstringKhôngTệp đính kèm
documents[].workflowobjectCóQuy trình xử lý của chứng từ
documents[].parametersobjectTheo mẫuCác cặp mã trường và giá trị cần điền vào mẫu chứng từ; mã trường không gồm {{ }}

Chi tiết Workflow​

KeyTypeBắt buộcMô tả
processInOrderbooleanCóXử lý tuần tự (true) hay song song (false)
templateIdintKhôngID mẫu quy trình
recipientsarrayKhôngDanh sách người nhận xử lý; thứ tự trong mảng là thứ tự các bước
recipients[].codestringCóMã người dùng được phân công xử lý
recipients[].accessPermissionstringCóMã quyền xử lý, ví dụ "D" (ký số), "DR" (ký nháy); xem Phụ lục
recipients[].requireAllToCompletebooleanKhôngVới bước nhóm, yêu cầu tất cả thành viên hoàn tất; mặc định true
recipients[].signGroupsarrayKhôngDanh sách người xử lý song song trong bước này
recipients[].signGroups[].codestringCóMã người dùng trong nhóm
recipients[].signGroups[].accessPermissionstringCóMã quyền xử lý của người dùng trong nhóm
Lưu ý

Khi signGroups có phần tử, hệ thống tạo bước xử lý theo nhóm và bỏ qua code, accessPermission ở cấp recipients[]. Mỗi người trong nhóm cùng thực hiện một bước; requireAllToComplete mặc định là true.

mẹo

accessPermissionCode là các quyền truy cập xử lý chứng từ:

  • V là chỉ xem
  • D là ký số
  • E là ký điện tử
  • EKYC là ký eKYC
  • DR là ký nháy
  • A là phê duyệt
  • F là điền dữ liệu
  • C là điều phối
cẩn thận
  • Các khóa trong documents[].parameters không cần thêm {{ }} vào trường.
  • Mã chứng từ (no) là bắt buộc và không được trùng với mã đã tồn tại.
  • Các giá trị ngày như expiryDate, validFrom, validTo phải hợp lệ và dùng định dạng dd/MM/yyyy, ví dụ 22/12/2028.
  • Quyền "F" (điền dữ liệu) luôn được xếp trước "D", "E", "EKYC" và "DR" trong quy trình tuần tự.
  • Mỗi chứng từ trong documents có thể khai báo workflow và parameters riêng.

Mẫu request​

Ví dụ dưới đây tạo một chứng từ; quy trình gồm hai bước xử lý riêng và một bước nhóm song song gồm hai người.

{
"departmentId": 4424,
"documentTemplateId": 7991,
"documentTypeId": 8967,
"name": "Import lô chứng từ có nhóm xử lý",
"documents": [
{
"fileName": "[AUTO]",
"no": "[AUTO]",
"subject": "[AUTO]",
"expiryDate": "",
"cusCode": "",
"cusName": "",
"contractValue": "",
"validFrom": "",
"validTo": "",
"refDocs": "",
"description": "",
"attachment": "",
"workflow": {
"processInOrder": true,
"templateId": null,
"recipients": [
{
"code": "user01",
"accessPermission": "DR"
},
{
"code": "user02",
"accessPermission": "D"
},
{
"requireAllToComplete": true,
"signGroups": [
{
"code": "user03",
"accessPermission": "D"
},
{
"code": "user04",
"accessPermission": "D"
}
]
}
]
},
"parameters": {
"DIACHILV": "Tầng 10 tòa nhà VNPT, Hà Nội",
"BOPHAN": "Nhân Sự",
"GIOLAMVIEC": "08:00-17:00 từ Thứ 2 đến Thứ 6",
"DVTIEN": "VND",
"NGAYCAP_CCCD": "2019-08-20",
"NOICAP_CCCD": "Công an TP Hà Nội",
"HKTT": "123 Phố Huế, Hai Bà Trưng, Hà Nội"
}
}
]
}

Trong ví dụ trên, quy trình tuần tự gồm bước 1 — ký nháy (DR), bước 2 — ký số (D), và bước 3 — nhóm xử lý song song gồm hai người cùng ký số (D). Tổng cộng có bốn người tham gia xử lý.

Mẫu response body​

{
"data": {
"id": 23110,
"createdDate": "2026-11-25T10:32:47.3032188+07:00",
"uploadedByUserId": 70528,
"numberOfRecords": 1,
"name": "Import lô chứng từ có nhóm xử lý",
"status": {
"value": 1,
"description": "Processing"
},
"documents": [
{
"id": "a0b7464a-2cb9-49cc-4763-08df4aa4c681",
"createdDate": "2026-11-25T10:32:47.3862005+07:00",
"lastModifiedDate": "2026-11-25T10:32:47.3861741+07:00",
"no": "26.GROUP.VNPT-IT2-GP1.6733",
"subject": "Document 26.GROUP.VNPT-IT2-GP1.6733",
"status": {
"value": 1,
"description": "New"
},
"contractStatus": {
"value": 0,
"description": "Undefined"
},
"description": "",
"createdByUserId": 70528,
"processRecipientCount": 4,
"waitingProcesses": [],
"processInOrder": true,
"batchImportId": 23110,
"processes": [
{
"id": "41f32442-0899-4599-fc9a-08df4aa4c6b0",
"createdDate": "2026-11-25T10:32:47.3822797+07:00",
"comId": 164,
"isOrder": true,
"orderNo": 1,
"displayType": {
"value": 2,
"description": "Text and image"
},
"accessPermission": {
"value": 2,
"description": "Sign draw"
},
"status": {
"value": 1,
"description": "Waiting"
},
"processedByUserId": 70529,
"documentId": "a0b7464a-2cb9-49cc-4763-08df4aa4c681",
"fillingItems": [],
"attachments": []
},
{
"id": "cee68327-3bca-4bdc-fc9b-08df4aa4c6b0",
"createdDate": "2026-11-25T10:32:47.3834712+07:00",
"comId": 164,
"isOrder": true,
"orderNo": 2,
"displayType": {
"value": 2,
"description": "Text and image"
},
"accessPermission": {
"value": 4,
"description": "Sign digital"
},
"status": {
"value": 1,
"description": "Waiting"
},
"processedByUserId": 70530,
"documentId": "a0b7464a-2cb9-49cc-4763-08df4aa4c681",
"fillingItems": [],
"attachments": []
},
{
"orderNo": 3,
"requireAllToComplete": true,
"signGroups": [
{
"id": "2da6a4c3-7d59-4e46-fc9c-08df4aa4c6b0",
"createdDate": "2026-11-25T10:32:47.3844248+07:00",
"comId": 164,
"isOrder": true,
"orderNo": 3,
"displayType": {
"value": 2,
"description": "Text and image"
},
"accessPermission": {
"value": 4,
"description": "Sign digital"
},
"status": {
"value": 1,
"description": "Waiting"
},
"processedByUserId": 70531,
"documentId": "a0b7464a-2cb9-49cc-4763-08df4aa4c681",
"fillingItems": [],
"attachments": [],
"groupId": "068cf5f1-27e9-4e9c-f34f-08df4aa4c6c3"
},
{
"id": "86fd944f-75ab-4ce0-fc9d-08df4aa4c6b0",
"createdDate": "2026-11-25T10:32:47.3849808+07:00",
"comId": 164,
"isOrder": true,
"orderNo": 3,
"displayType": {
"value": 2,
"description": "Text and image"
},
"accessPermission": {
"value": 4,
"description": "Sign digital"
},
"status": {
"value": 1,
"description": "Waiting"
},
"processedByUserId": 70532,
"documentId": "a0b7464a-2cb9-49cc-4763-08df4aa4c681",
"fillingItems": [],
"attachments": [],
"groupId": "068cf5f1-27e9-4e9c-f34f-08df4aa4c6c3"
}
]
}
],
"accessibleViewProcesses": [],
"histories": [],
"attachments": [],
"relatedDocuments": [],
"linkedDocuments": [],
"messages": [],
"downloadUrl": "{HOST}/Api/Download?token=...",
"downloadOriginalUrl": "{HOST}/Api/Download?token=...",
"downloadWatermarkMetadataUrl": "{HOST}/Api/Download?token=...",
"fillingItems": [
{
"key": "{{DIACHILV}}",
"value": "Tầng 10 tòa nhà VNPT, Hà Nội",
"displayName": "{{DIACHILV}}",
"positions": []
},
...
],
"sharedUsers": [],
"isMarkStar": false,
"downloadFileUrls": [],
"requiresSealSendConfirmation": false,
"fixedPosition": false,
"isLaborContractDocument": false
}
]
},
"success": true,
"code": 0,
"messages": [
"Import batch document success"
]
}

Mô tả response body​

KeyTypeMô tả
successbooleanTrạng thái yêu cầu (true: thành công, false: thất bại)
codeintMã phản hồi từ hệ thống
messagesarrayDanh sách thông báo hoặc lỗi từ hệ thống
dataobjectThông tin lô import và các chứng từ được tạo

Chi tiết data​

KeyTypeMô tả
idintID lô import
createdDatedatetimeThời điểm tạo lô
uploadedByUserIdintID người tạo lô
numberOfRecordsintSố chứng từ trong lô
namestringTên lô theo request
statusobjectTrạng thái lô, gồm value và description (ví dụ 1 — Processing)
documentsarrayDanh sách chứng từ đã tạo

Chi tiết data.documents[]​

KeyTypeMô tả
idGUIDID chứng từ do hệ thống sinh
createdDate, lastModifiedDatedatetimeThời điểm tạo và cập nhật chứng từ
nostringMã chứng từ
subjectstringTiêu đề chứng từ
customerCode, customerInformationstringMã và thông tin khách hàng
descriptionstringMô tả chứng từ
statusobjectTrạng thái chứng từ
contractStatusobjectTrạng thái hiệu lực hợp đồng
createdByUserIdintID người tạo chứng từ
batchImportIdintID lô import chứa chứng từ
processInOrderbooleanThứ tự xử lý tuần tự (true) hay song song (false), lấy từ workflow.processInOrder
processRecipientCountintTổng số người tham gia xử lý
processesarrayDanh sách bước xử lý được tạo theo workflow.recipients
fillingItemsarrayDữ liệu cần điền vào mẫu; mỗi phần tử gồm key, value, displayName, positions
historiesarrayLịch sử thao tác trên chứng từ
downloadUrl, downloadOriginalUrl, downloadWatermarkMetadataUrlstringCác đường dẫn tải chứng từ
downloadFileUrlsarrayDanh sách file thành phần

Chi tiết data.documents[].processes[]​

Các bước xử lý thông thường trả về id, createdDate, comId, isOrder, orderNo, displayType, accessPermission, status, processedByUserId, documentId, fillingItems và attachments.

Với bước nhóm, response trả về thêm requireAllToComplete và signGroups. Mỗi phần tử trong signGroups có cấu trúc như một bước xử lý thông thường, cùng orderNo với bước nhóm và có thêm groupId. Các thành viên trong cùng nhóm có chung groupId.