Skip to content

Usage Recommendations ​

Conventions that apply to every FaceAuthen endpoint: how to make requests reconcilable with CAKE, and the fixed vocabularies for image labels and card types that the APIs validate against.

API Reconciliation ​

To make reconciliation between your system and the CAKE service straightforward, send an X-Request-Id header on every call.

WhatDescription
X-Request-IdA client-generated request identifier. You generate and manage its value; CAKE stores what it received so both sides can be compared and mismatches surfaced.

Use a random, non-repeating UUID for every request (shown as <RANDOM_UUID> in the samples). Don't put a user ID or any other personal data in it — the value is stored and logged on both sides. Keep your own mapping from the UUID to the user if you reconcile per user.

Use Uploaded Image IDs ​

Upload each image once via Upload Image and pass the returned image_id to every other API, rather than re-sending base64 bytes on each call. This keeps requests small, avoids duplicate storage, and lets CAKE correlate all checks performed on the same image.

Image Labels ​

The label field MUST be one of the following values.

LabelDescription
portraitThe portrait (selfie) photo
portrait_nfcThe portrait photo read from the NFC chip
qr_codeThe QR code image
id_card.vn.national_id.frontThe front side of a Vietnam card (CMND old/new, CCCD, Passport)
id_card.vn.national_id.backThe back side of a Vietnam card (CMND old/new, CCCD, Passport)
doc.vn.business_licenseThe business licence image

Card Types ​

The card_type field MUST be one of the following values.

Card typeDescription
vn.cccd_newCăn cước công dân
vn.cc_newCăn cước
vn.otherDoes not match any defined type

INFO

Sample requests throughout these docs use card_type: "vn.national_id". Confirm the exact set of card types enabled for your tenant with CAKE Support before going live.

Image Metadata ​

Several endpoints accept a metadata field on an image. It is a JSON string holding a flat key/value dictionary, where keys are strings and values are string, int, float or bool.

json
"{\"id\":\"<ID>\",\"type\":1}"

For a QR code image, metadata can carry the raw decoded string:

json
"{\"raw\":\"<decoded QR content>\"}"

Where a request accepts an image object, supply either id or base64:

  • If you pass base64, also pass label and metadata, and omit id.
  • If you pass id (returned by Upload Image), omit base64, label and metadata.

Next Steps ​

Developers