QR Code
Generate a QR code image from any string content, with configurable format, size, colors, and error correction level.
POST /api/qr-code
Section titled “POST /api/qr-code”Parameters
Section titled “Parameters”| Field | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | Yes | — | Content to encode |
format | string | No | png | png or svg |
size | integer | No | 256 | Pixel size (max 2048) |
foreground | string | No | #000000 | Foreground hex color |
background | string | No | #FFFFFF | Background hex color |
error_level | string | No | — | Error correction: L (7%), M (15%), Q (25%), H (30%) |
Response
Section titled “Response”Binary image data with the appropriate Content-Type header (image/png or image/svg+xml).
Examples
Section titled “Examples”Basic PNG
Section titled “Basic PNG”curl -X POST https://morso.dev/api/qr-code \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"content": "https://morso.dev"}' \ -o qr.pngCustom SVG with colors
Section titled “Custom SVG with colors”curl -X POST https://morso.dev/api/qr-code \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"content": "https://morso.dev", "format": "svg", "size": 512, "foreground": "#1a1a2e", "background": "#e2e2e2", "error_level": "H"}' \ -o qr.svgErrors
Section titled “Errors”- 400 — Missing content, invalid format, invalid color, or size exceeds limit.
See Errors for the standard error shape.