/api/web/kycServiceKYC Service REST API Documentation
Compiled from the actual REST controllers inside `workspace/service/service/kycService`, covering user onboarding, liveness, and back-office review endpoints.
ApiResponse { code, message, data }multipart/form-data/admin/kycIntegration overview derived from real controllers
This page is generated from the real routes in `ApiKycController`, `ApiKycLivenessController`, and `AdminKycController` instead of a generic marketing outline.
Create the profile
Call `/submit` first to obtain the `profileId` used by document upload, liveness, and status queries.
Send document data
If you already host the files, use `/document`; the recommended path is `/document/upload` for image upload, OCR, and quality checks.
Confirm and submit
Use `/document/confirm` so the user can verify extracted fields, then `/document/submit` to route the record to auto-approval or manual review.
Run liveness and poll status
The liveness flow uses `/liveness/start` and `/liveness/verify`, while `/status/` returns the overall KYC result.
Scanned source: /workspace/service/service/kycService/src/main/java/com/sargia/finger/kycService/rest
The service also contains mirrored admin-style endpoints at `/api/web/kycService/list`, `/detail/`, and `/status/update`, while the dedicated back-office namespace remains `/admin/kyc`.
Shared response structure
Every scanned controller returns `ApiResponse`, with business payloads nested inside `data`.
| Field | Type | Example |
|---|---|---|
code | number | 0 for success, non-zero for failures or business exceptions |
message | string | success, query success, Document uploaded successfully, and similar messages |
data | object | Business payload such as profileId, status, detail, or list |
User-facing endpoints
Mapped from `ApiKycController`, covering profile creation, document upload, field confirmation, submission, and status queries.
Create profile
/api/web/kycService/submitCreate a KYC profile and return the profileId used by all downstream calls. 建立 KYC 档案并返回后续接口共用的 profileId。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
userId | string | Yes | body | user_10001 |
country | string | Yes | body | SG |
Response highlights
Notes
- Returns `ApiResponse.ok().data("profileId", profileId)` on success.
Upload document metadata
/api/web/kycService/documentSubmit document metadata with image URLs or base64 references. 提交证件元数据,适合已有文件托管链路的接入方。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileId | string | Yes | body | profile_123456 |
docType | string | Yes | body | PASSPORT |
docNumber | string | No | body | E12345678 |
frontImageUrl | string | Yes | body | https://cdn.example/front.jpg |
backImageUrl | string | No | body | https://cdn.example/back.jpg |
expiryDate | date | No | body | 2030-12-31 |
issueCountry | string | No | body | SG |
Response highlights
Notes
- The controller stores document metadata through `kycService.uploadDocument(...)`.
Upload and verify document
/api/web/kycService/document/uploadUpload front/back images, run OCR and quality checks, and return extracted identity fields. 上传证件图片并同步返回 OCR 与质量校验结果。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileId | string | Yes | multipart | profile_123456 |
docType | string | Yes | multipart | ID_CARD |
country | string | Yes | multipart | SG |
frontImage | file | Yes | multipart | id-front.jpg |
backImage | file | No | multipart | id-back.jpg |
Response highlights
Notes
- When OCR succeeds, the response includes extracted identity fields for user confirmation.
- When verification fails, the controller returns `errorCode`, quality scores, and `errors`.
Confirm extracted fields
/api/web/kycService/document/confirmLet the user confirm or edit OCR results before the final review step. 用户确认或修正 OCR 字段,必要时触发人工审核。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
documentId | number | Yes | query | 123456789 |
name | string | No | body | Alex Tan |
idNumber | string | No | body | S1234567A |
birthDate | date | No | body | 1990-01-01 |
expiryDate | date | No | body | 2030-12-31 |
issuer | string | No | body | ICA Singapore |
nationality | string | No | body | SGP |
userModified | boolean | No | body | true |
Response highlights
Notes
- If `userModified` is true, the service message indicates the record will enter manual review.
Submit document for review
/api/web/kycService/document/submitFinalize the document step after user confirmation. 完成用户确认后,正式提交证件审核并返回最终状态。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
documentId | number | Yes | query | 123456789 |
Response highlights
Notes
- The controller maps status 1/2/3 to auto-approved, manual review, and user-modified review.
Get verification status
/api/web/kycService/status/{profileId}Fetch the current KYC status, liveness result, and face-match information by profileId. 查询整个 KYC 档案的当前状态。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileId | string | Yes | path | profile_123456 |
Response highlights
Notes
- Returns `data.status` as a `KycStatusDto` object rather than a flat primitive field.
Liveness callback
/api/web/kycService/callback/livenessServer-to-server callback used to persist liveness results. 这是服务侧回调入口,不是前端页面直接调用的接口。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileId | string | Yes | body | profile_123456 |
sessionId | string | No | body | 550e8400-e29b-41d4-a716-446655440000 |
confidence | number | No | body | 96.2 |
result | string | No | body | success |
errorMessage | string | No | body | timeout |
Response highlights
Notes
- `LivenessCallback.toEntity()` is currently a placeholder conversion in the scanned service code.
Liveness verification endpoints
Mapped from `ApiKycLivenessController`, including session creation, video verification, and session lookup.
Start liveness session
/api/web/kycService/liveness/startCreate a five-minute session and return three randomized challenge actions. 创建 5 分钟有效的活体动作会话。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileId | string | Yes | query | profile_123456 |
Response highlights
Notes
- The controller shuffles `LivenessActionEnum` values and returns exactly three actions.
Verify liveness videos
/api/web/kycService/liveness/verifyUpload three challenge videos and return the aggregated liveness result. 上传三个动作视频并返回活体验证结果。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
sessionId | string | Yes | multipart | 550e8400-e29b-41d4-a716-446655440000 |
profileId | string | Yes | multipart | profile_123456 |
video1 | file | Yes | multipart | blink.mp4 |
video2 | file | Yes | multipart | smile.mp4 |
video3 | file | Yes | multipart | turn-left.mp4 |
Response highlights
Notes
- Failure uses `ApiResponse.error().code(20001)` with the liveness result still returned in `data.list`.
Get liveness session
/api/web/kycService/liveness/session/{sessionId}Read the current liveness session from cache and inspect its status. 查询缓存中的活体会话状态。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
sessionId | string | Yes | path | 550e8400-e29b-41d4-a716-446655440000 |
Response highlights
Notes
- If the session is missing or expired, the controller returns an error message instead of null data.
Back-office review endpoints
Mapped from `AdminKycController`, including list, detail, and review status updates.
List KYC records
/admin/kyc/listQuery paginated KYC records for operations teams. 后台分页查询 KYC 档案列表并支持按 profileIds 过滤。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileIds | array<string> | No | body | ["profile_123","profile_456"] |
page | number | No | body | 1 |
limit | number | No | body | 20 |
Response highlights
Notes
- The same list capability is also mirrored in `ApiKycController` at `/api/web/kycService/list`.
Get KYC detail
/admin/kyc/detail/{profileId}Fetch the full review payload for one profile, including document, liveness, and face-match data. 获取单个 KYC 档案的完整审核详情。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileId | string | Yes | path | profile_123456 |
Response highlights
Notes
- A mirrored detail endpoint also exists at `/api/web/kycService/detail/{profileId}`.
Update review status
/admin/kyc/update-statusApprove, reject, or reset the KYC review state from the admin namespace. 在后台审核链路中更新 KYC 状态。
| Field | Type | Required | Location | Example |
|---|---|---|---|---|
profileId | string | Yes | body | profile_123456 |
status | string | Yes | body | 2 |
remark | string | No | body | Manual review passed |
Response highlights
Notes
- Allowed status values in the DTO are `-1`, `0`, and `2`.
- The web-controller mirror path is `/api/web/kycService/status/update`.