{
  "openapi": "3.1.0",
  "info": {
    "title": "QRburst QR Generation API",
    "version": "1.0.0",
    "description": "Authenticated, stateless QR generation API. Requires a Bearer API key when enabled. Encodes payloads with QRburst's canonical engine and returns PNG or SVG. No accounts, no dynamic redirects, no payload persistence. The browser product remains independent and accountless.",
    "contact": {
      "url": "https://qrburst.com"
    }
  },
  "servers": [
    {
      "url": "https://qrburst.com"
    }
  ],
  "paths": {
    "/api/v1/qr": {
      "post": {
        "operationId": "postQrV1",
        "summary": "Generate a QR code from a typed payload",
        "description": "Structured canonical API. Requires Authorization: Bearer <api-key>. Request bodies are not intentionally persisted.",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiQrRequestV1"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "QR image",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "415": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          },
          "500": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Manually provisioned API key (qrb_live_…). Keys are never accepted in query strings, cookies, or JSON bodies."
      }
    },
    "schemas": {
      "ApiQrRequestV1": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "payload"
        ],
        "properties": {
          "payload": {
            "$ref": "#/components/schemas/ApiPayload"
          },
          "output": {
            "$ref": "#/components/schemas/ApiOutput"
          },
          "design": {
            "$ref": "#/components/schemas/ApiDesign"
          }
        }
      },
      "ApiOutput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "png",
              "svg"
            ],
            "default": "png"
          },
          "size": {
            "type": "integer",
            "minimum": 64,
            "maximum": 2000,
            "default": 512
          }
        }
      },
      "ApiDesign": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "foreground": {
            "type": "string",
            "pattern": "^#?[0-9A-Fa-f]{6}$"
          },
          "background": {
            "type": "string",
            "pattern": "^#?[0-9A-Fa-f]{6}$"
          },
          "errorCorrection": {
            "type": "string",
            "enum": [
              "L",
              "M",
              "Q",
              "H"
            ]
          },
          "quietZone": {
            "type": "string",
            "enum": [
              "compact",
              "standard",
              "generous"
            ]
          }
        }
      },
      "ApiPayload": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/WebsitePayload"
          },
          {
            "$ref": "#/components/schemas/TextPayload"
          },
          {
            "$ref": "#/components/schemas/EmailPayload"
          },
          {
            "$ref": "#/components/schemas/PhonePayload"
          },
          {
            "$ref": "#/components/schemas/SmsPayload"
          },
          {
            "$ref": "#/components/schemas/WhatsappPayload"
          },
          {
            "$ref": "#/components/schemas/WifiPayload"
          },
          {
            "$ref": "#/components/schemas/VcardPayload"
          },
          {
            "$ref": "#/components/schemas/LocationPayload"
          },
          {
            "$ref": "#/components/schemas/EventPayload"
          }
        ],
        "discriminator": {
          "propertyName": "type"
        }
      },
      "WebsitePayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "url"
        ],
        "properties": {
          "type": {
            "const": "website"
          },
          "url": {
            "type": "string"
          }
        }
      },
      "TextPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "text"
        ],
        "properties": {
          "type": {
            "const": "text"
          },
          "text": {
            "type": "string"
          }
        }
      },
      "EmailPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "email"
        ],
        "properties": {
          "type": {
            "const": "email"
          },
          "email": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "body": {
            "type": "string"
          }
        }
      },
      "PhonePayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "phone"
        ],
        "properties": {
          "type": {
            "const": "phone"
          },
          "phone": {
            "type": "string"
          }
        }
      },
      "SmsPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "phone"
        ],
        "properties": {
          "type": {
            "const": "sms"
          },
          "phone": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "WhatsappPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "phone"
        ],
        "properties": {
          "type": {
            "const": "whatsapp"
          },
          "phone": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "WifiPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "ssid",
          "security"
        ],
        "properties": {
          "type": {
            "const": "wifi"
          },
          "ssid": {
            "type": "string"
          },
          "security": {
            "type": "string",
            "enum": [
              "WPA",
              "WEP",
              "nopass"
            ]
          },
          "password": {
            "type": "string"
          },
          "hidden": {
            "type": "boolean"
          }
        }
      },
      "VcardPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "firstName",
          "lastName"
        ],
        "properties": {
          "type": {
            "const": "vcard"
          },
          "firstName": {
            "type": "string"
          },
          "lastName": {
            "type": "string"
          },
          "organization": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "phone": {
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "website": {
            "type": "string"
          }
        }
      },
      "LocationPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "latitude",
          "longitude"
        ],
        "properties": {
          "type": {
            "const": "location"
          },
          "latitude": {
            "type": "number"
          },
          "longitude": {
            "type": "number"
          },
          "label": {
            "type": "string"
          }
        }
      },
      "EventPayload": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "title",
          "start"
        ],
        "properties": {
          "type": {
            "const": "event"
          },
          "title": {
            "type": "string"
          },
          "start": {
            "type": "string",
            "description": "Floating local YYYY-MM-DDTHH:mm"
          },
          "end": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "ApiError": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "requestId"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_request",
                  "invalid_payload",
                  "unsupported_payload_type",
                  "invalid_output",
                  "invalid_design",
                  "payload_too_large",
                  "unauthorized",
                  "rate_limited",
                  "generation_failed",
                  "service_unavailable"
                ]
              },
              "message": {
                "type": "string"
              },
              "field": {
                "type": "string"
              },
              "requestId": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Missing or invalid API key",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string",
              "example": "Bearer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            },
            "description": "Seconds to wait before retrying"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ApiError"
            }
          }
        }
      }
    }
  },
  "x-qrburst": {
    "rateLimits": {
      "post": {
        "limit": 30,
        "windowMs": 60000
      },
      "identity": "per authenticated API key"
    },
    "postBodyMaxBytes": 32768,
    "designSubset": [
      "foreground",
      "background",
      "errorCorrection",
      "quietZone"
    ],
    "unsupportedInV1": [
      "gradients",
      "moduleStyles",
      "finderStyles",
      "logos",
      "pdf",
      "bulk"
    ]
  }
}