Skip to main content

Decode QR Code

Decodes a base64-encoded image of a QR code to a UTF-8 string using the ZXing library.

Request

POST /nxt?requestType=decodeQRCode&qrCodeBase64=<base64>

Parameters

NameTypeRequiredDescription
qrCodeBase64stringYesBase64-encoded image of a QR code. Must be less than 200,000 bytes.

Response

{
"qrCodeData": "Hello World"
}

Response Fields

FieldTypeDescription
qrCodeDatastringDecoded UTF-8 string from the QR code. Empty string if QR code not found in image.

Error Responses

ConditionResponse
Error reading base64 byte streamError response from JSONData.putException()
Invalid base64 imageError response from JSONData.putException()

Notes

  • This endpoint does not require the blockchain to be running (requireBlockchain = false).
  • Not chain-specific.
  • Does not require admin password authentication (requirePassword = false).
  • Uses ZXing library with BarcodeFormat.QR_CODE and UTF-8 character set.
  • The output can be input to the Encode QR Code endpoint to recover the original data.

Source: DecodeQRCode.java.

Example

curl -X POST "http://localhost:22024/nxt" \
-d "requestType=decodeQRCode" \
-d "qrCodeBase64=/9j/4AAQSkZJRgABAQAAAQABAAA..."