# `generate_label_sheet` — Generate Printable Barcode / QR Label Sheet

> Part of [Barcode, QR & Logistics Label Sheet Edge API](https://barcode-pass.apikeg.com/llms.txt) (`com.apikeg/barcode-pass`)

Batch-encodes up to 200 QR or 1D barcodes into print-ready @page HTML/SVG label sheets formatted for Avery 5160 (30-up US Letter), Zebra 4x6 shipping thermal, or Zebra 2x1 retail/bin tags.

**Why call instead of DIY:** Replaces brittle PDF/headless-Chrome pipelines with zero-margin print-accurate @page CSS + inline crisp vector SVGs for up to 200 warehouse or retail labels in a single call.

- **REST Endpoint:** `POST https://barcode-pass.apikeg.com/v1/generate-label-sheet`
- **MCP Server:** `https://barcode-pass.apikeg.com/mcp` (tool: `generate_label_sheet`)
- **Pricing:** $0.002 base (up to $0.008 max ($0.002 base + $0.002 per 50 rendered labels, capped at $0.008 for up to 200 labels), x402 variable settlement)
- **Free Dry-Run:** `POST https://barcode-pass.apikeg.com/v1/generate-label-sheet?dry_run=true`

## Input JSON Schema
```json
{
  "type": "object",
  "properties": {
    "template": {
      "type": "string",
      "enum": [
        "avery_5160",
        "zebra_4x6",
        "zebra_2x1"
      ],
      "default": "avery_5160",
      "description": "Print stock layout: 'avery_5160' (3x10 US Letter 8.5x11in, 30/page), 'zebra_4x6' (4x6in shipping/pallet thermal), or 'zebra_2x1' (2x1in retail/shelf thermal)."
    },
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "qr",
              "code128",
              "gs1_128",
              "ean13",
              "upca"
            ],
            "description": "Symbology format: 'qr' (ISO 18004 v1-v10 UTF-8), 'code128' (Set B/C auto-packed), 'gs1_128' (GS1 Application Identifiers with FNC1), 'ean13' (GTIN-13), or 'upca' (GTIN-12)."
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "description": "Barcode or QR payload for this label."
          },
          "title": {
            "type": "string",
            "maxLength": 120,
            "description": "Primary product, bin, pallet, or attendee title printed on the label."
          },
          "subtitle": {
            "type": "string",
            "maxLength": 120,
            "description": "Secondary line (e.g. price '$24.99', lot/expiry, or warehouse location)."
          },
          "sku": {
            "type": "string",
            "maxLength": 64,
            "description": "Optional SKU or internal item code."
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "maximum": 200,
            "default": 1,
            "description": "Number of identical copies of this label to emit (total sheet labels <= 200)."
          },
          "errorCorrection": {
            "type": "string",
            "enum": [
              "L",
              "M",
              "Q",
              "H"
            ],
            "default": "M",
            "description": "QR Code Reed-Solomon error correction level: L (~7%), M (~15%), Q (~25%), H (~30%)."
          }
        },
        "required": [
          "format",
          "value"
        ],
        "additionalProperties": false,
        "description": "Single barcode/QR label entry within a print sheet batch."
      },
      "minItems": 1,
      "maxItems": 200,
      "description": "1 to 200 barcode/QR label definitions to render onto print-ready sheets."
    },
    "startOffset": {
      "type": "integer",
      "minimum": 0,
      "maximum": 29,
      "default": 0,
      "description": "Blank cells to skip on page 1 for partially used Avery 5160 sheets."
    },
    "includeBarcodeText": {
      "type": "boolean",
      "description": "Render human-readable text inside each barcode SVG (defaults to true for 1D, false for QR)."
    },
    "includePng": {
      "type": "boolean",
      "default": false,
      "description": "Also include lossless base64 PNGs alongside each label's inline SVG."
    },
    "foreground": {
      "type": "string",
      "maxLength": 16,
      "description": "Foreground bar/module hex color (#RGB or #RRGGBB, default '#000000')."
    },
    "background": {
      "type": "string",
      "maxLength": 16,
      "description": "Background hex color (#RGB or #RRGGBB, default '#FFFFFF')."
    }
  },
  "required": [
    "items"
  ],
  "additionalProperties": false
}
```

## Examples
### Avery 5160 retail SKU barcode sheet
```bash
curl -X POST "https://barcode-pass.apikeg.com/v1/generate-label-sheet" \
  -H "Content-Type: application/json" \
  -d '{"template":"avery_5160","startOffset":0,"items":[{"format":"ean13","value":"4006381333931","title":"Neon Highlighter Yellow","subtitle":"$3.49","sku":"HL-YLW-01","quantity":15},{"format":"upca","value":"036000291452","title":"Cotton Tissue Pack","subtitle":"$5.99","sku":"CT-PK-12","quantity":15}]}'
```
Expected output: 1 US Letter page (30 labels) with inline EAN-13/UPC-A SVGs and print-ready @page HTML.
