API Documentation
Create QR Code
Generates a QR code image or returns QR code data in JSON format. This endpoint supports both GET and POST requests, making it flexible for different integration scenarios.
Endpoint
GET/POST /api/qr/create.php
Parameters
data
(required)
Content to encode in the QR code. This can be any text, URL, vCard data, WiFi credentials, or other encoded information. Maximum length: 2953 characters for standard QR codes.
size
(optional)
Size in pixels. Determines the dimensions of the generated QR code image. Default: 300, Range: 50-2000 pixels. Larger sizes provide better scanning reliability but increase file size.
format
(optional)
Output format: png (default), jpg, or json. PNG supports transparency, JPG provides smaller file sizes, and JSON returns structured data.
color
(optional)
Foreground color in hex format (e.g., #000000). This is the color of the QR code modules. Default: #000000 (black). Must be in #RRGGBB format.
background
(optional)
Background color in hex format (e.g., #ffffff). Default: #ffffff (white). Must be in #RRGGBB format. For transparent backgrounds, use PNG format.
Examples
GET Request:
Simple GET request with URL parameters:
https://www.allqrgen.com/api/qr/create.php?data=Hello%20World&size=200&format=png
POST Request (JSON):
POST request with JSON body for more complex data:
POST /api/qr/create.php
Content-Type: application/json
{
"data": "Hello World",
"size": 200,
"format": "png",
"color": "#000000",
"background": "#ffffff"
}
URL Encoding Example:
For URLs, ensure proper encoding:
https://www.allqrgen.com/api/qr/create.php?data=https%3A%2F%2Fexample.com&size=300
Response
Success Response (JSON format):
{
"success": true,
"data": "Hello World",
"size": 200,
"format": "png",
"color": "#000000",
"background": "#ffffff",
"qr_code_url": "/api/qr/create.php?data=Hello%20World&size=200&format=png"
}
The qr_code_url field contains a direct link to the generated QR code image.
Error Response:
{
"error": "Missing required parameter: data",
"message": "The \"data\" parameter is required to generate a QR code."
}
All error responses include an error field with the error type and a message field with detailed information.