Skip to content

postsale templates

Manage label, packing-slip, invoice and email templates as records: list, copy, move and back them up; author them in the app with the Liquid guide.

Updated September 3, 20261 min readPostsale CLI

Templates are the documents Postsale prints or sends for an order or a shipment: shipping labels, packing slips, invoices, and emails. Each one is a Liquid document, the same templating language the web app's editor uses, stored with its settings as a template record. The CLI manages those records: it lists, reads, creates, updates, moves, and deletes them, and it manages the folders they live in.

Authoring a template is still best done in the web app, where the visual editor previews the result against real orders. Use the CLI to back templates up, copy or rename them, move them between folders, and push a template you have already proven in the editor to another account or folder.

Note

Template commands need a login session. On an API key they answer api_key_unsupported (exit 100), whatever the key's permissions are.

Before you author a template

The help center already teaches how to build one. Read these first, in the web app's terms:

Subcommands

CommandSafetyNotes
list / get <id>readget returns the full record, including the Liquid source in data
create / update <id>write--input <file> or --json <body>; the body fields are below
move <id>write--folder-id <folder_id>
delete <id>destructiverequires --yes; see Restore Templates for what can be recovered in the app
folders list/create/update/deletedelete is destructivefolders group templates in the app's template list
bash
postsale templates list
postsale templates get <id>
postsale templates folders list
postsale templates move <id> --folder-id <folder_id>
postsale templates delete <id> --yes

What a template body contains

create and update take the same JSON body the API does. These are the fields, from the CLI's schema (postsale schema templates.create); the three marked required must be present on create.

FieldRequiredMeaning
nameyesThe name shown in the app
descriptionyesA short description shown with the name
datayesThe template itself: the Liquid document
file_typeWhat the template renders to: html, pdf, csv, txt, or json
output_perOne document per order or per shipment
dimensionsPage size for printed documents
marginPage margins for printed documents
folderThe folder the template lives in (move changes it too)
built_in_idWhich built-in template this one was copied from
sync_with_built_inKeep following the built-in's updates instead of your own edits
disabledHide the template from use without deleting it

The CLI sends the body as you give it. It does not check the Liquid, so a template that never rendered in the app's editor has never been proven; preview it there before you rely on it.

Copy a template with the CLI

Here's how to duplicate a template you have already tested, for example into another folder:

  1. Read the original and save it:
bash
postsale templates get <id> > template.json
  1. Edit template.json: change name, drop id, created_at, and updated_at, and keep data as it is.

  2. Create the copy:

bash
postsale templates create --input template.json

Success looks like a new template with its own id and the same data, visible in the app's template list.

Schema

templates.* and templates.folders.* (see schema slugs)

Agent tools

list_templates, get_template, update_template, delete_template

Additional Reading