{
  "openapi": "3.1.1",
  "info": {
    "title": "QR Code Generator (print-ready) API",
    "version": "1.0.0",
    "summary": "QR codes for links, text, Wi-Fi, contacts and more — as vector PDF, SVG and PNG.",
    "description": "Every endpoint performs the same calculation as the human page and returns inputs, result, units, assumptions, sources, warnings and computedAt. MCP endpoint: /mcp."
  },
  "servers": [
    {
      "url": "https://printshopqrcode.usefulweb.app"
    }
  ],
  "paths": {
    "/api/v1/calculate": {
      "post": {
        "operationId": "calculate",
        "summary": "QR codes for links, text, Wi-Fi, contacts and more — as vector PDF, SVG and PNG.",
        "description": "Encode a link, text, Wi-Fi login, contact card, e-mail, phone, SMS or map location as a QR code following ISO/IEC 18004 (versions 1–40, error correction L/M/Q/H, optimal mode switching, all eight masks scored). Get a print page with a test square, the code alone as SVG and PNG, a sheet of copies or Wi-Fi guest cards.\n\nMethodology:\n- Data is split into numeric, alphanumeric and byte (UTF-8) segments with the fewest bits (dynamic programming over the bit costs of ISO/IEC 18004 §7.4); the smallest version 1–40 that holds it at the chosen error-correction level is used.\n- Reed–Solomon error correction over GF(256) (polynomial 0x11D), block interleaving after Table 9, all eight masks scored with the four penalty rules and the lowest chosen; format and version information use the BCH codes of §7.9–7.10.\n- The logo-safe area clears the centre modules (never finder, timing or alignment patterns) and counts, per Reed–Solomon block, how many codewords it touches; the area is reported safe only when that stays within half of the block’s error-correction codewords.\n- Wi-Fi codes use the WIFI:T:…;S:…;P:…;; format read by phone cameras (special characters escaped). Pages print at true size with a 20 mm (or 1 in) test square.\n\n“QR Code” is a registered trademark of DENSO WAVE INCORPORATED. Test a printed code with the phones of your audience before printing many copies.",
        "tags": [
          "apps"
        ],
        "x-mcp-tool": "printshop_qr_code",
        "x-owner-app": "printshop",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrintshopQrCodeInput"
              },
              "examples": {
                "example1": {
                  "summary": "Link to a website",
                  "value": {
                    "content": "url",
                    "text": "https://usefulweb.site/",
                    "ecc": "M",
                    "size": 60
                  }
                },
                "example2": {
                  "summary": "Wi-Fi guest cards",
                  "value": {
                    "content": "wifi",
                    "ssid": "Guest network",
                    "password": "sunny-garden-2027",
                    "security": "WPA",
                    "layout": "wifi-card"
                  }
                },
                "example3": {
                  "summary": "Sheet of small codes with a logo-safe centre",
                  "value": {
                    "content": "text",
                    "text": "Table 12 · ask for the menu",
                    "ecc": "H",
                    "size": 40,
                    "logo": 20,
                    "layout": "sheet",
                    "caption": "Scan for the menu"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Calculation result envelope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrintshopQrCodeResult"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON body.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "Invalid input (see errors[]).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tool": {
      "get": {
        "operationId": "getToolDefinition",
        "summary": "Inputs, output schema and examples for this tool",
        "responses": {
          "200": {
            "description": "Tool definition.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. 422 responses include per-field `errors`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "field",
                "message"
              ],
              "properties": {
                "field": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PrintshopQrCodeInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "content": {
            "title": "Content type",
            "type": "string",
            "enum": [
              "url",
              "text",
              "wifi",
              "email",
              "phone",
              "sms",
              "geo"
            ],
            "default": "url"
          },
          "text": {
            "title": "Content",
            "description": "The address, text, e-mail address, phone number or \"latitude, longitude\". Not used for Wi-Fi.",
            "type": "string",
            "maxLength": 4000,
            "default": "https://usefulweb.site/"
          },
          "ssid": {
            "title": "Wi-Fi network name (SSID)",
            "type": "string",
            "maxLength": 64,
            "default": ""
          },
          "password": {
            "title": "Wi-Fi password",
            "description": "Only used for the code; it is not shown in the result or stored in the share link.",
            "type": "string",
            "maxLength": 63,
            "default": ""
          },
          "security": {
            "title": "Wi-Fi security",
            "type": "string",
            "enum": [
              "WPA",
              "WEP",
              "nopass"
            ],
            "default": "WPA"
          },
          "hidden": {
            "title": "Hidden network",
            "type": "boolean",
            "default": false
          },
          "layout": {
            "title": "Print layout",
            "type": "string",
            "enum": [
              "one",
              "sheet",
              "wifi-card"
            ],
            "default": "one"
          },
          "ecc": {
            "title": "Error correction",
            "type": "string",
            "enum": [
              "L",
              "M",
              "Q",
              "H"
            ],
            "default": "M"
          },
          "size": {
            "title": "Code width (mm, with quiet zone)",
            "type": "number",
            "minimum": 10,
            "maximum": 400,
            "default": 60
          },
          "quiet": {
            "title": "Quiet zone (modules)",
            "type": "integer",
            "minimum": 0,
            "maximum": 10,
            "default": 4
          },
          "dark": {
            "title": "Dark colour",
            "type": "string",
            "maxLength": 7,
            "default": "#000000"
          },
          "light": {
            "title": "Light colour",
            "type": "string",
            "maxLength": 7,
            "default": "#ffffff"
          },
          "logo": {
            "title": "Logo-safe area (% of the code width)",
            "description": "Leaves an empty square in the centre for a logo and checks it against the error correction.",
            "type": "number",
            "minimum": 0,
            "maximum": 30,
            "default": 0
          },
          "caption": {
            "title": "Caption under the code",
            "type": "string",
            "maxLength": 200,
            "default": ""
          },
          "paper": {
            "title": "Paper size",
            "type": "string",
            "enum": [
              "a3",
              "a4",
              "a5",
              "a6",
              "b5",
              "letter",
              "legal",
              "tabloid",
              "halfletter"
            ],
            "default": "a4"
          },
          "orientation": {
            "title": "Orientation",
            "type": "string",
            "enum": [
              "portrait",
              "landscape"
            ],
            "default": "portrait"
          }
        },
        "required": []
      },
      "PrintshopQrCodeResult": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "schemaVersion",
          "tool",
          "computedAt",
          "inputs",
          "summary",
          "result",
          "units",
          "assumptions",
          "sources",
          "warnings",
          "presentation",
          "links"
        ],
        "properties": {
          "schemaVersion": {
            "type": "string",
            "const": "1.0"
          },
          "tool": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "name",
              "version"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            }
          },
          "computedAt": {
            "type": "string",
            "format": "date-time"
          },
          "inputs": {
            "type": "object",
            "description": "Normalised inputs actually used, including applied defaults."
          },
          "summary": {
            "type": "string"
          },
          "result": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "version",
              "modules",
              "ecc",
              "mask",
              "segments",
              "dataBits",
              "capacityBits",
              "moduleMm",
              "payloadChars",
              "logo",
              "pages",
              "pageWidthMm",
              "pageHeightMm",
              "warnings",
              "files",
              "openInApp"
            ],
            "properties": {
              "version": {
                "type": "integer"
              },
              "modules": {
                "type": "integer"
              },
              "ecc": {
                "type": "string"
              },
              "mask": {
                "type": "integer"
              },
              "segments": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "dataBits": {
                "type": "integer"
              },
              "capacityBits": {
                "type": "integer"
              },
              "moduleMm": {
                "type": "number"
              },
              "payloadChars": {
                "type": "integer"
              },
              "logo": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "safe",
                  "worstBlockCodewords",
                  "correctablePerBlock"
                ],
                "properties": {
                  "safe": {
                    "type": "boolean"
                  },
                  "worstBlockCodewords": {
                    "type": "integer"
                  },
                  "correctablePerBlock": {
                    "type": "integer"
                  }
                }
              },
              "pages": {
                "type": "integer"
              },
              "pageWidthMm": {
                "type": "number"
              },
              "pageHeightMm": {
                "type": "number"
              },
              "warnings": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "files": {
                "type": [
                  "object",
                  "null"
                ],
                "additionalProperties": false,
                "required": [
                  "pdf",
                  "svg",
                  "png"
                ],
                "properties": {
                  "pdf": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "artifactId",
                      "filename",
                      "mime",
                      "bytes",
                      "sha256",
                      "path"
                    ],
                    "properties": {
                      "artifactId": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string",
                        "description": "Download path on the same site (valid for about 2 hours)."
                      }
                    }
                  },
                  "svg": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "artifactId",
                      "filename",
                      "mime",
                      "bytes",
                      "sha256",
                      "path"
                    ],
                    "properties": {
                      "artifactId": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string",
                        "description": "Download path on the same site (valid for about 2 hours)."
                      }
                    }
                  },
                  "png": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "artifactId",
                      "filename",
                      "mime",
                      "bytes",
                      "sha256",
                      "path"
                    ],
                    "properties": {
                      "artifactId": {
                        "type": "string"
                      },
                      "filename": {
                        "type": "string"
                      },
                      "mime": {
                        "type": "string"
                      },
                      "bytes": {
                        "type": "integer"
                      },
                      "sha256": {
                        "type": "string"
                      },
                      "path": {
                        "type": "string",
                        "description": "Download path on the same site (valid for about 2 hours)."
                      }
                    }
                  }
                }
              },
              "openInApp": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "units": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "assumptions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sources": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "title"
              ],
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "publisher": {
                  "type": "string"
                },
                "retrievedAt": {
                  "type": "string"
                },
                "note": {
                  "type": "string"
                }
              }
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "presentation": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Display blocks used by the human page (same data)."
          },
          "links": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "human",
              "api",
              "openapi",
              "methodology"
            ],
            "properties": {
              "human": {
                "type": "string",
                "format": "uri"
              },
              "api": {
                "type": "string",
                "format": "uri"
              },
              "openapi": {
                "type": "string",
                "format": "uri"
              },
              "methodology": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}