Liveness Detection
Pastikan selfie berasal dari wajah asli, bukan cetakan atau layar.
Base URL
https://use.api.co.id
Kirim foto selfie ke POST /liveness/detect sebagai multipart/form-data (field face1, optional reference_id) dengan header x-api-co-id. Response berisi transaction_id, result (liveness terdeteksi atau tidak), score, dan message provider.
Field request
| Field | Wajib | Aturan |
|---|---|---|
face1 | ya | Foto selfie JPG/JPEG/PNG, maks 2 MB |
reference_id | tidak | Referensi customer, maks 64 karakter |
transaction_id tidak perlu dikirim. API.CO.ID membuatnya otomatis, meneruskannya ke provider sebagai trId, lalu mengembalikannya di response.
curl -X POST "https://use.api.co.id/liveness/detect" \
-H "x-api-co-id: YOUR_API_KEY" \
-F "face1=@/absolute/path/to/selfie.jpg" \
-F "reference_id=customer-reference-001"
Panduan gambar
- Gunakan foto wajah manusia yang jelas.
- Hindari gambar backlight atau terlalu gelap.
- Gunakan format JPG, JPEG, atau PNG.
- Pastikan ukuran file maksimal 2 MB.
- Hindari gambar yang berisi banyak wajah.
Hasil
Liveness terdeteksi:
{
"is_success": true,
"message": "Success",
"data": {
"transaction_id": "LIVE20260815093000A1B2C3",
"result": true,
"score": "100.0000",
"message": "Liveness detection successfully"
}
}
Liveness tidak terdeteksi:
{
"is_success": true,
"message": "Success",
"data": {
"transaction_id": "LIVE20260815093000D4E5F6",
"result": false,
"score": "0.0000",
"message": "Liveness detection successfully"
}
}
result: false tetap return HTTP 200 karena provider berhasil memproses request, hanya liveness tidak terdeteksi. Ini hasil bisnis yang valid.
Akses & billing
API.CO.ID memeriksa akses dengan urutan:
- API key valid.
- Saldo/subscription cukup untuk
liveness-detection. - eKYC customer sudah approved.
- Request diteruskan ke provider.
- Points dipotong jika provider memproses request.
Jika request ditolak sebelum sampai ke provider (API key salah, saldo kurang, KYC belum approved, file hilang, file terlalu besar, atau tipe file tidak didukung), points tidak dipotong.
Error umum
| HTTP | Kondisi |
|---|---|
| 400Bad Request | File face1 hilang, kosong, tipe file tidak didukung, atau image tidak valid |
| 401Unauthorized | API key hilang atau salah |
| 402Payment Required | Saldo/subscription belum cukup |
| 403Forbidden | eKYC belum approved, pending, rejected, atau expired |
| 413Payload Too Large | File face1 lebih dari 2 MB |
| 422Unprocessable | Request ditolak validasi provider |
| 429Too Many Requests | Quota produk habis jika subscription quota aktif |
| 502Bad Gateway | Provider auth/server/response error |
| 503Unavailable | Quota provider tidak tersedia |
| 504Gateway Timeout | Provider timeout |
Detect face liveness
Upload one selfie image to detect whether liveness is present. The image must be JPG, JPEG, or PNG and no larger than 2 MB. result: false means the provider processed the request but liveness was not detected.
| Nama | Tipe | Keterangan |
|---|---|---|
face1Wajib | file | Selfie image in JPG, JPEG, or PNG format; maximum 2 MB |
reference_idOpsional | string | Optional customer reference for correlation Contoh: customer-reference-001 |
| Nama | Tipe | Keterangan |
|---|---|---|
is_successWajib | boolean | Contoh: true |
messageWajib | string | Contoh: Success |
dataWajib | object | |
data.transaction_idWajib | string | Contoh: LIVE20260815093000A1B2C3 |
data.resultWajib | boolean | true if liveness is detected, false if not detected |
data.scoreOpsional | string | Contoh: 100.0000 |
data.messageWajib | string | Contoh: Liveness detection successfully |
curl -X POST "https://use.api.co.id/liveness/detect" \ -H "x-api-co-id: $API_CO_ID_KEY" \ -F "[email protected]" \ -F "reference_id=customer-reference-001"{ "is_success": true, "message": "Success", "data": { "transaction_id": "LIVE20260815093000A1B2C3", "result": true, "score": "100.0000", "message": "Liveness detection successfully" }}