Can this API both generate and read QR codes?
Yes. POST /generate encodes text into a PNG or SVG QR image, and POST /decode reads QR content back out of a base64 image, including its location geometry and scan diagnostics.
Generate PNG or SVG QR codes from any text with custom size, colors, and error correction, then decode QR content back out of images. Compute-only, no upstream calls.
This calls the live QR Code API. Type any payload, tune the size, colors, and error correction, and render a real QR code you can scan.
Run the request to render your QR code here.
Why QR Code API
PNG and SVG output
Generate raster PNG for sharing or crisp vector SVG for print and scaling, from the same generate endpoint.
Custom colors and sizing
Set dark and light hex colors, pixel width from 64 to 2048, and a quiet-zone margin of 0 to 16 modules.
Error correction levels
Pick L, M, Q, or H so codes stay scannable with logos, damage, or low-contrast printing.
Decode from images
POST a base64 image to read QR content back out, with location geometry and scan diagnostics.
Multi-code scanning
Set all=true with maxCodes to detect and return several QR codes from a single image in one call.
Compute-only, fast
No upstream dependencies means low latency and a generous 200 requests per 15-minute limit.
/api/v1/qr-code
Generate QR code
Encode text into a PNG or SVG QR image, returned as JSON, base64, or raw binary.
Decode QR code
Read QR content from a base64 image, with optional multi-code scanning.
Service health
Status, service name, version, timestamp, and correlationId.
Prometheus metrics
Request counts and latency histograms in Prometheus exposition format.
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | generate | Text payload to encode, 1 to 4296 characters. |
| format | string | no | Output format: png (default) or svg. |
| size | integer | no | Generated width in pixels, 64 to 2048. Default 256. |
| margin | integer | no | Quiet-zone margin in modules, 0 to 16. Default 2. |
| errorCorrectionLevel | string | no | L, M (default), Q, or H. Higher levels tolerate more damage. |
| darkColor / lightColor | string | no | Foreground and background hex colors (#RRGGBB). Default black on white. |
| responseType | string | no | generate output mode: json (default), base64, or binary. |
| imageBase64 | string | decode | Base64 image (optional data: prefix), minimum 16 characters, up to 5 MB. |
| all / maxCodes | boolean / integer | no | Multi-code decode toggle and cap (1 to 10) when all=true. Default false, 5. |
Error reference
Validation and service failures return success: false with an error, an optional reason, and a correlationId.
Invalid generate or decode body: empty or oversized text, bad hex color, or out-of-range size. The details array lists each issue.
Known generation or decode failure, such as an invalid image. The reason field is machine-readable, e.g. invalid-image.
Missing or invalid gateway API key. Send x-api-key or api_key with every request.
Unknown endpoint. Valid paths are /generate and /decode under /api/v1/qr-code.
More than 200 requests in 15 minutes. The response includes retryAfter seconds.
Unexpected failure outside known QR service errors. Include the correlationId when reporting.
Example error response
{
"success": false,
"error": "Invalid input parameters",
"details": [
"\"text\" is required"
],
"correlationId": "req_error123"
}FAQ
Yes. POST /generate encodes text into a PNG or SVG QR image, and POST /decode reads QR content back out of a base64 image, including its location geometry and scan diagnostics.
Set the output format (png or svg), pixel size from 64 to 2048, quiet-zone margin from 0 to 16, error correction level (L, M, Q, H), and both the dark and light hex colors.
responseType controls the shape: json (default) returns base64 data plus byteLength, base64 returns the encoded string, and binary streams raw image bytes as image/png or image/svg+xml.
Yes. Send all=true on /decode to attempt multi-code detection, and cap the results with maxCodes (1 to 10). The response reports codeCount and a codes array.
Send your Datpaq API key as an x-api-key header or an api_key query parameter. Keys are created in the Datpaq dashboard and a free tier is included.
Generate branded PNG or SVG codes and decode them back, from one compute-only API. No image libraries to install, no upstream services.