{
  "openapi": "3.0.0",
  "info": {
    "title": "QR Code Service",
    "version": "1.0.0",
    "description": "QR code generation and scanning for AI agents. PNG, SVG, WiFi, vCard, batch, and image decode. Paid via MPP on Tempo network."
  },
  "servers": [{ "url": "https://qr.ivan-tempo.xyz" }],
  "paths": {
    "/api/qr": {
      "get": {
        "operationId": "generateQR",
        "summary": "Generate basic PNG QR code",
        "description": "Returns a PNG image of the QR code for the given text. Optionally specify size (100–1000px).",
        "x-payment-info": {
          "authMode": "paid",
          "protocols": ["mpp"],
          "price": "0.01",
          "currency": "USDC.e",
          "currencyAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "network": "tempo",
          "chainId": 4217,
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "feePayer": true,
          "gasAbstracted": true
        },
        "x-mpp": {
          "price": 10000,
          "token": "USDC.e",
          "tokenAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "network": "tempo",
          "feePayer": true
        },
        "parameters": [
          { "name": "text", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Text or URL to encode" },
          { "name": "size", "in": "query", "required": false, "schema": { "type": "integer", "default": 300, "minimum": 100, "maximum": 1000 }, "description": "Image size in pixels" }
        ],
        "responses": {
          "200": { "description": "PNG image", "content": { "image/png": {} } },
          "402": { "description": "Payment required." }
        }
      }
    },
    "/api/qr/styled": {
      "get": {
        "operationId": "generateStyledQR",
        "summary": "Styled QR with custom colors",
        "description": "Generate a PNG QR code with custom foreground and background colors. Pass hex colors without the # prefix.",
        "x-payment-info": {
          "authMode": "paid",
          "protocols": ["mpp"],
          "price": "0.02",
          "currency": "USDC.e",
          "currencyAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "network": "tempo",
          "chainId": 4217,
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "feePayer": true,
          "gasAbstracted": true
        },
        "x-mpp": {
          "price": 20000,
          "token": "USDC.e",
          "tokenAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "network": "tempo",
          "feePayer": true
        },
        "parameters": [
          { "name": "text", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Text or URL to encode" },
          { "name": "color", "in": "query", "required": false, "schema": { "type": "string", "default": "000000" }, "description": "Foreground hex color (without #)" },
          { "name": "bg", "in": "query", "required": false, "schema": { "type": "string", "default": "ffffff" }, "description": "Background hex color (without #)" },
          { "name": "shape", "in": "query", "required": false, "schema": { "type": "string", "enum": ["square"], "default": "square" }, "description": "Module shape" }
        ],
        "responses": {
          "200": { "description": "PNG image", "content": { "image/png": {} } },
          "402": { "description": "Payment required." }
        }
      }
    },
    "/api/qr/batch": {
      "get": {
        "operationId": "generateBatchQR",
        "summary": "Batch QR generation (up to 50)",
        "description": "Generate multiple QR codes in one call. Price is $0.01 × N codes. Returns JSON array with base64 data URLs.",
        "x-payment-info": {
          "authMode": "paid",
          "protocols": ["mpp"],
          "price": "0.01",
          "currency": "USDC.e",
          "currencyAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "network": "tempo",
          "chainId": 4217,
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "feePayer": true,
          "gasAbstracted": true
        },
        "x-mpp": {
          "price": 10000,
          "token": "USDC.e",
          "tokenAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "network": "tempo",
          "feePayer": true
        },
        "parameters": [
          { "name": "texts", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Comma-separated texts to encode (max 50)" }
        ],
        "responses": {
          "200": { "description": "JSON with array of QR data URLs", "content": { "application/json": {} } },
          "402": { "description": "Payment required." }
        }
      }
    },
    "/api/qr/scan": {
      "get": {
        "operationId": "scanQR",
        "summary": "Decode QR code from image URL or data URI",
        "description": "Decodes a QR code from an image. Pass a public image URL or a base64 data URI (data:image/png;base64,...). Returns the decoded text.",
        "x-payment-info": {
          "authMode": "paid",
          "protocols": ["mpp"],
          "price": "0.01",
          "currency": "USDC.e",
          "currencyAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "network": "tempo",
          "chainId": 4217,
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "feePayer": true,
          "gasAbstracted": true
        },
        "x-mpp": {
          "price": 10000,
          "token": "USDC.e",
          "tokenAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "network": "tempo",
          "feePayer": true
        },
        "parameters": [
          { "name": "image", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Public URL or base64 data URI (data:image/png;base64,...) of image containing QR code" }
        ],
        "responses": {
          "200": { "description": "JSON with found: bool and text: string|null", "content": { "application/json": {} } },
          "402": { "description": "Payment required." }
        }
      }
    },
    "/api/qr/wifi": {
      "get": {
        "operationId": "generateWifiQR",
        "summary": "WiFi config QR code",
        "description": "Generate a QR code that configures WiFi when scanned. Supports WPA, WEP, and open networks.",
        "x-payment-info": {
          "authMode": "paid",
          "protocols": ["mpp"],
          "price": "0.01",
          "currency": "USDC.e",
          "currencyAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "network": "tempo",
          "chainId": 4217,
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "feePayer": true,
          "gasAbstracted": true
        },
        "x-mpp": {
          "price": 10000,
          "token": "USDC.e",
          "tokenAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "network": "tempo",
          "feePayer": true
        },
        "parameters": [
          { "name": "ssid", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Network SSID" },
          { "name": "password", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Network password" },
          { "name": "security", "in": "query", "required": false, "schema": { "type": "string", "enum": ["WPA", "WEP", "nopass"], "default": "WPA" }, "description": "Security type" }
        ],
        "responses": {
          "200": { "description": "PNG image", "content": { "image/png": {} } },
          "402": { "description": "Payment required." }
        }
      }
    },
    "/api/qr/vcard": {
      "get": {
        "operationId": "generateVCardQR",
        "summary": "vCard contact QR code",
        "description": "Generate a QR code encoding a vCard 3.0 contact. Scan with any contacts app to import.",
        "x-payment-info": {
          "authMode": "paid",
          "protocols": ["mpp"],
          "price": "0.01",
          "currency": "USDC.e",
          "currencyAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "network": "tempo",
          "chainId": 4217,
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "feePayer": true,
          "gasAbstracted": true
        },
        "x-mpp": {
          "price": 10000,
          "token": "USDC.e",
          "tokenAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "network": "tempo",
          "feePayer": true
        },
        "parameters": [
          { "name": "name", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Full name" },
          { "name": "phone", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Phone number" },
          { "name": "email", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Email address" },
          { "name": "org", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Organisation" },
          { "name": "website", "in": "query", "required": false, "schema": { "type": "string" }, "description": "Website URL" }
        ],
        "responses": {
          "200": { "description": "PNG image", "content": { "image/png": {} } },
          "402": { "description": "Payment required." }
        }
      }
    },
    "/api/qr/svg": {
      "get": {
        "operationId": "generateSVGQR",
        "summary": "QR code as SVG markup",
        "description": "Returns raw SVG markup for the QR code. Ideal for embedding in web pages or documents.",
        "x-payment-info": {
          "authMode": "paid",
          "protocols": ["mpp"],
          "price": "0.01",
          "currency": "USDC.e",
          "currencyAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "network": "tempo",
          "chainId": 4217,
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "feePayer": true,
          "gasAbstracted": true
        },
        "x-mpp": {
          "price": 10000,
          "token": "USDC.e",
          "tokenAddress": "0x20C000000000000000000000b9537d11c60E8b50",
          "recipient": "0x0d509f743bc6fc907d5f63d8b0dae1fca8d80897",
          "network": "tempo",
          "feePayer": true
        },
        "parameters": [
          { "name": "text", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Text or URL to encode" }
        ],
        "responses": {
          "200": { "description": "SVG markup", "content": { "image/svg+xml": {} } },
          "402": { "description": "Payment required." }
        }
      }
    }
  }
}
