QR Generator API Documentation

Introduction

QR Generator provides a simple API to convert any data — text, links, or a real UPI ID — into a scannable QR code. This documentation covers the Generate QR API.

Base URL

All API endpoints start with: https://qr-generator.vlemart.store/api/

Authentication

All requests require your user_token for authentication. This token is provided when you register as a developer/merchant.

Generate QR API

Convert any data into a real, scannable QR code and get it back as a JSON response (base64 image) or as a direct image.

POST / GET /generate-qr

Request Parameters

Parameter Type Required Description
user_token String Yes Your authentication token
text String Yes Content to encode — any text, URL, or a UPI deep link (e.g. upi://pay?pa=id@bank&pn=Name&am=100)
format String No Output format: png (default), svg, or base64
size Numeric No Width/height of the QR image in pixels (default 300)
margin Numeric No Whitespace around the QR image (default 4)
dark Hex color No Color of the QR grid cells (default 000000)
light Hex color No Background color (default ffffff)
ecLevel String No Error correction level: L, M, Q, or H (default M)
dotStyle String No Shape of data modules: square, dot, rounded
finderStyle String No Shape of corner finder patterns: square, rounded, circle
finderColor Hex color No Color of the corner finder patterns
caption String No Text displayed below the QR code
centerImageUrl URL No URL-encoded image to display in the center of the QR (logo, etc.)
view Boolean No Set to 1 to get the raw QR image back directly instead of JSON (useful for <img src>)

Important Notes

  • Content-Type: application/x-www-form-urlencoded (POST) or query string (GET)
  • Encoding: Always URL-encode the text parameter, especially for UPI links containing @, &, and spaces
  • UPI QR: use a properly formed upi://pay?pa=...&pn=...&am=...&cu=INR string as text for a real, scannable payment QR

Request Example (JSON response)

POST /api/generate-qr
Content-Type: application/x-www-form-urlencoded

user_token=YOUR_TOKEN&text=upi%3A%2F%2Fpay%3Fpa%3Dexample%40bank%26pn%3DAMAN%26am%3D100%26cu%3DINR&size=300&ecLevel=Q

Success Response (200 OK)

{
    "status": true,
    "message": "QR Code Generated Successfully",
    "result": {
        "text": "upi://pay?pa=example@bank&pn=AMAN&am=100&cu=INR",
        "format": "png",
        "size": 300,
        "qr_image": "data:image/png;base64,iVBORw0KGgoAAAANS...",
        "view_url": "https://qr-generator.vlemart.store/api/generate-qr?view=1&user_token=YOUR_TOKEN&text=...&format=png"
    }
}

Direct Image Request (no JSON)

Add view=1 to get the raw image back directly — drop it straight into an <img> tag:

GET /api/generate-qr?view=1&user_token=YOUR_TOKEN&text=Hello+World&size=300

Error Responses

{
    "status": false,
    "message": "Invalid user_token"
}

{
    "status": false,
    "message": "text is required"
}

{
    "status": false,
    "message": "Failed to generate QR code: upstream error"
}

Best Practices

URL Encoding

Always URL-encode the text parameter — this matters most for UPI links and any data containing @, &, =, or spaces.

Error Correction

Use a higher ecLevel (Q or H) if you plan to add a centerImageUrl logo, so the QR still scans reliably.

Scan Testing

Always scan-test your final QR — especially styled codes (dotStyle, finderStyle) — before using them live.

Testing

Use small test amounts (₹1–₹10) when generating UPI QR codes during integration testing.

Support

For technical support or questions about API integration: