Skip to content

Detect ID Card Tampering ​

Inspects an ID card image for signs of forgery, alteration or replay — a swapped portrait, altered fonts, a card photographed off a screen, or information that contradicts itself across OCR, MRZ and QR.

Endpoint ​

http
POST /v1/detect_id_card_tampering_sync
Content-Type: application/json
json
{
  "card_type": "vn.national_id",
  "image": {
    "id": "2dc863d6-1f68-4c82-8380-dd34e4ed7da0",
    "base64": "",
    "label": "id_card.vn.national_id.front",
    "metadata": "{}"
  }
}

Parameters:

ParamTypeRequiredDefaultDescription
card_typestringYes—The card type. See Usage Recommendations.
imageImageDataYes—Image of the identity card's front side or back side.

ImageData ​

ParamTypeRequiredDefaultDescription
idstringNo—ID of the image returned by Upload Image.
base64stringNo—Base64-encoded text of the image data.
labelstringNo—Label of the image, as described in Usage Recommendations.
metadatastring_jsonNo—Key/value JSON string. Example: {"id":"<ID>","type":1}

Sample Request ​

bash
curl --location '<BASE_URL>/v1/detect_id_card_tampering_sync' \
  --header 'Authorization: ATV <ACCESS_ID>:<SIGNATURE>' \
  --header 'X-TV-Timestamp: <TIMESTAMP>' \
  --header 'Content-Type: application/json' \
  --data '{
    "card_type": "vn.national_id",
    "image": {
      "id": "e94288e6-7ab5-4aeb-9608-8382f4ceb92f",
      "base64": "",
      "label": "id_card.vn.national_id.back",
      "metadata": "{}"
    }
  }'

Response ​

json
{
  "data": {
    "status": "success",
    "card_tampering": {
      "score": 1,
      "verdict": "alert",
      "details": [
        {
          "verdict": "photo_tampered",
          "score": 0.9394838,
          "info": "photo tampering detected"
        }
      ]
    },
    "image_id": "2dc863d6-1f68-4c82-8380-dd34e4ed7da0",
    "image2_id": "",
    "request_id": "d24883b6-f9ad-4d8b-a0fa-e8c6c81df87e"
  },
  "errors": []
}
FieldTypeDescription
data.statusstringsuccess or failure.
data.card_tampering.verdictstringOverall verdict — good when no tampering was found, otherwise alert.
data.card_tampering.scorefloatConfidence in the overall verdict, range 0–1.
data.card_tampering.detailsTamperingDetail[]Each specific tampering signal that fired.
data.image_idstringID of the analysed image.
data.image2_idstringID of the second image, empty when only one was supplied.
data.request_idstringRequest ID; quote it to CAKE Support when checking logs.

TamperingDetail ​

FieldTypeDescription
verdictstringThe specific tampering signal, e.g. photo_tampered, non_liveness, qr_info_not_match. See Verdict Definitions.
scorefloatConfidence in this signal, range 0–1.
infostringHuman-readable explanation of the signal.

WARNING

A good verdict is evidence, not a guarantee. Tampering detection is probabilistic — combine it with ID sanity, face matching and your own rule set before approving an onboarding, and log the full details array for audit.

Errors ​

CodeMessage
2001010Access ID not found.
401100You are not authorized to perform the action.
4001000Input parameter violates a constraint.
4001001The X-TV-Timestamp header is expired, need a newer one.
5001000Some unexpected error occurs while processing the request.
CodeDescription
access_denied_exceptionYou are not authorized to perform the action.
invalid_parameter_exceptionInput parameter violates a constraint.
request_time_too_skewedThe X-TV-Timestamp header is expired, need a newer one.
image_not_found_exceptionThe image ID is not found in DB.
rate_limit_exceptionThe number of requests exceeded your throughput limit.
internal_server_errorSome unexpected error occurs while processing the request.

Next Steps ​

Developers