Read QR Code

Decodes QR codes from uploaded images. This endpoint accepts various image formats and encoding methods, making it versatile for different use cases.

Endpoint

POST /api/qr/read.php

Parameters

image (required)

Image file containing the QR code. Can be provided in three ways:

  • Multipart form-data: Standard file upload via HTTP POST
  • Base64 encoded string: Image data encoded as base64 string
  • JSON with base64: JSON body with base64 image data (with or without data URL prefix)

Maximum file size: 5MB. Supported formats: PNG, JPG, JPEG, GIF, BMP.

Examples

File Upload (multipart/form-data):

Standard HTTP file upload:

POST /api/qr/read.php
Content-Type: multipart/form-data

image: [file upload]

Base64 JSON:

Send image as base64 encoded string in JSON:

POST /api/qr/read.php
Content-Type: application/json

{
  "image": "data:image/png;base64,iVBORw0KGgoAAAANS..."
}

Response

Success Response:

{
  "success": true,
  "data": "Decoded QR code content",
  "format": "text"
}

The data field contains the decoded content from the QR code.

Error Response:

{
  "error": "Missing image data",
  "message": "Provide image via multipart/form-data, base64 POST, or JSON."
}