{
  "openapi": "3.1.0",
  "info": {
    "title": "xBarcode Edge Render API",
    "version": "1.6.8",
    "description": "High-performance microsecond barcode and 2D matrix rendering engine written in pure Safe Rust. Supports 143 international, retail, logistics, and postal symbologies with vector SVG, PDF, EPS, and binary matrix outputs.",
    "contact": {
      "name": "xBarcode Engineering Support",
      "url": "https://xbarcode.ai",
      "email": "info@xbarcode.ai"
    },
    "license": {
      "name": "Commercial & Free Online Use",
      "url": "https://xbarcode.ai"
    }
  },
  "servers": [
    {
      "url": "https://xbarcode.ai",
      "description": "Cloudflare Edge Global Gateway (Direct / Proxy)"
    },
    {
      "url": "https://api.xbarcode.ai",
      "description": "Dedicated High-Throughput Worker API Endpoint"
    }
  ],
  "paths": {
    "/api/render": {
      "get": {
        "summary": "Render barcode via query parameters",
        "description": "Encodes the payload into the requested barcode symbology and returns vector or matrix data.",
        "operationId": "renderBarcodeGet",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": true,
            "description": "Barcode symbology identifier",
            "schema": {
              "type": "string",
              "enum": [
                "qr_code",
                "code_128",
                "data_matrix",
                "pdf_417",
                "aztec",
                "maxicode",
                "micro_qr",
                "rmqr",
                "dmre",
                "gs1_datamatrix",
                "gs1_qrcode",
                "gs1_digital_link_qr",
                "gs1_digital_link_datamatrix",
                "micro_pdf417",
                "code128a",
                "code128b",
                "code128c",
                "gs1_128",
                "ean_13",
                "gtin_13",
                "isbn",
                "ean_8",
                "gtin_8",
                "upc_a",
                "gtin_12",
                "upc_e",
                "itf",
                "itf_14",
                "gtin_14",
                "sscc",
                "code_39",
                "code_93",
                "codabar",
                "s10",
                "msi",
                "msi10",
                "msi11",
                "msi1010",
                "msi1110",
                "usps_imb",
                "usps_impb",
                "rm4scc",
                "mailmark_4state",
                "mailmark_c",
                "mailmark_l",
                "mailmark_2d",
                "mailmark_2d_7",
                "mailmark_2d_9",
                "mailmark_2d_29",
                "auspost",
                "auspost2n",
                "auspost2c",
                "auspost3n",
                "auspost3c",
                "auspostnull",
                "kix",
                "japanpost",
                "dpd",
                "dpd_aztec",
                "dpd_elabel",
                "upca_composite",
                "upce_composite",
                "ausredirect",
                "ausreply",
                "ausroute",
                "aztecrune",
                "bc412",
                "c25iata",
                "c25ind",
                "c25logic",
                "c25standard",
                "cepnet",
                "channelcode",
                "codablockf",
                "code11",
                "code128ab",
                "code16k",
                "code32",
                "code39extended",
                "code49",
                "codeone",
                "daft",
                "databarexpanded",
                "databarexpandedcomposite",
                "databarexpandedstacked",
                "databarexpandedstackedcomposite",
                "databarlimited",
                "databarlimitedcomposite",
                "databaromni",
                "databaromnicomposite",
                "databaromnistacked",
                "databaromnistackedcomposite",
                "databarstacked",
                "databarstackedcomposite",
                "datamatrixmacro05",
                "datamatrixmacro06",
                "dotcode",
                "dpident",
                "dpleit",
                "dppostmatrix",
                "dxfilmedge",
                "ean13composite",
                "ean14",
                "ean2",
                "ean5",
                "ean8composite",
                "epcqr",
                "fim",
                "flattermarken",
                "gridmatrix",
                "gs1128composite",
                "hanxin",
                "hibcaztec",
                "hibccodablockf",
                "hibccode128",
                "hibccode39",
                "hibcdatamatrix",
                "hibcmicropdf417",
                "hibcpdf417",
                "hibcqr",
                "isbt128",
                "ismn",
                "issn",
                "italianpostal",
                "koreapost",
                "logmars",
                "ntin",
                "pharmacode",
                "pharmacodetwotrack",
                "planet",
                "plessey",
                "postnet",
                "ppn",
                "premiumadress",
                "pzn",
                "pzn7",
                "responseplus",
                "swissqr",
                "telepen",
                "telepennumeric",
                "upnqr",
                "vin",
                "zatcaqr"
              ]
            }
          },
          {
            "name": "content",
            "in": "query",
            "required": true,
            "description": "Data string or URI to encode in the barcode",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "output",
            "in": "query",
            "required": false,
            "description": "Desired output rendering format (default is svg)",
            "schema": {
              "type": "string",
              "enum": [
                "svg",
                "eps",
                "pdf",
                "matrix"
              ],
              "default": "svg"
            }
          },
          {
            "name": "auto_complete_check_digit",
            "in": "query",
            "required": false,
            "description": "Automatically validate and calculate missing trailing check digits",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "color",
            "in": "query",
            "required": false,
            "description": "Foreground hex color without # (default: 000000)",
            "schema": {
              "type": "string",
              "default": "000000"
            }
          },
          {
            "name": "bg_color",
            "in": "query",
            "required": false,
            "description": "Background hex color without # or transparent",
            "schema": {
              "type": "string",
              "default": "ffffff"
            }
          },
          {
            "name": "rotate",
            "in": "query",
            "required": false,
            "description": "Rotation angle in degrees",
            "schema": {
              "type": "integer",
              "enum": [
                0,
                90,
                180,
                270
              ],
              "default": 0
            }
          },
          {
            "name": "width",
            "in": "query",
            "required": false,
            "description": "Target render width in pixels",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "height",
            "in": "query",
            "required": false,
            "description": "Target render height in pixels",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "bearer",
            "in": "query",
            "required": false,
            "description": "Bearer bar configuration for 1D packaging symbols",
            "schema": {
              "type": "string",
              "enum": [
                "none",
                "top_bottom",
                "frame",
                "top",
                "bottom"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful barcode render",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string",
                  "example": "<svg ...></svg>"
                }
              },
              "application/postscript": {
                "schema": {
                  "type": "string",
                  "example": "%!PS-Adobe-3.0 EPSF-3.0 ..."
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatrixResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input or unencodable character set",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Render barcode via JSON payload",
        "description": "Submit encoding parameters via JSON body for enterprise batch or complex payloads.",
        "operationId": "renderBarcodePost",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful barcode render",
            "content": {
              "image/svg+xml": {},
              "application/postscript": {},
              "application/pdf": {},
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatrixResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RenderRequest": {
        "type": "object",
        "required": [
          "format",
          "content"
        ],
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "qr_code",
              "code_128",
              "data_matrix",
              "pdf_417",
              "aztec",
              "maxicode",
              "micro_qr",
              "rmqr",
              "dmre",
              "gs1_datamatrix",
              "gs1_qrcode",
              "gs1_digital_link_qr",
              "gs1_digital_link_datamatrix",
              "micro_pdf417",
              "code128a",
              "code128b",
              "code128c",
              "gs1_128",
              "ean_13",
              "gtin_13",
              "isbn",
              "ean_8",
              "gtin_8",
              "upc_a",
              "gtin_12",
              "upc_e",
              "itf",
              "itf_14",
              "gtin_14",
              "sscc",
              "code_39",
              "code_93",
              "codabar",
              "s10",
              "msi",
              "msi10",
              "msi11",
              "msi1010",
              "msi1110",
              "usps_imb",
              "usps_impb",
              "rm4scc",
              "mailmark_4state",
              "mailmark_c",
              "mailmark_l",
              "mailmark_2d",
              "mailmark_2d_7",
              "mailmark_2d_9",
              "mailmark_2d_29",
              "auspost",
              "auspost2n",
              "auspost2c",
              "auspost3n",
              "auspost3c",
              "auspostnull",
              "kix",
              "japanpost",
              "dpd",
              "dpd_aztec",
              "dpd_elabel",
              "upca_composite",
              "upce_composite",
              "ausredirect",
              "ausreply",
              "ausroute",
              "aztecrune",
              "bc412",
              "c25iata",
              "c25ind",
              "c25logic",
              "c25standard",
              "cepnet",
              "channelcode",
              "codablockf",
              "code11",
              "code128ab",
              "code16k",
              "code32",
              "code39extended",
              "code49",
              "codeone",
              "daft",
              "databarexpanded",
              "databarexpandedcomposite",
              "databarexpandedstacked",
              "databarexpandedstackedcomposite",
              "databarlimited",
              "databarlimitedcomposite",
              "databaromni",
              "databaromnicomposite",
              "databaromnistacked",
              "databaromnistackedcomposite",
              "databarstacked",
              "databarstackedcomposite",
              "datamatrixmacro05",
              "datamatrixmacro06",
              "dotcode",
              "dpident",
              "dpleit",
              "dppostmatrix",
              "dxfilmedge",
              "ean13composite",
              "ean14",
              "ean2",
              "ean5",
              "ean8composite",
              "epcqr",
              "fim",
              "flattermarken",
              "gridmatrix",
              "gs1128composite",
              "hanxin",
              "hibcaztec",
              "hibccodablockf",
              "hibccode128",
              "hibccode39",
              "hibcdatamatrix",
              "hibcmicropdf417",
              "hibcpdf417",
              "hibcqr",
              "isbt128",
              "ismn",
              "issn",
              "italianpostal",
              "koreapost",
              "logmars",
              "ntin",
              "pharmacode",
              "pharmacodetwotrack",
              "planet",
              "plessey",
              "postnet",
              "ppn",
              "premiumadress",
              "pzn",
              "pzn7",
              "responseplus",
              "swissqr",
              "telepen",
              "telepennumeric",
              "upnqr",
              "vin",
              "zatcaqr"
            ],
            "description": "Barcode symbology identifier"
          },
          "content": {
            "type": "string",
            "description": "Payload string to encode"
          },
          "output": {
            "type": "string",
            "enum": [
              "svg",
              "eps",
              "pdf",
              "matrix"
            ],
            "default": "svg"
          },
          "auto_complete_check_digit": {
            "type": "boolean",
            "default": false
          },
          "color": {
            "type": "string",
            "example": "#000000"
          },
          "bg_color": {
            "type": "string",
            "example": "#ffffff"
          },
          "rotate": {
            "type": "integer",
            "enum": [
              0,
              90,
              180,
              270
            ],
            "default": 0
          },
          "width": {
            "type": "integer"
          },
          "height": {
            "type": "integer"
          },
          "bearer": {
            "type": "string",
            "enum": [
              "none",
              "top_bottom",
              "frame"
            ]
          }
        }
      },
      "MatrixResponse": {
        "type": "object",
        "required": [
          "width",
          "height",
          "matrix"
        ],
        "properties": {
          "width": {
            "type": "integer",
            "description": "Module count in horizontal dimension"
          },
          "height": {
            "type": "integer",
            "description": "Module count in vertical dimension"
          },
          "matrix": {
            "type": "array",
            "description": "2D array of boolean values where true represents a dark module",
            "items": {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          }
        }
      }
    }
  }
}
