A lightweight REST API for generating and decoding QR codes.
Built with Spring Boot and exposed via Swagger UI for easy exploration.
- Generate QR codes in PNG, JPEG, or Base64 format
- Customize size, foreground color, and background color
- Decode QR codes from uploaded image files or Base64 strings
- Explore endpoints via integrated Swagger UI
Swagger UI is available at:
http://localhost:8080/swagger-ui/index.html
GET /api/qr/generate
Parameters (query):
data(required) → Text or URL to encodesize(optional, default=200) → Image size in pixelsfgColor(optional, default=#000000) → Foreground color (hex)bgColor(optional, default=#FFFFFF) → Background color (hex)format(optional, default=PNG) → Output format:PNG,JPEG, orBASE64
Responses:
image/pngorimage/jpeg→ QR code imageapplication/json→ Base64-encoded string (ifformat=BASE64)
Example Request (Base64 output):
curl -X POST "http://localhost:8080/api/qr/generate?data=HelloWorld&size=300&format=BASE64"POST /api/qr/decode
Consumes: multipart/form-data
Form Data:
file(required) → QR code image file (.pngor.jpg)
Response:
{
"type": "string",
"data": "string"
}Example Request (Base64 output):
curl -X POST "http://localhost:8080/api/qr/decode" \
-F "file=@qrcode.png"POST /api/qr/decode
Consumes: application/json
Request Body:
{
"image": "BASE64_ENCODED_IMAGE"
}Example Request (Base64 output):
curl -X POST "http://localhost:8080/api/qr/decode" \
-H "Content-Type: application/json" \
-d '{"image": "BASE64_ENCODED_IMAGE"}'
- Java 17+
- Spring Boot
- Swagger UI for API documentation
The API will be available at: 👉 http://localhost:8080
Swagger UI: 👉 http://localhost:8080/swagger-ui/index.html