Barcode & QR API
REST API · OpenAPI 3.0 compatible. Parameters and response status codes are documented per endpoint.
Ready for Integration
This API is ready to use with popular automation platforms:
Send email to Contact Us
Create QR code images from text (e.g. event tickets, check-in codes, links).
Endpoint: POST /api/generate-qrcode · GET with query params (text, size, format, margin, ecl) also supported.
Parameters (request body)
| Name | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Content to encode. Max 2048 characters. |
| size | integer | No | Width/height in pixels (default 256). 64–1024. |
| format | string | No | png (default) or svg. |
| margin | integer | No | Quiet zone (default 2). 0–10. |
| ecl | string | No | Error correction: L, M, Q, H (default M). |
| returnUrl | boolean | No | If true, response is JSON with temporary image URL (valid 5 min) instead of binary. Requires server config. |
Request body
Content-Type: application/json
{
"text": "TICKET-123",
"size": 256,
"format": "png",
"margin": 2,
"ecl": "M",
"returnUrl": false
}Responses
| Code | Description |
|---|---|
| 200 | Success: binary image, or JSON url, expiresAt, expiresInSeconds when returnUrl: true. |
| 400 | Bad Request: missing/empty text or text > 2048 chars. |
| 503 | Service Unavailable: returnUrl: true but server not configured. |
GET /api/generate-qrcode?text=...&size=...&format=... or /api/generate-qrcode/temp/{token} (valid 5 min).
Example
const res = await $fetch('/api/generate-qrcode', {
method: 'POST',
body: {
text: 'TICKET-123',
size: 256,
format: 'png',
margin: 2,
ecl: 'M'
},
responseType: 'blob'
})
// res is the image blob (PNG or SVG). Use GET with ?text=...&size=... for image URL.Preview QR for:
Use for event tickets, badges, or dynamic links. See Event ticketing & scanning and Docs for guides.
Send an image (base64 or image URL) and receive the extracted data. Supports JPEG, PNG, WebP, GIF.
Endpoint: POST /api/parse-code
Parameters (request body)
| Name | Type | Required | Description |
|---|---|---|---|
| image | string | No* | Base64 image (with or without data URI). Max 10MB. |
| imageUrl | string | No* | HTTP(S) URL to image. Fetched server-side. |
| input | string | No* | Auto-detect: URL if starts with http(s), else base64. |
| formats | string[] | No | e.g. ["QR_CODE","CODE_128"]. Default all. |
| tryHarder | boolean | No | Default false. More thorough decode (slower). |
| aggressive | boolean | No | Default false. Try all preprocessing configs. |
| scanMultiple | boolean | No | Default false. Return multiple codes. |
| debug | boolean | No | Default false. Include rawBytes, resultPoints. |
* Provide one of image, imageUrl, or input.
Request body
Content-Type: application/json
{
"input": "<your-site>/api/generate-qrcode?text=HelloWorld&size=200",
"debug": false,
"tryHarder": false,
"aggressive": false,
"assumeGS1": false,
"assumeCode39CheckDigit": false,
"formats": ["QR_CODE", "CODE_128"]
}
// or with base64 (auto-detected)
{
"input": "data:image/png;base64,iVBORw0KGgo..."
}
// or explicitly use imageUrl
{
"imageUrl": "https://example.com/code.png",
"debug": false,
"tryHarder": false,
"aggressive": false
}
// or explicitly use image (base64)
{
"image": "iVBORw0KGgo...",
"debug": false,
"tryHarder": false,
"aggressive": false
}Responses
| Code | Description |
|---|---|
| 200 | Success: ok, format, data. Or ok: false, message when no code found. |
| 400 | Bad Request: missing/ambiguous input, invalid base64, or URL fetch failed. |
| 405 | Method not allowed. Only POST accepted. |
| 503 | Service Unavailable. |
Example
// Example 1: Using input (auto-detect URL or base64). Use our Generate QR API for the image URL.
const res1 = await $fetch('/api/parse-code', {
method: 'POST',
body: {
input: `${window.location.origin}/api/generate-qrcode?text=HelloWorld&size=200`,
debug: false,
tryHarder: false,
aggressive: false,
formats: ['QR_CODE', 'CODE_128']
}
})
// Example 2: Using imageUrl explicitly
const res2 = await $fetch('/api/parse-code', {
method: 'POST',
body: {
imageUrl: 'https://example.com/code.png',
aggressive: true // Enable aggressive mode for difficult images
}
})
// Example 3: Using image (base64)
const res3 = await $fetch('/api/parse-code', {
method: 'POST',
body: {
image: 'iVBORw0KGgo...',
tryHarder: true,
assumeGS1: true
}
})
if (res1.ok) console.log(res1.data)Try it
Detected: Unknown
Options
Advanced Options
|