# List templates

`opensend templates list`

The templates of the workspace, newest first, by status and search.

Needs the scope: `templates:read`

## Flags

- `--q` (string): Text to search for. Only items that contain it are returned. Up to 40 characters.
- `--limit` (integer): How many items to return, from 1 to 100. Without it you get 25.
- `--offset` (integer): How many items to skip. Use it with `limit` to read the next page. Default: `0`.
- `--after` (string): The id of the last item you have. The answer starts with the item that follows it, which reads a long list without skipping or repeating when it changes meanwhile. Up to 64 characters.
- `--before` (string): The id of the first item you have. The answer ends with the item just before it. Give this or `after`, not both. Up to 64 characters.
- `--status` (string): Only templates in this state: `draft` or `published`. One of: `draft`, `published`.

## Returns

The command prints the answer: as JSON when its output goes to a file or another program, and as a table or a list of fields in a terminal. When the API refuses, the error goes to the error stream and the command ends with a code that names the failure. [Output and scripts](https://opensend.sh/docs/scripting) lists the codes.

- `object` ("list"): Always `list`.
- `data` (object[]): The items on this page.
- `data[].object` ("template"): Always `template`.
- `data[].id` (string): The id of the template.
- `data[].name` (string): The name of the template.
- `data[].alias` (string): A short name of your own to send with in place of the id, such as `welcome`.
- `data[].status` (string): `draft` until it is published, `published` after that. One of: `draft`, `published`.
- `data[].subject` (string): The subject line, as last saved.
- `data[].html` (string): The HTML, as last saved.
- `data[].text` (string | null): The plain text version, as last saved, or `null` when it has none.
- `data[].from` (string): The sender an email built from it gets when the send names none. Empty for none.
- `data[].replyTo` (string): The address replies go to when the send names none. Empty to leave it to the default of the workspace.
- `data[].defaults` (Record<string, string>): A value for a variable, by name, used when a send gives none for it.
- `data[].design` (object | null): The blocks the template is built from, or `null` for a template written as HTML. When it is set, `html` and `text` are made from it.
- `data[].design.preview` (string, optional): The line a mail app shows beside the subject before the message is opened. `{{NAME}}` marks a variable.
- `data[].design.style` (Record<string, string | number>, optional): CSS for the whole message, by property name. A background colour fills the page, a `maxWidth` centres the content, and `fontFamily`, `fontSize` and `lineHeight` are what text gets unless a block sets its own.
- `data[].design.dark` (Record<string, string | number>, optional): Colours for the whole message for a reader in dark mode, by property name: `backgroundColor` fills the page, and `color` and `borderColor` go to the content. It takes: color, backgroundColor, borderColor.
- `data[].design.fonts` (object[], optional): Fonts the message loads from an address of your own, 4 at most. A block or the page uses one by naming its `family` in `fontFamily`, and gets its `fallback` added for the mail apps that load no web fonts.
- `data[].design.fonts[].family` (string): The name of the font, such as `Inter`. A block or the page uses the font by naming it in `fontFamily`.
- `data[].design.fonts[].fallback` (string): The fonts to use where this one does not load, the one you want most first, such as `Helvetica, Arial, sans-serif`. Pick fonts every device has.
- `data[].design.fonts[].url` (string): The full `https` address of the font file, on your own domain or a CDN. It cannot be a variable.
- `data[].design.fonts[].format` (string): The format of the file: `woff2`, `woff`, `truetype` or `opentype`. One of: `woff2`, `woff`, `truetype`, `opentype`.
- `data[].design.fonts[].weight` (number | string, optional): The weight this file holds: a number from 100 to 900 in hundreds, or `normal` or `bold`. Without it, 400.
- `data[].design.fonts[].style` (string, optional): The style this file holds: `normal` or `italic`. Without it, `normal`. One of: `normal`, `italic`.
- `data[].design.css` (string, optional): CSS of your own for the whole message, up to 20000 characters. It goes into the head after the rules the design makes, and reaches a block by its `className`. A rule that has to beat the style a block carries needs `!important`. `</style`, `@import`, `expression(`, `javascript:`, `behavior:`, `-moz-binding` are refused.
- `data[].design.body` (object[]): The blocks of the message, from top to bottom.
- `data[].design.body[].kind` (string): What the block is. `Section`, `Row`, `Column` and `Container` hold other blocks. `Text`, `Heading`, `Button`, `Link`, `Markdown`, `CodeBlock` and `CodeInline` hold text. `Img` is an image, `Hr` a line and `Html` custom code: HTML of your own that goes into the message as it is. One of: `Section`, `Row`, `Column`, `Container`, `Text`, `Heading`, `Button`, `Link`, `Img`, `Hr`, `Markdown`, `CodeBlock`, `CodeInline`, `Html`.
- `data[].design.body[].id` (string): The id of the block. No other block of the design has it.
- `data[].design.body[].style` (Record<string, string | number>, optional): CSS for the block, by property name, such as `{ "fontSize": "16px", "color": "#111111" }`. Only properties that work in mail are taken.
- `data[].design.body[].align` (string, optional): Where the block sits across its line: `left`, `center` or `right`. One of: `left`, `center`, `right`.
- `data[].design.body[].className` (string, optional): Class names for the block, one or several with one space between them, such as `hero wide`, 200 characters at most. The `css` of the design reaches the block by them. A name cannot start with `r-`.
- `data[].design.body[].only` (string, optional): The one kind of screen the block shows on: `desktop` hides it on a phone, and `phone` shows it on a phone and nowhere else. Without it, the block shows everywhere. One of: `desktop`, `phone`.
- `data[].design.body[].phone` (Record<string, string | number>, optional): CSS that takes the place of the style of the block on a phone, a screen up to 600 pixels wide, by property name, such as `{ "fontSize": "14px", "padding": "12px" }`. It takes: fontSize, lineHeight, textAlign, padding, paddingTop, paddingRight, paddingBottom, paddingLeft, margin, marginTop, marginRight, marginBottom, marginLeft, width, maxWidth, height.
- `data[].design.body[].dark` (Record<string, string | number>, optional): Colours that take the place of the ones of the block for a reader in dark mode, by property name, such as `{ "color": "#f4f4f5" }`. It takes: color, backgroundColor, borderColor.
- `data[].design.body[].text` (string, optional): The words of a block that holds text, up to 20000 characters. `{{NAME}}` marks a variable. A `Markdown` block takes Markdown here, a `CodeBlock` takes the code and an `Html` block takes its HTML, up to 60000 characters.
- `data[].design.body[].children` (unknown[], optional): The blocks inside a `Section`, a `Row`, a `Column` or a `Container`, each shaped like a block of `body`. A `Row` takes `Column` blocks only, and a `Column` sits in a `Row` only.
- `data[].design.body[].href` (string, optional): Where a `Button` or a `Link` leads: a full address, or one variable as the whole value, such as `{{URL}}`.
- `data[].design.body[].target` (string, optional): Where the link opens: `_blank` for a new tab or `_self`. Without it, `_blank`. One of: `_blank`, `_self`.
- `data[].design.body[].src` (string, optional): The address of the picture of an `Img`: a full address, or one variable as the whole value.
- `data[].design.body[].alt` (string, optional): What the picture of an `Img` shows, in words, for someone who cannot see it.
- `data[].design.body[].width` (string | number, optional): The width of an `Img` or a `Column`: a number of pixels, or a length such as `50%`.
- `data[].design.body[].height` (string | number, optional): The height of an `Img`: a number of pixels, or a length.
- `data[].design.body[].valign` (string, optional): Where the content of a `Column` sits: `top`, `middle` or `bottom`. One of: `top`, `middle`, `bottom`.
- `data[].design.body[].as` (string, optional): The level of a `Heading`, from `h1` to `h6`. Without it, `h1`. One of: `h1`, `h2`, `h3`, `h4`, `h5`, `h6`.
- `data[].design.body[].language` (string, optional): The language of a `CodeBlock`, such as `typescript` or `bash`. One it does not know is shown as plain text.
- `data[].design.body[].theme` (string, optional): The colours of a `CodeBlock`: `oneDark`, `oneLight`, `dracula`, `nord`, `vscDarkPlus`, `vs`, `ghcolors` or `materialLight`. Without it, `oneDark`.
- `data[].design.body[].lineNumbers` (boolean, optional): Whether a `CodeBlock` numbers its lines.
- `data[].design.body[].stack` (boolean, optional): `true` puts the columns of a `Row` under each other on a phone. Only a `Row` takes it.
- `data[].layout` (string): How its preview is drawn in the dashboard. One of: `start`, `center`, `split`.
- `data[].variables` (string[]): The names of the `{{NAME}}` variables in the subject, the HTML and the plain text.
- `data[].version` (integer): How many times it was published. 0 for a template that never was.
- `data[].publishedAt` (string | null): When it was last published, or `null`.
- `data[].changed` (boolean): Whether it was saved after it was last published. Emails use the published version until you publish again.
- `data[].updatedAt` (string): When it was last saved.
- `data[].createdAt` (string): When the template was made.
- `total` (integer): How many items match in all, on every page together.
- `hasMore` (boolean): Whether more items follow this page.

## Example

CLI:

```bash
opensend templates list --status draft
```

Answer:

```json
{
  "object": "list",
  "data": [
    {
      "object": "template",
      "id": "tmpl_02",
      "name": "Weekly digest",
      "alias": "weekly-digest",
      "status": "draft",
      "subject": "Your week at a glance",
      "html": "<p>{{SUMMARY}}</p>",
      "text": null,
      "from": "",
      "replyTo": "",
      "defaults": {},
      "design": null,
      "layout": "split",
      "variables": [
        "SUMMARY"
      ],
      "version": 0,
      "publishedAt": null,
      "changed": false,
      "updatedAt": "2026-11-05T09:30:00.000Z",
      "createdAt": "2026-11-05T09:30:00.000Z"
    },
    {
      "object": "template",
      "id": "tmpl_01",
      "name": "Trial ending",
      "alias": "trial-ending",
      "status": "draft",
      "subject": "Your trial ends in {{DAYS}} days",
      "html": "<p>Pick a plan to keep sending.</p>",
      "text": null,
      "from": "",
      "replyTo": "",
      "defaults": {},
      "design": null,
      "layout": "start",
      "variables": [
        "DAYS"
      ],
      "version": 0,
      "publishedAt": null,
      "changed": false,
      "updatedAt": "2026-10-29T09:30:00.000Z",
      "createdAt": "2026-10-29T09:30:00.000Z"
    }
  ],
  "total": 2,
  "hasMore": false
}
```
