Template gallery / shipping-label

shipping-label

4x6 in. thermal shipping label: carrier band, service level, from/to blocks, weight and dimensions, routing code and a Code 39 barcode drawn from a width pattern (no image fetch).

chromium default PDF 15 top-level fields 1 unit per page

Rendered preview of the shipping-label template
Rendered by Galley from the example payload below, at 384px wide , scale 2.

Fields

The full JSON Schema is below. Required fields are marked; anything missing comes back as a 422 naming the path, the expected type and a value that would be accepted.

Field Type Required Description
carrier string required
service_class string optional
service_code string optional The short code in the top-right band.
ship_date string (date) optional
weight string optional Printed as given, units included.
dimensions string optional
routing_code string optional Large sort code above the barcode. Defaults to the destination postal code.
zone string optional
sort_code string optional
order_number string optional
reference string optional
from object { name, address1, address2, city, … } required
to object { name, company, address1, address2, … } required
tracking object { number } required
barcode object { pattern, module } optional Bars are drawn from a width pattern so the label needs no image fetch. Leave `pattern` out and the tracking number prints in a boxed monospace field instead.

Default render options

Applied unless you override them. Options are part of the cache key.

margin "0"
print_background true

Example payload

This exact object renders the preview above. It is also what the API echoes back in a validation error, so an agent can repair a payload without a round trip to the docs.

example.jsonjson
{
  "carrier": "Atlantic Freight",
  "service_class": "2-Day Air",
  "service_code": "2DA",
  "ship_date": "2026-09-16",
  "weight": "14.2 lb",
  "dimensions": "18 x 14 x 10 in",
  "routing_code": "787-04",
  "zone": "5",
  "sort_code": "AUS-04-B",
  "order_number": "SO-44120",
  "reference": "PO-24118",
  "from": {
    "name": "Galley Supply Co.",
    "address1": "2727 Jean Lafitte Dr",
    "address2": "Suite 200",
    "city": "Fernandina Beach",
    "state": "FL",
    "postal_code": "32034",
    "country": "US"
  },
  "to": {
    "name": "Lena Ortiz",
    "company": "Acme Robotics",
    "address1": "100 Market St",
    "address2": "Floor 9, Dock B",
    "city": "Austin",
    "state": "TX",
    "postal_code": "78701",
    "country": "US",
    "phone": "(512) 555-0163"
  },
  "tracking": {
    "number": "1Z999AA10123456784"
  },
  "barcode": {
    "pattern": "1311313111311311113113313111111133113111113311311111331131113111131131311113113131131111311113313111311311113111331111313133111111111331113131133111111133311111111311313131131131111113311131131131311",
    "module": 1.1
  }
}

Render it

With an API keyshell
curl -sS https://api.galleyrender.com/v1/render \
  -H "Authorization: Bearer $GALLEY_API_KEY" \
  -H 'content-type: application/json' \
  -d '{
  "template": "shipping-label@1",
  "format": "pdf",
  "data": {
    "carrier": "Atlantic Freight",
    "service_class": "2-Day Air",
    "service_code": "2DA",
    "ship_date": "2026-09-16",
    "weight": "14.2 lb",
    "dimensions": "18 x 14 x 10 in",
    "routing_code": "787-04",
    "zone": "5",
    "sort_code": "AUS-04-B",
    "order_number": "SO-44120",
    "reference": "PO-24118",
    "from": {
      "name": "Galley Supply Co.",
      "address1": "2727 Jean Lafitte Dr",
      "address2": "Suite 200",
      "city": "Fernandina Beach",
      "state": "FL",
      "postal_code": "32034",
      "country": "US"
    },
    "to": {
      "name": "Lena Ortiz",
      "company": "Acme Robotics",
      "address1": "100 Market St",
      "address2": "Floor 9, Dock B",
      "city": "Austin",
      "state": "TX",
      "postal_code": "78701",
      "country": "US",
      "phone": "(512) 555-0163"
    },
    "tracking": {
      "number": "1Z999AA10123456784"
    },
    "barcode": {
      "pattern": "1311313111311311113113313111111133113111113311311111331131113111131131311113113131131111311113313111311311113111331111313133111111111331113131133111111133311111111311313131131131111113311131131131311",
      "module": 1.1
    }
  }
}'
With no API key, over MCPshell
# No API key. The first call mints a 50-render trial.
curl -sS https://mcp.galleyrender.com/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "render",
      "arguments": {
        "template": "shipping-label",
        "format": "pdf",
        "data": { … see the example payload above … }
      }
    }
  }'

Pin the version — shipping-label@1 — in anything you ship. Publishing a new version never changes an old one. Render endpoint reference →

Try a free tool

Renders the example payload on the production service. No account, no key.

JSON Schema

schema.json (15 top-level properties)
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Shipping label",
  "description": "4x6 in. thermal label. Render at page size 4in x 6in with zero margin, or as a PNG at 384x576 (96dpi) / 1200x1800 (300dpi).",
  "type": "object",
  "required": [
    "carrier",
    "from",
    "to",
    "tracking"
  ],
  "additionalProperties": true,
  "properties": {
    "carrier": {
      "type": "string",
      "examples": [
        "Atlantic Freight"
      ]
    },
    "service_class": {
      "type": "string",
      "default": "Ground",
      "examples": [
        "2-Day Air"
      ]
    },
    "service_code": {
      "type": "string",
      "default": "GND",
      "description": "The short code in the top-right band.",
      "examples": [
        "2DA"
      ]
    },
    "ship_date": {
      "type": "string",
      "format": "date",
      "examples": [
        "2026-09-16"
      ]
    },
    "weight": {
      "type": "string",
      "description": "Printed as given, units included.",
      "examples": [
        "14.2 lb"
      ]
    },
    "dimensions": {
      "type": "string",
      "examples": [
        "18 x 14 x 10 in"
      ]
    },
    "routing_code": {
      "type": "string",
      "description": "Large sort code above the barcode. Defaults to the destination postal code.",
      "examples": [
        "78701"
      ]
    },
    "zone": {
      "type": "string",
      "examples": [
        "5"
      ]
    },
    "sort_code": {
      "type": "string",
      "examples": [
        "AUS-04-B"
      ]
    },
    "order_number": {
      "type": "string",
      "examples": [
        "SO-44120"
      ]
    },
    "reference": {
      "type": "string",
      "examples": [
        "PO-24118"
      ]
    },
    "from": {
      "type": "object",
      "required": [
        "name",
        "address1",
        "city",
        "state",
        "postal_code"
      ],
      "properties": {
        "name": {
          "type": "string",
          "examples": [
            "Galley Supply Co."
          ]
        },
        "address1": {
          "type": "string",
          "examples": [
            "2727 Jean Lafitte Dr"
          ]
        },
        "address2": {
          "type": "string",
          "examples": [
            "Suite 200"
          ]
        },
        "city": {
          "type": "string",
          "examples": [
            "Fernandina Beach"
          ]
        },
        "state": {
          "type": "string",
          "examples": [
            "FL"
          ]
        },
        "postal_code": {
          "type": "string",
          "examples": [
            "32034"
          ]
        },
        "country": {
          "type": "string",
          "examples": [
            "US"
          ]
        }
      }
    },
    "to": {
      "type": "object",
      "required": [
        "name",
        "address1",
        "city",
        "state",
        "postal_code"
      ],
      "properties": {
        "name": {
          "type": "string",
          "examples": [
            "Lena Ortiz"
          ]
        },
        "company": {
          "type": "string",
          "examples": [
            "Acme Robotics"
          ]
        },
        "address1": {
          "type": "string",
          "examples": [
            "100 Market St"
          ]
        },
        "address2": {
          "type": "string",
          "examples": [
            "Floor 9, Dock B"
          ]
        },
        "city": {
          "type": "string",
          "examples": [
            "Austin"
          ]
        },
        "state": {
          "type": "string",
          "examples": [
            "TX"
          ]
        },
        "postal_code": {
          "type": "string",
          "examples": [
            "78701"
          ]
        },
        "country": {
          "type": "string",
          "examples": [
            "US"
          ]
        },
        "phone": {
          "type": "string",
          "examples": [
            "(512) 555-0163"
          ]
        }
      }
    },
    "tracking": {
      "type": "object",
      "required": [
        "number"
      ],
      "properties": {
        "number": {
          "type": "string",
          "description": "Printed under the bars as human-readable text.",
          "examples": [
            "1Z999AA10123456784"
          ]
        }
      }
    },
    "barcode": {
      "type": "object",
      "description": "Bars are drawn from a width pattern so the label needs no image fetch. Leave `pattern` out and the tracking number prints in a boxed monospace field instead.",
      "properties": {
        "pattern": {
          "type": "string",
          "description": "Element widths in modules, alternating bar, space, bar, space… starting with a bar. For Code 39 that is 1 for narrow and 3 for wide, with a single narrow space between characters.",
          "examples": [
            "13111311131113111311"
          ]
        },
        "module": {
          "type": "number",
          "minimum": 0.25,
          "default": 1,
          "description": "Width of one module in CSS px.",
          "examples": [
            1.4
          ]
        }
      }
    }
  }
}