qr-code
POST1 créditoEncodes a payload into a QR code and returns it in the requested format. PNG and SVG are suitable for direct rendering; UTF-8 is useful for terminal UIs and quick previews.
Endpoint
POST https://x114.org/api/v1/qr-codeCorpo da requisição
Envie como JSON no corpo POST.
| Name | Type | Required | Description |
|---|---|---|---|
| text | string | required | The payload to encode. Up to 4 KB of UTF-8 (less at higher error correction). |
| format | "png" | "svg" | "utf8" | optional | Output format. "png" returns a base64 data URL; "svg" returns SVG markup; "utf8" returns block characters for terminals. Defaults to "png". |
| errorCorrectionLevel | "L" | "M" | "Q" | "H" | optional | QR error correction level. Defaults to "M". |
| width | number | optional | Pixel size for PNG (64-2048) or logical width for SVG/UTF-8. Defaults to 256. |
Corpo da resposta
JSON retornado em caso de sucesso (HTTP 200).
| Name | Type | Required | Description |
|---|---|---|---|
| ok | boolean | required | True on success. |
| format | string | required | The format returned ("png" | "svg" | "utf8"). |
| errorCorrectionLevel | string | required | The error correction level that was used. |
| width | number | required | The width that was used (after clamping to the allowed range). |
| mimeType | string | required | MIME type of the output: "image/png" for png, "image/svg+xml" for svg, "text/plain" for utf8. |
| output | string | required | The encoded QR — base64 data URL when format is "png", SVG markup when "svg", block-character text when "utf8". |
Exemplo
curl -X POST https://x114.org/api/v1/qr-code \
-H "Authorization: Bearer sk_..." \
-H "Content-Type: application/json" \
-d '{"text":"https://x114.org","format":"svg","width":256}'