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)

NameTypeRequiredDescription
textstringYesContent to encode. Max 2048 characters.
sizeintegerNoWidth/height in pixels (default 256). 64–1024.
formatstringNopng (default) or svg.
marginintegerNoQuiet zone (default 2). 0–10.
eclstringNoError correction: L, M, Q, H (default M).
returnUrlbooleanNoIf 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

CodeDescription
200Success: binary image, or JSON url, expiresAt, expiresInSeconds when returnUrl: true.
400Bad Request: missing/empty text or text > 2048 chars.
503Service 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:

Error correction:
QR code for TICKET-123

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)

NameTypeRequiredDescription
imagestringNo*Base64 image (with or without data URI). Max 10MB.
imageUrlstringNo*HTTP(S) URL to image. Fetched server-side.
inputstringNo*Auto-detect: URL if starts with http(s), else base64.
formatsstring[]Noe.g. ["QR_CODE","CODE_128"]. Default all.
tryHarderbooleanNoDefault false. More thorough decode (slower).
aggressivebooleanNoDefault false. Try all preprocessing configs.
scanMultiplebooleanNoDefault false. Return multiple codes.
debugbooleanNoDefault 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

CodeDescription
200Success: ok, format, data. Or ok: false, message when no code found.
400Bad Request: missing/ambiguous input, invalid base64, or URL fetch failed.
405Method not allowed. Only POST accepted.
503Service 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

Demo type:
Format:

Detected: Unknown

Options

Advanced Options

|