Skip to content

Verify KHQR Code

Check if a QR payload string is valid KHQR format.

Endpoint: POST /khqr/verify-khqr

Request

json
{ "qrData": "0002010102123051..." }

Response

json
true

or

json
false

cURL

bash
curl --location 'http://localhost:3000/khqr/verify-khqr' \
--header 'x-auth-type: api-key' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <your-api-key>' \
--data '{"qrData":"0002010102123051..."}'

When To Use

  • Pre-filter before decode.
  • Fast validation in input flows.
  • Reject obviously malformed data early.

Quick JS Helper

js
async function isKHQR(qr) {
  const r = await fetch("/khqr/verify-khqr", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "x-auth-type": "api-key",
      "x-api-key": process.env.API_KEY,
    },
    body: JSON.stringify({ qrData: qr }),
  });
  return await r.json();
}

Notes

  • Returns only boolean.
  • Still decode for details (/khqr/decode-khqr).
  • Cache common results.

Last updated: August 10, 2025