Thêm mới CTS SmartCA
Ngày cập nhật: 18 tháng 08, 2026
Người cập nhật: VNPT eContract's team
Mục đích
Thêm mới CTS SmartCA cho người dùng, có thể thêm toàn bộ chứng thư số của một người dùng, hoặc thêm một chứng thư dựa vào serial cụ thể.
- Request URL:
/api/users/smart-ca/add - HTTP method:
POST - HTTP content-type:
application/json - Authorize:
Bearer token - Parameter:
| Key | Type | Description |
|---|---|---|
userId | int | [Bắt buộc] Id người dùng |
username | string | [Bắt buộc] CCCD/HC/MST của tài khoản SmartCA |
serialNumber | string | Serial chứng thư số |
Mẫu request
{
"userId": 1234,
"userName": "08009000000",
"serialNumber": "540101014e4653549c5a6fdcb9c89999"
}
Mẫu response body
{
"data": {
"id": 1234,
"createdDate": "2021-01-06T17:06:07.2893325",
"comId": 16,
"code": "USER01",
"username": "your_username",
"name": "Nguyễn Văn A",
"phone": "0919XXXXXX",
"email": "email_address",
"isValid": true,
"signConfirmationEnabled": false,
"isAccountLocked": false,
"accountId": "c59125a9-5fee-44e2-b0ff-b229634bf0b2",
"signatureText": "Ký bởi: {{SubjectDN.CN}} / {{SubjectDN.O}} / {{SubjectDN.OU}} / {{SubjectDN.UID}}\r\nChức vụ: {{SubjectDN.T}}\r\nKý ngày: {{SignTime}}",
"roles": [
{
"id": "29e1138e-833e-4b3a-897a-08da9c3dd633",
"code": "Admin",
"name": "Admin quản lý công ty",
"description": "Tài khoản admin quản lý công ty"
}
],
"signMethod": {
"value": 2,
"description": "VNPT SmartCA"
},
"status": {
"value": 1,
"description": "Enabled"
},
"receiveOtpMethod": {
"value": 1,
"description": "Email"
},
"receiveNotificationMethod": {
"value": 0,
"description": "Email"
},
"personalCertificateId": 22105,
"smartCaId": 19843,
"extraValues": [
],
"usedMemory": 0,
"defaultSmartCa": {
"id": 37666,
"name": "Nguyễn Văn A 2026",
"commonName": "Nguyễn Văn A",
"uid": "08009000000",
"validFrom": "2025-03-07T08:56:16Z",
"validTo": "2026-03-07T08:56:16Z",
"serialNumber": "540101014e4653549c5a6fdcb9c89999",
"subjectDN": "UID=CCCD:08009000000,CN=Nguyễn Văn A,L=Quận 3,ST=Hồ Chí Minh,C=VN",
"status": {
"value": 1,
"description": "Active"
},
"smartCaServiceName": "TEST_CÁ NHÂN ĐỐI TÁC",
"smartCaSignMethod": {
"value": 1,
"description": "Normal"
},
"smartCaAccountType": {
"value": 1,
"description": "Personal"
},
"smartCaUsername": "08009000000",
"isValid": true,
"provider": {
"value": 1,
"description": "VNPT SmartCA"
},
"createdDate": "2025-03-17T08:56:42.4886305+07:00",
"isBusinessSmartCaAccount": false,
"ownerId": 6,
"createdByUserId": 6
},
"userCertificates": [
{
"id": 37666,
"name": "Nguyễn Văn A 2026",
"commonName": "Nguyễn Văn A",
"uid": "08009000000",
"validFrom": "2025-03-07T08:56:16Z",
"validTo": "2026-03-07T08:56:16Z",
"serialNumber": "540101014e4653549c5a6fdcb9c89999",
"subjectDN": "UID=CCCD:08009000000,CN=Nguyễn Văn A,L=Quận 3,ST=Hồ Chí Minh,C=VN",
"status": {
"value": 1,
"description": "Active"
},
"smartCaServiceName": "TEST_CÁ NHÂN ĐỐI TÁC",
"smartCaSignMethod": {
"value": 1,
"description": "Normal"
},
"smartCaAccountType": {
"value": 1,
"description": "Personal"
},
"smartCaUsername": "08009000000",
"isValid": true,
"provider": {
"value": 1,
"description": "VNPT SmartCA"
},
"createdDate": "2025-03-17T08:56:42.4886305+07:00",
"isBusinessSmartCaAccount": false,
"ownerId": 6,
"createdByUserId": 6
}
],
"smartCaGroups": [
]
},
"success": true,
"code": 0,
"messages": [
"Add SmartCA certificate successfully"
]
}
Mô tả Response Body
| Key | Type | Description |
|---|---|---|
success | boolean | Trạng thái phản hồi của yêu cầu (true: Thành công, false: Thất bại) |
code | int | Mã phản hồi từ hệ thống |
messages | array | Danh sách thông báo trả về từ hệ thống (ví dụ: ["Add SmartCA certificate successfully"]) |
data | object | Đối tượng chứa thông tin chi tiết người dùng cùng danh sách CTS SmartCA sau khi thêm |
ghi chú
Data đã được rút gọn chỉ hiển thị một số trường quan trọng nhất. Để xem thông tin chi tiết về người dùng, vui lòng tham khảo API lấy thông tin người dùng theo ID
Chi tiết đối tượng defaultSmartCa:
| Key | Type | Description |
|---|---|---|
id | int | ID của chứng thư số SmartCA mặc định |
name | string | Tên gợi nhớ của chứng thư số |
commonName | string | Tên chủ thể chứng thư số (CN) |
uid | string | Định danh cá nhân/Số CCCD của chủ sở hữu |
validFrom | string | Thời gian bắt đầu có hiệu lực của CTS (định dạng ISO 8601/UTC) |
validTo | string | Thời gian hết hạn của CTS (định dạng ISO 8601/UTC) |
serialNumber | string | Số Serial Number duy nhất của chứng thư số |
subjectDN | string | Chuỗi thông tin Định danh Chủ thể (Subject Distinguished Name) |
status | object | Trạng thái chứng thư số: {"value": int, "description": string}1: Active (Đang hoạt động) |
smartCaServiceName | string | Tên gói dịch vụ SmartCA được áp dụng |
smartCaSignMethod | object | Phương thức ký SmartCA: {"value": int, "description": string} (Ví dụ: Normal,...) |
smartCaAccountType | object | Loại tài khoản SmartCA: {"value": int, "description": string} (Ví dụ: Personal,...) |
smartCaUsername | string | Tên tài khoản đăng nhập SmartCA (thường là số CCCD/Mã số thuế) |
isValid | boolean | Trạng thái hiệu lực hiện tại của chứng thư (true: Hợp lệ, false: Không hợp lệ/Hết hạn) |
provider | object | Nhà cung cấp dịch vụ chứng thư số: {"value": int, "description": string} (Ví dụ: VNPT SmartCA,...) |
createdDate | string | Ngày khởi tạo CTS trong hệ thống (định dạng ISO 8601) |
isBusinessSmartCaAccount | boolean | Xác định tài khoản SmartCA doanh nghiệp (true: Doanh nghiệp, false: Cá nhân) |
ownerId | int | ID của người sở hữu chứng thư |
createdByUserId | int | ID của người dùng thực hiện tạo/gán chứng thư này |