UtilitiesPopular

QR Code Generator API

Generate QR codes in SVG, PNG, or Base64 data URL format. Customize size, colors, margin, and error correction level. Supports encoding up to 4000 characters of text, URLs, or structured data.

Endpoint:/v1/qr/generate
Method:GET
Latency:~10ms

Try it out

GET/v1/qr/generate

Parameters

Code

curl
curl -X GET "https://khaleejiapi.dev/api/v1/qr/generate?data=https%3A%2F%2Fkhaleejiapi.dev&format=svg&size=256&margin=4&dark=%23000000&light=%23ffffff&ecLevel=M" \
-H "X-API-Key: your_api_key"

Parameters

ParameterTypeRequiredDescription
datastringRequiredContent to encode in the QR code (max 4000 characters)
formatstringOptionalOutput format: svg, png, or dataurl
sizenumberOptionalImage size in pixels (64–2048)
marginnumberOptionalQuiet zone margin
darkstringOptionalDark module color (hex)
lightstringOptionalLight module color (hex)
ecLevelstringOptionalError correction level: L, M, Q, H

Output Formats

svg (default)

Returns SVG XML with Content-Type: image/svg+xml. Scalable, perfect for web. 24-hour cache.

png

Returns PNG binary with Content-Type: image/png. Fixed resolution based on size parameter. 24-hour cache.

dataurl

Returns JSON with Base64-encoded PNG data URL. Ideal for embedding in HTML or apps without additional requests.

Error Correction Levels

LevelRecoveryUse Case
L~7%Smallest QR code, clean environments
M~15%Default, good balance
Q~25%Higher durability
H~30%Maximum recovery, logo overlay

Rate Limits

PlanRequests/MonthRate Limit
Free1,00010 req/min
Starter10,00060 req/min
Professional100,000300 req/min
Business500,0001,000 req/min