/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`.