/api/web/kycServiceKYC Service REST API 문서
`workspace/service/service/kycService` 안의 실제 REST 컨트롤러를 기준으로 사용자 연동, 라이브니스, 백오피스 심사 API를 정리했습니다.
ApiResponse { code, message, data }multipart/form-data/admin/kyc실제 컨트롤러 기반 연동 개요
이 페이지는 `ApiKycController`, `ApiKycLivenessController`, `AdminKycController` 의 실제 라우트를 기준으로 정리한 문서입니다.
KYC 프로필 생성
먼저 `/submit` 을 호출해 `profileId` 를 발급받고, 이후 문서 업로드, 라이브니스, 상태 조회에 동일한 ID를 사용합니다.
문서 데이터 제출
파일 호스팅 체인이 있으면 `/document`, 일반 연동은 `/document/upload` 로 이미지 업로드와 OCR 검증을 함께 처리하는 구성이 권장됩니다.
확인 후 심사 제출
`/document/confirm` 으로 사용자 확인을 받고 `/document/submit` 으로 자동 승인 또는 수동 심사로 넘깁니다.
라이브니스와 최종 상태
라이브니스 플로우는 `/liveness/start` 와 `/liveness/verify` 로 구성되며, 전체 결과는 `/status/` 에서 조회합니다.
스캔 소스: /workspace/service/service/kycService/src/main/java/com/sargia/finger/kycService/rest
서비스 코드에는 `/api/web/kycService/list`, `/detail/`, `/status/update` 형태의 미러 관리 API도 존재하며, 전용 관리 네임스페이스는 `/admin/kyc` 입니다.
공통 응답 구조
스캔된 모든 컨트롤러는 `ApiResponse` 를 반환하고 실제 비즈니스 데이터는 `data` 안에 들어갑니다.
| 필드 | 타입 | 예시 |
|---|---|---|
code | number | 0은 성공, 0이 아니면 실패 또는 비즈니스 예외 |
message | string | success, query success, Document uploaded successfully 등의 메시지 |
data | object | profileId, status, detail, list 같은 실제 비즈니스 페이로드 |
사용자 연동 API
`ApiKycController` 기준으로 프로필 생성, 문서 업로드, 필드 확인, 제출, 상태 조회를 포함합니다.
Create profile
/api/web/kycService/submitCreate a KYC profile and return the profileId used by all downstream calls. 建立 KYC 档案并返回后续接口共用的 profileId。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
userId | string | 예 | body | user_10001 |
country | string | 예 | body | SG |
주요 응답
비고
- Returns `ApiResponse.ok().data("profileId", profileId)` on success.
Upload document metadata
/api/web/kycService/documentSubmit document metadata with image URLs or base64 references. 提交证件元数据,适合已有文件托管链路的接入方。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileId | string | 예 | body | profile_123456 |
docType | string | 예 | body | PASSPORT |
docNumber | string | 아니오 | body | E12345678 |
frontImageUrl | string | 예 | body | https://cdn.example/front.jpg |
backImageUrl | string | 아니오 | body | https://cdn.example/back.jpg |
expiryDate | date | 아니오 | body | 2030-12-31 |
issueCountry | string | 아니오 | body | SG |
주요 응답
비고
- 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 与质量校验结果。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileId | string | 예 | multipart | profile_123456 |
docType | string | 예 | multipart | ID_CARD |
country | string | 예 | multipart | SG |
frontImage | file | 예 | multipart | id-front.jpg |
backImage | file | 아니오 | multipart | id-back.jpg |
주요 응답
비고
- 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 字段,必要时触发人工审核。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
documentId | number | 예 | query | 123456789 |
name | string | 아니오 | body | Alex Tan |
idNumber | string | 아니오 | body | S1234567A |
birthDate | date | 아니오 | body | 1990-01-01 |
expiryDate | date | 아니오 | body | 2030-12-31 |
issuer | string | 아니오 | body | ICA Singapore |
nationality | string | 아니오 | body | SGP |
userModified | boolean | 아니오 | body | true |
주요 응답
비고
- 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. 完成用户确认后,正式提交证件审核并返回最终状态。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
documentId | number | 예 | query | 123456789 |
주요 응답
비고
- 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 档案的当前状态。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileId | string | 예 | path | profile_123456 |
주요 응답
비고
- 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. 这是服务侧回调入口,不是前端页面直接调用的接口。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileId | string | 예 | body | profile_123456 |
sessionId | string | 아니오 | body | 550e8400-e29b-41d4-a716-446655440000 |
confidence | number | 아니오 | body | 96.2 |
result | string | 아니오 | body | success |
errorMessage | string | 아니오 | body | timeout |
주요 응답
비고
- `LivenessCallback.toEntity()` is currently a placeholder conversion in the scanned service code.
라이브니스 검증 API
`ApiKycLivenessController` 기준으로 세션 생성, 영상 검증, 세션 조회를 포함합니다.
Start liveness session
/api/web/kycService/liveness/startCreate a five-minute session and return three randomized challenge actions. 创建 5 分钟有效的活体动作会话。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileId | string | 예 | query | profile_123456 |
주요 응답
비고
- 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. 上传三个动作视频并返回活体验证结果。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
sessionId | string | 예 | multipart | 550e8400-e29b-41d4-a716-446655440000 |
profileId | string | 예 | multipart | profile_123456 |
video1 | file | 예 | multipart | blink.mp4 |
video2 | file | 예 | multipart | smile.mp4 |
video3 | file | 예 | multipart | turn-left.mp4 |
주요 응답
비고
- 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. 查询缓存中的活体会话状态。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
sessionId | string | 예 | path | 550e8400-e29b-41d4-a716-446655440000 |
주요 응답
비고
- If the session is missing or expired, the controller returns an error message instead of null data.
관리 심사 API
`AdminKycController` 기준으로 목록, 상세, 심사 상태 업데이트를 제공합니다.
List KYC records
/admin/kyc/listQuery paginated KYC records for operations teams. 后台分页查询 KYC 档案列表并支持按 profileIds 过滤。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileIds | array<string> | 아니오 | body | ["profile_123","profile_456"] |
page | number | 아니오 | body | 1 |
limit | number | 아니오 | body | 20 |
주요 응답
비고
- 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 档案的完整审核详情。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileId | string | 예 | path | profile_123456 |
주요 응답
비고
- 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 状态。
| 필드 | 타입 | 필수 | 위치 | 예시 |
|---|---|---|---|---|
profileId | string | 예 | body | profile_123456 |
status | string | 예 | body | 2 |
remark | string | 아니오 | body | Manual review passed |
주요 응답
비고
- Allowed status values in the DTO are `-1`, `0`, and `2`.
- The web-controller mirror path is `/api/web/kycService/status/update`.