{
  "openapi": "3.1.0",
  "info": {
    "title": "QR Code Generator API",
    "version": "1.0.0",
    "description": "QR codes for any text or URL as PNG, SVG or base64, with size, margin, error correction and colours.\n\nTurn any text or URL into a scannable QR code as PNG, SVG or a base64 data URL, with control over size, margin, error-correction level and colours. Generated in the worker on every call, nothing stored.",
    "contact": {
      "name": "Data and APIs",
      "url": "https://dataandapis.com/contact"
    },
    "termsOfService": "https://dataandapis.com/terms-of-service",
    "license": {
      "name": "Data and APIs Terms of Service",
      "url": "https://dataandapis.com/terms-of-service"
    },
    "x-logo": {
      "url": "https://dataandapis.com/images/qr-code.webp"
    }
  },
  "externalDocs": {
    "description": "Documentation, live tester and pricing",
    "url": "https://dataandapis.com/apis/qr-code-generator"
  },
  "servers": [
    {
      "url": "https://api-qrcode.dataandapis.com"
    }
  ],
  "tags": [
    {
      "name": "Utilities",
      "description": "QR Code Generator API belongs to the Utilities category of the Data and APIs catalog."
    }
  ],
  "paths": {
    "/v1/qrcode": {
      "get": {
        "operationId": "generateQrCode",
        "summary": "Generate QR Code",
        "description": "Generate QR Code endpoint of the QR Code Generator API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/qr-code-generator/generate-qr-code"
        },
        "parameters": [
          {
            "name": "dark",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "#000000"
          },
          {
            "name": "data",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://dataandapis.com"
          },
          {
            "name": "ecc",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "H"
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "png"
          },
          {
            "name": "light",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "#ffffff"
          },
          {
            "name": "margin",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "4"
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "400"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "image/*": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    },
    "/v1/qrcode/base64": {
      "get": {
        "operationId": "generateQrCodeBase64",
        "summary": "Generate QR Code (Base64)",
        "description": "Generate QR Code (Base64) endpoint of the QR Code Generator API. Costs 1 token per call.",
        "externalDocs": {
          "url": "https://dataandapis.com/apis/qr-code-generator/generate-qr-code-base64"
        },
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "https://dataandapis.com"
          },
          {
            "name": "ecc",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "M"
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "300"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "format": "png",
                  "width": 300,
                  "error_correction_level": "M",
                  "data_url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAAAklEQVR4..."
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "402": {
            "description": "Subscription past due; the response carries a payment_url"
          },
          "429": {
            "description": "Monthly token allowance exhausted"
          }
        },
        "security": [
          {
            "ApiKey": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key",
        "description": "Create a free key at https://dataandapis.com/sign-up. 500 tokens a month on the Free plan; this API costs 1 token per call."
      }
    }
  },
  "security": [
    {
      "ApiKey": []
    }
  ]
}