{"openapi":"3.0.3","info":{"title":"QR Code Generator API","version":"1.1.0","description":"Generate QR codes as SVG or base64. Supports plain text/URL, vCard contacts, WiFi credentials, mailto, and tel links. No API key required for free tier (100 req/IP/day).","contact":{"url":"https://api.lazy-mac.com"}},"servers":[{"url":"https://api.lazy-mac.com/qr-code"}],"components":{"schemas":{"GenerateParams":{"type":"object","properties":{"format":{"type":"string","enum":["svg","base64"],"default":"svg","description":"svg returns image/svg+xml body; base64 returns JSON {base64:\"data:image/svg+xml;base64,...\"}"},"size":{"type":"integer","minimum":50,"maximum":2000,"default":300,"description":"Output image width/height in pixels"},"margin":{"type":"integer","minimum":0,"maximum":10,"default":2,"description":"Quiet zone modules around the QR pattern"},"errorCorrectionLevel":{"type":"string","enum":["L","M","Q","H"],"default":"M","description":"L=7% M=15% Q=25% H=30% data recovery capacity"},"darkColor":{"type":"string","default":"#000000","description":"Dark module color (hex)"},"lightColor":{"type":"string","default":"#ffffff","description":"Light/background color (hex)"}}},"Base64Response":{"type":"object","required":["base64"],"properties":{"base64":{"type":"string","description":"data:image/svg+xml;base64,... — embed directly in <img src>"}}},"ErrorResponse":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"HealthResponse":{"type":"object","required":["ok","service","ts"],"properties":{"ok":{"type":"boolean"},"service":{"type":"string"},"ts":{"type":"string","format":"date-time"}}}}},"paths":{"/":{"get":{"summary":"API info","operationId":"getInfo","responses":{"200":{"description":"API name, version, and endpoint listing","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"},"endpoints":{"type":"object"}}}}}}}}},"/health":{"get":{"summary":"Health check","operationId":"healthCheck","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/v1/generate":{"get":{"summary":"Generate QR code (GET)","operationId":"generateQrGet","description":"Generate a QR code for any text or URL. Default output is SVG (image/svg+xml). Use format=base64 to get a JSON response with a base64 data URL.","parameters":[{"name":"data","in":"query","required":true,"schema":{"type":"string"},"description":"Text or URL to encode"},{"name":"format","in":"query","schema":{"type":"string","enum":["svg","base64"]},"description":"Output format (default: svg)"},{"name":"size","in":"query","schema":{"type":"integer","minimum":50,"maximum":2000},"description":"Width/height in px (default: 300)"},{"name":"margin","in":"query","schema":{"type":"integer","minimum":0,"maximum":10},"description":"Quiet zone modules (default: 2)"},{"name":"errorCorrectionLevel","in":"query","schema":{"type":"string","enum":["L","M","Q","H"]},"description":"Error correction level (default: M)"},{"name":"darkColor","in":"query","schema":{"type":"string"},"description":"Dark module color hex (default: #000000)"},{"name":"lightColor","in":"query","schema":{"type":"string"},"description":"Light background color hex (default: #ffffff)"}],"responses":{"200":{"description":"QR code — SVG image or base64 JSON depending on format param","content":{"image/svg+xml":{"schema":{"type":"string"}},"application/json":{"schema":{"$ref":"#/components/schemas/Base64Response"}}}},"400":{"description":"Missing required parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Generation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"post":{"summary":"Generate QR code (POST)","operationId":"generateQrPost","description":"Generate a QR code via JSON body. Supports type=email and type=phone to auto-format mailto:/tel: strings from structured fields.","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GenerateParams"},{"type":"object","properties":{"data":{"type":"string","description":"Raw text or URL (required unless type=email/phone)"},"type":{"type":"string","enum":["email","phone"],"description":"When set, uses structured fields instead of raw data"},"to":{"type":"string","description":"Email recipient (when type=email)"},"subject":{"type":"string","description":"Email subject (when type=email)"},"body":{"type":"string","description":"Email body (when type=email)"},"number":{"type":"string","description":"Phone number (when type=phone)"}}}]}}}},"responses":{"200":{"description":"QR code","content":{"image/svg+xml":{"schema":{"type":"string"}},"application/json":{"schema":{"$ref":"#/components/schemas/Base64Response"}}}},"400":{"description":"Missing required field","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/generate/base64":{"get":{"summary":"Generate QR code as base64 data URL","operationId":"generateQrBase64","description":"Always returns JSON with a data:image/svg+xml;base64,... value. Convenient for embedding in <img src> or JSON APIs.","parameters":[{"name":"data","in":"query","required":true,"schema":{"type":"string"},"description":"Text or URL to encode"},{"name":"size","in":"query","schema":{"type":"integer","minimum":50,"maximum":2000},"description":"Width/height in px (default: 300)"},{"name":"margin","in":"query","schema":{"type":"integer"},"description":"Quiet zone modules (default: 2)"},{"name":"errorCorrectionLevel","in":"query","schema":{"type":"string","enum":["L","M","Q","H"]}},{"name":"darkColor","in":"query","schema":{"type":"string"}},{"name":"lightColor","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Base64 SVG data URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Base64Response"}}}},"400":{"description":"Missing required parameter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/vcard":{"post":{"summary":"Generate vCard contact QR code","operationId":"generateVcard","description":"Encodes contact info as a vCard 3.0 string and generates a QR code. Scannable by iPhone/Android contacts apps.","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GenerateParams"},{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"phone":{"type":"string","description":"E.164 recommended, e.g. +821012345678"},"email":{"type":"string","format":"email"},"org":{"type":"string","description":"Organization/company"},"title":{"type":"string","description":"Job title"},"url":{"type":"string","format":"uri"},"address":{"type":"string","description":"Street address"}}}]}}}},"responses":{"200":{"description":"vCard QR code","content":{"image/svg+xml":{"schema":{"type":"string"}},"application/json":{"schema":{"$ref":"#/components/schemas/Base64Response"}}}}}}},"/api/v1/wifi":{"post":{"summary":"Generate WiFi credentials QR code","operationId":"generateWifi","description":"Encodes WiFi credentials using the WIFI: URI scheme. Scanning opens the network join dialog on iOS/Android.","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GenerateParams"},{"type":"object","required":["ssid"],"properties":{"ssid":{"type":"string","description":"WiFi network name (SSID)"},"password":{"type":"string","description":"WiFi password (omit for open networks)"},"encryption":{"type":"string","enum":["WPA","WEP","nopass"],"default":"WPA"}}}]}}}},"responses":{"200":{"description":"WiFi QR code","content":{"image/svg+xml":{"schema":{"type":"string"}},"application/json":{"schema":{"$ref":"#/components/schemas/Base64Response"}}}},"400":{"description":"Missing SSID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/email":{"post":{"summary":"Generate email (mailto:) QR code","operationId":"generateEmail","description":"Encodes a mailto: link. Scanning opens the device mail client with pre-filled fields.","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GenerateParams"},{"type":"object","required":["to"],"properties":{"to":{"type":"string","format":"email","description":"Recipient email address"},"subject":{"type":"string"},"body":{"type":"string"}}}]}}}},"responses":{"200":{"description":"Email QR code","content":{"image/svg+xml":{"schema":{"type":"string"}},"application/json":{"schema":{"$ref":"#/components/schemas/Base64Response"}}}},"400":{"description":"Missing to field","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/v1/phone":{"post":{"summary":"Generate phone (tel:) QR code","operationId":"generatePhone","description":"Encodes a tel: link. Scanning opens the device dialer.","requestBody":{"required":true,"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GenerateParams"},{"type":"object","required":["number"],"properties":{"number":{"type":"string","description":"Phone number — E.164 recommended (e.g. +821012345678)"}}}]}}}},"responses":{"200":{"description":"Phone QR code","content":{"image/svg+xml":{"schema":{"type":"string"}},"application/json":{"schema":{"$ref":"#/components/schemas/Base64Response"}}}},"400":{"description":"Missing number field","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/mcp":{"get":{"summary":"MCP server info","operationId":"mcpInfo","description":"Returns MCP server metadata. Use POST with a JSON-RPC 2.0 body to call tools.","responses":{"200":{"description":"MCP server info and example body"}}},"post":{"summary":"MCP JSON-RPC 2.0 endpoint","operationId":"mcpRpc","description":"Model Context Protocol endpoint. Supports: initialize, tools/list, tools/call. Available tools: generate_qr, generate_vcard_qr, generate_wifi_qr, generate_email_qr, generate_phone_qr.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","method"],"properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"type":["integer","string","null"]},"method":{"type":"string","enum":["initialize","tools/list","tools/call","notifications/initialized"]},"params":{"type":"object"}}},"examples":{"initialize":{"value":{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"my-app","version":"1.0"}}}},"toolsList":{"value":{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}},"generateQr":{"value":{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"generate_qr","arguments":{"data":"https://example.com","size":300}}}}}}}},"responses":{"200":{"description":"JSON-RPC 2.0 result"},"204":{"description":"No content (for notifications/initialized)"}}}}}}