> ## Documentation Index
> Fetch the complete documentation index at: https://apidoc.mailercloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Templates

> Get a list of your saved email templates.

By default the response returns only template metadata (id, name, type, status, dates) — fast and small, ideal for building a template picker or dashboard.

If you also want the full template body (HTML, AMP, and plain text) inlined in the same response, set `include_content: true`. This is useful when you need to render or display the templates yourself without making a separate `GET /templates/details/{id}` call for each one.

You can filter, sort, search, and paginate through your templates:

- Filter by template type (`html`, `amp`, or both)
- Filter by status (`saved`, `draft`, or both)
- Filter by category
- Search by template name (case-insensitive substring match)
- Sort by name, created date, or modified date — ascending or descending
- Paginate with `page` and `limit`

**Response limits when `include_content: true`:**

Because template bodies can be large, two safeguards apply when you ask for content:

1. `limit` is capped at 20 templates per response (even if you request more).
2. The total response size is capped at 10 MB.

If the response would exceed the size cap, you'll receive as many templates as fit, and the response will include `truncated: true`. When this happens, fetch the missing templates one at a time using `GET /templates/details/{id}` — the `template_count` field tells you the total number of templates that match your filter so you know how many are missing.



## OpenAPI

````yaml /openapi-v1.json post /templates/list
openapi: 3.1.0
info:
  title: Mailercloud Marketing API
  version: 1.0.0
  description: >-
    Campaigns, contacts, lists, segments, automations, and webhooks for the
    Mailercloud Marketing Platform.
servers:
  - url: https://cloudapi.mailercloud.com/v1
security:
  - apiKey: []
tags:
  - name: Campaigns
  - name: Contacts
  - name: Lists
  - name: Tags
  - name: Segments
  - name: Custom Properties
  - name: Senders
  - name: Templates
  - name: Automations
  - name: Webhooks
  - name: Webforms
  - name: Inbox Tracker
  - name: Account
paths:
  /templates/list:
    post:
      tags:
        - Templates
      summary: List Templates
      description: >-
        Get a list of your saved email templates.


        By default the response returns only template metadata (id, name, type,
        status, dates) — fast and small, ideal for building a template picker or
        dashboard.


        If you also want the full template body (HTML, AMP, and plain text)
        inlined in the same response, set `include_content: true`. This is
        useful when you need to render or display the templates yourself without
        making a separate `GET /templates/details/{id}` call for each one.


        You can filter, sort, search, and paginate through your templates:


        - Filter by template type (`html`, `amp`, or both)

        - Filter by status (`saved`, `draft`, or both)

        - Filter by category

        - Search by template name (case-insensitive substring match)

        - Sort by name, created date, or modified date — ascending or descending

        - Paginate with `page` and `limit`


        **Response limits when `include_content: true`:**


        Because template bodies can be large, two safeguards apply when you ask
        for content:


        1. `limit` is capped at 20 templates per response (even if you request
        more).

        2. The total response size is capped at 10 MB.


        If the response would exceed the size cap, you'll receive as many
        templates as fit, and the response will include `truncated: true`. When
        this happens, fetch the missing templates one at a time using `GET
        /templates/details/{id}` — the `template_count` field tells you the
        total number of templates that match your filter so you know how many
        are missing.
      operationId: list-templates
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: Request body type
          schema:
            type: string
            default: application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                page:
                  type: integer
                  default: 1
                  minimum: 1
                  description: >-
                    Page number (1-indexed). Defaults to 1 when omitted.
                    `page=0` is silently treated as `page=1`. `page * limit >
                    100000` returns 400.
                limit:
                  type: integer
                  default: 10
                  minimum: 10
                  maximum: 100
                  description: >-
                    Maximum rows per page.


                    Minimum: 10

                    Maximum: 100


                    When `include_content=true`, server silently clamps to 20
                    regardless of the requested value.
                template_type:
                  type: string
                  description: >-
                    Comma-separated filter. Allowed tokens: `html`, `amp`.


                    - Omitted or empty: no filter (all types).

                    - `"html"`: HTML templates only (matches every non-AMP row,
                    including legacy Stripo/DnD/plugin types).

                    - `"amp"`: AMP templates only.

                    - `"html,amp"`: both (equivalent to no filter).


                    Whitespace around commas is trimmed. Unknown tokens (e.g.
                    `"plaintext"`) return 400. Trailing comma returns 400.
                status:
                  type: string
                  default: saved
                  description: |-
                    Comma-separated filter. Allowed tokens: `saved`, `draft`.

                    - Omitted or empty: defaults to `"saved"` only.
                    - `"saved"`: published templates.
                    - `"draft"`: in-progress templates.
                    - `"saved,draft"`: both.

                    Unknown tokens return 400.
                category_id:
                  type: integer
                  description: >-
                    Optional. Filter to a single template category. Omitted = no
                    filter (all categories). `0` filters to uncategorized
                    templates only. Negative values return 400. Not echoed back
                    in response rows.


                    Use `GET /v1/templates/categories/list` to enumerate
                    available categories.
                search_name:
                  type: string
                  maxLength: 100
                  description: >-
                    Case-insensitive substring match on template name. Maximum
                    100 characters. Whitespace-only input is treated as no
                    filter. `%` and `_` are escaped before matching (no SQL LIKE
                    wildcard injection).
                sort_field:
                  type: string
                  default: modified_date
                  enum:
                    - name
                    - created_date
                    - modified_date
                  description: >-
                    Field to sort by.


                    Supported values: `name`, `created_date`, `modified_date`.


                    An implicit `id DESC` secondary sort is always applied for
                    stable pagination across rows with tied timestamps.
                sort_order:
                  type: string
                  default: desc
                  enum:
                    - asc
                    - ASC
                    - desc
                    - DESC
                  description: |-
                    Sort direction.

                    Supported values: `asc`, `ASC`, `desc`, `DESC`.
                include_content:
                  type: boolean
                  default: false
                  description: >-
                    When `true`, response rows include `html`, `amp_content`,
                    and `plain_text` fields populated with the full template
                    content. Server-side: `limit` is silently clamped to 20, and
                    the total response is bounded by a 10 MB soft budget. When
                    the budget is exceeded after the first row, remaining rows
                    are skipped and `truncated: true` is set.
            examples:
              Example-1---Default:
                value:
                  page: 1
                  limit: 50
              Example-2---HTML-only--name-asc:
                value:
                  page: 1
                  limit: 100
                  template_type: html
                  sort_field: name
                  sort_order: asc
              Example-3---With-content--one-category:
                value:
                  page: 1
                  limit: 20
                  category_id: 5
                  include_content: true
              Example-4---Search-both-types--drafts-included:
                value:
                  page: 1
                  limit: 50
                  template_type: html,amp
                  status: saved,draft
                  search_name: Welcome
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        template_type:
                          type: string
                          enum:
                            - html
                            - amp
                          description: >-
                            Canonical string token. Legacy DB types 2/3/4
                            (Stripo/DnD/plugin) collapse to `"html"`.
                        status:
                          type: string
                          enum:
                            - saved
                            - draft
                        created_date:
                          type: string
                          description: >-
                            Format: YYYY-MM-DD HH:mm:ss in caller's account
                            timezone.
                        modified_date:
                          type: string
                          description: >-
                            Format: YYYY-MM-DD HH:mm:ss in caller's account
                            timezone.
                        html:
                          type: string
                          description: Only present when `include_content=true`.
                        amp_content:
                          type: string
                          description: >-
                            Only present when `include_content=true`. Empty
                            string for non-AMP rows.
                        plain_text:
                          type: string
                          description: Only present when `include_content=true`.
                  template_count:
                    type: integer
                    description: >-
                      Total matching rows across the entire result set, ignoring
                      pagination AND truncation.
                  truncated:
                    type: boolean
                    description: >-
                      `true` when the response budget engaged and some rows that
                      would otherwise have fit were skipped. Always present in
                      200 responses, even in metadata mode (where it is always
                      `false`).
              examples:
                Example-1---Metadata-mode:
                  value:
                    data:
                      - id: uSZy
                        name: Welcome Email
                        template_type: html
                        status: saved
                        created_date: '2026-06-01 14:32:00'
                        modified_date: '2026-06-01 14:32:00'
                      - id: uuaK
                        name: Spring Promo (AMP)
                        template_type: amp
                        status: saved
                        created_date: '2026-05-28 09:14:00'
                        modified_date: '2026-05-30 11:02:00'
                    template_count: 137
                    truncated: false
                Example-2---With-content--budget-engaged:
                  value:
                    data:
                      - id: uuaK
                        name: Spring Promo (AMP)
                        template_type: amp
                        status: saved
                        created_date: '2026-05-28 09:14:00'
                        modified_date: '2026-05-30 11:02:00'
                        html: <!DOCTYPE html>...
                        amp_content: <!doctype html><html ⚡4email>...
                        plain_text: Spring Promo. 50% off.
                    template_count: 137
                    truncated: true
                Example-3---Empty-result:
                  value:
                    data: []
                    template_count: 0
                    truncated: false
        '400':
          description: Bad Request - validation failure
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
              examples:
                Invalid-template_type-token:
                  value:
                    errors:
                      - field: template_type
                        message: invalid value
                Invalid-status-token:
                  value:
                    errors:
                      - field: status
                        message: invalid value
                Invalid-sort_field:
                  value:
                    errors:
                      - field: sort_field
                        message: Invalid sort_field
                Invalid-sort_order:
                  value:
                    errors:
                      - field: sort_order
                        message: Invalid sort_order
                Page-out-of-range:
                  value:
                    errors:
                      - field: page
                        message: page out of range
                Limit-too-low:
                  value:
                    errors:
                      - field: limit
                        message: Limit must be 10 or greater
                Limit-too-high:
                  value:
                    errors:
                      - field: limit
                        message: Limit must be 100 or less
                Search-name-too-long:
                  value:
                    errors:
                      - field: search_name
                        message: >-
                          Search_name must be a maximum of 100 characters in
                          length
                Trailing-comma-in-enum:
                  value:
                    errors:
                      - field: template_type
                        message: empty value
                Negative-category_id:
                  value:
                    errors:
                      - field: category_id
                        message: Invalid category_id
        '401':
          description: Unauthorized - missing or invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string
              examples:
                Example-1:
                  value:
                    errors:
                      - field: ''
                        message: Authorization failed
        '429':
          description: Too Many Requests - rate limit exceeded (50 req/sec per IP)
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              examples:
                Example-1:
                  value:
                    message: Too Many Requests
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              examples:
                Example-1:
                  value:
                    message: >-
                      Sorry, we are experiencing some technical difficulties.
                      Please try after some time.
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Your Mailercloud API key (plain text, no Bearer prefix). Create keys in
        Settings → API.

````