{
  "openapi": "3.1.0",
  "info": {
    "title": "qrcode.io static QR code API",
    "version": "1.0.0",
    "description": "Free static QR codes for agents and developers. Payloads are not stored or logged. Static codes cannot be edited or tracked; for that, see https://qrcode.io/what-is-a-dynamic-qr-code.",
    "contact": {
      "email": "support@qrcode.io",
      "url": "https://qrcode.io/contact"
    },
    "termsOfService": "https://qrcode.io/terms-and-conditions"
  },
  "servers": [
    {
      "url": "https://agent.qrcode.io"
    }
  ],
  "paths": {
    "/v1/qr": {
      "post": {
        "operationId": "createStaticQrCode",
        "summary": "Create a static QR code image",
        "description": "Create a static QR code image (PNG or SVG) from text, a URL, WiFi credentials, a vCard or any other payload up to 1000 bytes. The payload is encoded directly in the pattern, so the code works forever, but it cannot be edited or tracked after printing. For an editable code with scan analytics, the user needs a dynamic QR code from qrcode.io (15-day free trial, no card).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QrRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The QR code image.",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input; error.code says which field.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "The payload links to a host blocked after an abuse report.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "The payload is over 1000 bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Too many requests from this address; retry after the Retry-After header.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Generation is paused; retry later.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "operationId": "health",
        "summary": "Service status",
        "responses": {
          "200": {
            "description": "Status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string"
                    },
                    "generation": {
                      "type": "string",
                      "enum": [
                        "enabled",
                        "paused"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "QrRequest": {
        "type": "object",
        "required": [
          "data"
        ],
        "additionalProperties": false,
        "properties": {
          "data": {
            "type": "string",
            "minLength": 1,
            "description": "Payload to encode, up to 1000 bytes as UTF-8."
          },
          "format": {
            "type": "string",
            "enum": [
              "png",
              "svg"
            ],
            "default": "png"
          },
          "size": {
            "type": "integer",
            "minimum": 128,
            "maximum": 1024,
            "default": 512,
            "description": "Maximum width in pixels; modules are whole pixels, so the image may be slightly smaller."
          },
          "fg": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "default": "#000000",
            "description": "Module colour. Must be darker than bg with at least 4.5:1 contrast."
          },
          "bg": {
            "type": "string",
            "pattern": "^#[0-9a-fA-F]{6}$",
            "default": "#ffffff"
          },
          "ecc": {
            "type": "string",
            "enum": [
              "L",
              "M",
              "Q",
              "H"
            ],
            "default": "M",
            "description": "Error correction level."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}