QR Generator

API

Generate QR codes programmatically using our REST API. Send a POST request and receive a JPG image. Use it in your own projects and applications.

Base URL

http://localhost:3000/api/qr

Send a POST request with JSON body to generate a QR code. Returns a PNG image.

Request Body

FieldTypeRequiredDescription
typestringRequiredQR code type
dataobjectRequiredType-specific data fields
designobjectOptionalDesign customization options

QR Types and Data Fields

website

Encodes a website URL

data fields
{
  "url": "https://example.com"
}

business-card

Creates a vCard 3.0 QR code

data fields
{
  "firstName": "John",
  "lastName": "Doe",
  "phone": "+15551234567",
  "email": "john@example.com",
  "company": "Acme Corp",
  "title": "Software Engineer",
  "website": "https://example.com"
}

text

Encodes any text content

data fields
{
  "text": "Hello World"
}

wifi

WiFi network credentials

data fields
{
  "ssid": "MyNetwork",
  "password": "MyPassword",
  "encryption": "WPA"
}

pdf

Links to a PDF document

data fields
{
  "url": "https://example.com/document.pdf"
}

Design Options

FieldTypeDefaultDescription
foregroundColorstring#000000QR code color (hex)
backgroundColorstring#ffffffBackground color (hex)
sizenumber512Image size in pixels (128-1024)
errorCorrectionstringML (7%), M (15%), Q (25%), H (30%)

Code Examples

cURL
curl -X POST http://localhost:3000/api/qr \
  -H "Content-Type: application/json" \
  -d '{
    "type": "website",
    "data": {
      "url": "https://example.com"
    },
    "design": {
      "foregroundColor": "#000000",
      "backgroundColor": "#ffffff",
      "size": 512,
      "errorCorrection": "M"
    }
  }' \
  --output qr-code.png

Response

200 OK - Image/png

Returns the QR code as a PNG image file

400 Bad Request - JSON

Returns error message when request is invalid

500 Internal Server Error - JSON

Returns error message when generation fails