Skip to main content
POST
QR Code Scan decodes an uploaded image and checks the extracted content for suspicious links and other threats. It reads QR, Data Matrix, and Aztec codes.

Authentication

Send your API key as Authorization: Bearer enc_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.

Request

string
required
Set this value to qr.
file
The QR code image to scan, uploaded as multipart/form-data. Send this field or content_base64. When you omit filename, the uploaded file’s name is used.
string
For a JSON body, send this field or file. The base64-encoded QR code image. Send raw base64 only. A data URL prefix such as data:image/png;base64, returns 400 with “content_base64 is not valid base64.”
string
The original image file name. Encrata checks it against the real file type: a PNG named invoice.pdf, or a name that hides an executable behind an image extension (scan.png.exe), raises a signal.
boolean
Set to true to include STIX 2.1 output when available. Defaults to false.
The image can be PNG, JPEG, GIF, WebP, BMP, or TIFF, up to 10 MB and 50 megapixels. Micro QR codes aren’t supported.

Example request

Upload the QR code image from disk as multipart/form-data. Replace payment-qr.png with the path to your QR code image.
To send JSON instead, base64-encode the QR code image into content_base64:

Example response

A scan of a shop’s UPI payment code:
A payment code with no warning signs is clean. message names the payee so the user can check it before paying.

How the verdict is decided

Each code gets its own verdict from what it contains. The scan’s verdict is the worst of its codes and the image’s own signals, such as a misleading file name. An image with more than one code adds a note that a malicious code can be pasted over a real one.

QR code result fields

A qr result has the common fields plus sha256, image, and codes.
integer
Credits this scan charged: 1 per code found, or 0 when you scanned the same image before.
object
The uploaded image.
object[]
Every code decoded from the image. A successful QR scan always has at least one.
object[]
code_decode (reading the image) and link_scans (scanning the codes’ links, not_applicable when there are none). See Checks and coverage.
object[]
Signals about the image itself. Each item contains source, malicious, detail, and optional severity. source is file for the file name (a mismatched extension is low, an executable behind an image extension is medium, a hidden text-direction character is high), qr for several codes in one image (medium when they pay different payees), or image_quality for a note about blur or contrast.
See Malware Scan for the shared fields: assessment, recommended_action, confidence_reason, coverage, data_flow, duration_ms, and iocs.

When no code is found

If the image has no readable code, the scan returns 422 with result.code set to validation_failed, and no scan result. The code may be blurred, cropped, partly covered, or too small, so ask for a clearer photo. A Micro QR code also returns 422.

Errors

Errors use the same envelope as successful responses, with success set to false. Branch on result.code. message is a sentence you can show to users. The response panel shows an example of each status. Errors aren’t charged.

Credits

A scan costs 1 credit for each code it decodes: an image with two codes costs 2 credits. Scanning the same image again is free and returns credits: 0.