Render

create_template

Create a new template at version 1 from an HTML document with Liquid expressions, plus a JSON Schema for its data. Use this when nothing in list_templates fits. The name must be free on this account — publishing a change to an existing template is `update_template`, not this. Free, but each plan keeps a limited number of templates of your own (the starter library never counts): at the limit this returns `plan_required` with how many the account has, and `update_template` still works.

Remote muellermr/galley-render

Remote (network-hosted)

Other tools also called create_template? See providers with this name

Input Schema


            {
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{0,62}$",
      "examples": [
        "invoice",
        "delivery-note"
      ],
      "description": "Template name: lowercase letters, digits, dot, dash or underscore, 1-63 characters. Unique per account. Versions are separate — do not put `@1` here."
    },
    "engine": {
      "enum": [
        "chromium",
        "satori"
      ],
      "type": "string",
      "description": "Rendering engine. `chromium` (default) is full HTML and CSS and is required for PDF. `satori` is a fast PNG path for simple flexbox card layouts — no page breaks, no floats, no external CSS — and costs us less, so prefer it for OG images and social cards."
    },
    "schema": {
      "type": "object",
      "examples": [
        {
          "type": "object",
          "required": [
            "title"
          ],
          "properties": {
            "title": {
              "type": "string",
              "description": "Headline, one line"
            }
          }
        }
      ],
      "description": "JSON Schema (2020-12) for the `data` payload this template accepts. Strongly recommended: it is what turns a bad payload into a field-level error with a path, an expected type and a working example instead of a blank page. Use `required` and give each property a `description`.",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    },
    "source": {
      "type": "string",
      "examples": [
        "<html><body><h1>{{ title }}</h1></body></html>"
      ],
      "minLength": 1,
      "description": "One self-contained HTML document with inline CSS and Liquid expressions (`{{ customer.name }}`, `{% for line in line_items %}`). No file includes: everything the render needs must be in this string, or at a public https URL. Two extra filters ship by default: `money` and `date_medium`. For a PDF, use `@page { size: Letter; margin: 18mm }` to control pagination."
    },
    "example": {
      "description": "A payload that renders correctly. It is echoed back in validation errors, so include one."
    },
    "message": {
      "type": "string",
      "description": "Change note for this version, like a commit message."
    },
    "options": {
      "type": "object",
      "properties": {
        "css": {
          "type": "string",
          "description": "Extra CSS appended after the template's own styles."
        },
        "scale": {
          "type": "number",
          "maximum": 3,
          "minimum": 0.1,
          "description": "Device pixel ratio for png/jpg, 0.1-3. Use 2 for retina."
        },
        "width": {
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Viewport width in px for png/jpg. Default 1200.",
          "exclusiveMinimum": 0
        },
        "height": {
          "type": "integer",
          "maximum": 9007199254740991,
          "description": "Viewport height in px for png/jpg. Default 630.",
          "exclusiveMinimum": 0
        },
        "margin": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "object",
              "properties": {
                "top": {
                  "type": [
                    "string",
                    "number"
                  ]
                },
                "left": {
                  "type": [
                    "string",
                    "number"
                  ]
                },
                "right": {
                  "type": [
                    "string",
                    "number"
                  ]
                },
                "bottom": {
                  "type": [
                    "string",
                    "number"
                  ]
                }
              }
            }
          ],
          "description": "PDF margins, CSS lengths in `in`, `px`, `cm` or `mm`: `18mm`, or per side. A bare number is px."
        },
        "quality": {
          "type": "integer",
          "maximum": 100,
          "minimum": 1,
          "description": "jpg only, 1-100. Default 90."
        },
        "full_page": {
          "type": "boolean",
          "description": "png/jpg: capture the whole document instead of the viewport."
        },
        "landscape": {
          "type": "boolean",
          "description": "PDF only. Default false."
        },
        "page_size": {
          "type": "string",
          "description": "PDF page size: `Letter`, `A4`, `Legal`, or `210mm x 297mm`."
        },
        "background": {
          "type": "string",
          "description": "CSS colour painted under the document, e.g. `#ffffff`."
        },
        "on_blocked_asset": {
          "enum": [
            "fail",
            "skip"
          ],
          "type": "string",
          "description": "What to do when an image or font the template asks for is refused by the egress policy or fails to fetch. `fail` (the default) fails the render with `asset_blocked` naming the URL; `skip` drops the asset and renders without it. Use `skip` only for decorative assets."
        },
        "print_background": {
          "type": "boolean",
          "description": "PDF: print background colours and images. Default true."
        }
      },
      "description": "Render options, merged over the template's own defaults. Options are part of the cache key, so two calls that differ only here are two different renders."
    },
    "description": {
      "type": "string",
      "description": "One line on what this template is for. Shown in list_templates."
    },
    "expected_pages": {
      "type": "integer",
      "maximum": 2000,
      "minimum": 1,
      "description": "How many PDF pages a typical payload renders. Default 1. This is the estimate the free tier and the spend cap are checked against before the render starts, so a template that runs to several pages must say so or a render that cannot fit the allowance will be started and then go over. It is not a limit: the render is billed on the pages it actually produced."
    }
  }
}
          

Provider

Render →