Create Document (Upload)
Uploads a document and attaches it to a specific banking entity.
Command Name
CreateDocumentCommand
Endpoint
POST /api/core/cmd
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
entityType | string | Yes | Entity type: "Client", "Loan", "Deposit", or "Policy" |
entityId | long | Yes | ID of the entity (clientId, loanId, depositId, or policyId) |
fileName | string | Yes | Original file name with extension |
fileContentBase64 | string | Yes | Base64-encoded file content |
title | string | No | Document title |
description | string | No | Document description |
documentNumber | string | No | Document number (e.g., ID card number) |
documentType | integer | No | Document type enum value |
documentTypeDescription | string | No | Document type description |
issueDate | string | No | Document issue date (YYYY-MM-DD) |
expiryDate | string | No | Document expiry date (YYYY-MM-DD) |
Request Example
{
"Cmd": "CreateDocumentCommand",
"Data": {
"entityType": "Client",
"clientId": 12345,
"fileName": "passport.pdf",
"fileContentBase64": "JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9UeXBlIC9QYWdlCi9QYX...",
"title": "International Passport",
"description": "Valid passport for KYC verification",
"documentNumber": "A12345678",
"documentType": 2,
"documentTypeDescription": "Passport",
"issueDate": "2020-01-15",
"expiryDate": "2030-01-14"
}
}
Response Structure
{
"IsSuccessful": true,
"StatusCode": "00",
"Message": "Document uploaded successfully.",
"Data": {
"Identifier": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"FilePath": "documents/clients/12345/passport_3fa85f64.pdf",
"FileExtension": ".pdf",
"OriginalFileName": "passport.pdf",
"UploadedAt": "2024-01-20T14:30:00",
"UploadedBy": "admin@banklingo.com",
"StorageProvider": "MinIO"
}
}
Validation Rules
- Entity Must Exist: The specified entity ID must exist in the system
- Valid Base64: File content must be valid base64-encoded string
- File Size: Maximum file size limits apply (configured in system settings)
- Supported Formats: PDF, PNG, JPG, JPEG, DOC, DOCX, XLS, XLSX typically supported
- Unique Document Number: Optional but should be unique if provided
Error Responses
{
"IsSuccessful": false,
"StatusCode": "01",
"Message": "Invalid client ID.",
"Data": null
}
Use Case Example
Upload KYC documents during client onboarding:
{
"Cmd": "CreateDocumentCommand",
"Data": {
"entityType": "Client",
"clientId": 12345,
"fileName": "national_id.pdf",
"fileContentBase64": "...",
"documentType": 1,
"documentTypeDescription": "National ID",
"documentNumber": "NIN-12345678",
"issueDate": "2015-06-20",
"expiryDate": "2025-06-19"
}
}