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

# Templates update

> Feature-gated personal-key operation. Scope, saved grants, current role and resource ownership all apply. Billing is excluded.

Requires the messaging rollout flag and explicit personal-key permissions. Live publishing and lifecycle changes require an expiring preparation and idempotent execution.


## OpenAPI

````yaml api-reference/openapi.json PATCH /templates/{id}
openapi: 3.0.1
info:
  title: Sendrealm API
  description: >-
    API for email, push, audience resources, domains, campaign drafts,
    templates, events, topics, and automations
  license:
    name: MIT
  version: 0.3.0
servers:
  - url: https://api.sendrealm.com
security:
  - bearerAuth: []
paths:
  /templates/{id}:
    patch:
      tags:
        - Agent messaging
      summary: Templates update
      description: >-
        Feature-gated personal-key operation. Scope, saved grants, current role
        and resource ownership all apply. Billing is excluded.
      operationId: templates_update
      parameters:
        - name: X-Sendrealm-Project-Id
          in: header
          required: true
          schema:
            type: string
            format: uuid
          description: Explicit authorized project. Its team is derived server-side.
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/McpTemplateUpdate'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  data:
                    $ref: '#/components/schemas/TemplateDetail'
                required:
                  - status
                  - data
                additionalProperties: false
                x-sendrealm-mcp-contract: true
components:
  schemas:
    McpTemplateUpdate:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 120
          description: Display name, unique within project and channel.
        description:
          type: string
          maxLength: 10000
          nullable: true
        subject_template:
          type: string
          maxLength: 1000000
          nullable: true
        preview_text:
          type: string
          maxLength: 1000000
          nullable: true
        editor_json:
          $ref: '#/components/schemas/McpEmailDocument'
          nullable: true
          description: >-
            Canonical email document. Do not combine with
            rendered_html/rendered_text. Null explicitly clears the editor when
            switching to raw content.
        rendered_html:
          type: string
          maxLength: 1000000
          nullable: true
          description: >-
            Raw email HTML. Clear editor_json explicitly before switching an
            existing document to raw HTML.
        rendered_text:
          type: string
          maxLength: 1000000
          nullable: true
        default_locale:
          type: string
          maxLength: 35
          nullable: true
        messages:
          type: array
          maxItems: 100
          items:
            $ref: '#/components/schemas/McpTemplatePushMessage'
          description: >-
            Push-only localized messages. Replaces the entire list; empty leaves
            an incomplete draft.
      additionalProperties: false
      x-sendrealm-mcp-contract: true
      minProperties: 1
    TemplateDetail:
      allOf:
        - $ref: '#/components/schemas/TemplateSummary'
        - type: object
          required:
            - versions
          properties:
            versions:
              type: array
              items:
                $ref: '#/components/schemas/TemplateVersion'
    McpEmailDocument:
      type: object
      properties:
        type:
          type: string
          description: Email editor document root.
          enum:
            - doc
        content:
          type: array
          items:
            $ref: '#/components/schemas/McpEmailNode'
          description: Document blocks; may be empty while drafting.
      required:
        - type
        - content
      additionalProperties: false
      x-sendrealm-mcp-contract: true
    McpTemplatePushMessage:
      type: object
      properties:
        locale:
          type: string
          minLength: 1
          maxLength: 35
        title:
          type: string
          maxLength: 2000
        message:
          type: string
          maxLength: 10000
        image_url:
          type: string
          maxLength: 1000000
          nullable: true
          format: uri
        launch_url:
          type: string
          maxLength: 1000000
          nullable: true
          format: uri
      required:
        - locale
      additionalProperties: false
      x-sendrealm-mcp-contract: true
    TemplateSummary:
      allOf:
        - $ref: '#/components/schemas/Template'
        - type: object
          required:
            - current_draft_version
            - current_published_version
          properties:
            current_draft_version:
              type: object
              nullable: true
              allOf:
                - $ref: '#/components/schemas/TemplateVersion'
            current_published_version:
              type: object
              nullable: true
              allOf:
                - $ref: '#/components/schemas/TemplateVersion'
    TemplateVersion:
      type: object
      required:
        - id
        - version_number
        - channel
        - state
        - label
        - subject_template
        - preview_text
        - editor_json
        - rendered_html
        - rendered_text
        - default_locale
        - messages
        - published_at
        - restored_from_version_id
        - created_at
        - updated_at
      properties:
        id:
          type: string
          format: uuid
        version_number:
          type: integer
        channel:
          type: string
        state:
          type: string
        label:
          type: string
          nullable: true
        subject_template:
          type: string
          nullable: true
        preview_text:
          type: string
          nullable: true
        editor_json:
          type: object
          nullable: true
          allOf:
            - $ref: '#/components/schemas/JsonObject'
        rendered_html:
          type: string
          nullable: true
        rendered_text:
          type: string
          nullable: true
        default_locale:
          type: string
          nullable: true
        messages:
          $ref: '#/components/schemas/JsonArray'
        published_at:
          type: string
          format: date-time
          nullable: true
        restored_from_version_id:
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    McpEmailNode:
      type: object
      properties:
        type:
          type: string
          description: Supported email editor node type.
          enum:
            - doc
            - text
            - paragraph
            - heading
            - hardBreak
            - horizontalRule
            - bulletList
            - orderedList
            - listItem
            - taskList
            - taskItem
            - buttonBlock
            - imageBlock
            - logo
            - spacer
            - section
            - columns
            - column
            - blockquote
            - blockqoute
            - blockquoteFigure
            - quote
            - quoteCaption
            - figcaption
            - codeBlock
            - variable
            - rawHtml
            - table
            - tableRow
            - tableHeader
            - tableCell
            - emoji
            - socialLinks
            - unsubscribeFooter
        text:
          type: string
          description: Text-node content.
        attrs:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/McpJsonValue'
          description: >-
            Renderer node attributes; for rawHtml use {html:...}, for images use
            src and alt.
        marks:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                description: Supported text style.
                enum:
                  - bold
                  - italic
                  - underline
                  - strike
                  - code
                  - link
                  - textStyle
                  - highlight
                  - fontFamily
                  - subscript
                  - superscript
              attrs:
                type: object
                additionalProperties:
                  $ref: '#/components/schemas/McpJsonValue'
            required:
              - type
            additionalProperties: false
          description: Text formatting.
        content:
          type: array
          items:
            $ref: '#/components/schemas/McpEmailNode'
          description: Child editor nodes.
      required:
        - type
      additionalProperties: false
      x-sendrealm-mcp-contract: true
    Template:
      type: object
      required:
        - id
        - name
        - description
        - channel
        - status
        - current_draft_version_id
        - current_published_version_id
        - created_at
        - updated_at
        - deleted_at
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        description:
          type: string
          nullable: true
        channel:
          type: string
        status:
          type: string
        current_draft_version_id:
          type: string
          format: uuid
          nullable: true
        current_published_version_id:
          type: string
          format: uuid
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        deleted_at:
          type: string
          format: date-time
          nullable: true
    JsonObject:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/JsonValue'
    JsonArray:
      type: array
      items:
        $ref: '#/components/schemas/JsonValue'
    McpJsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: array
          items:
            $ref: '#/components/schemas/McpJsonValue'
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/McpJsonValue'
      description: >-
        JSON application data. Do not include credentials or unnecessary
        personal data.
      x-sendrealm-mcp-contract: true
    JsonValue:
      oneOf:
        - type: string
          nullable: true
        - type: number
        - type: boolean
        - type: object
          additionalProperties:
            $ref: '#/components/schemas/JsonValue'
        - type: array
          items:
            $ref: '#/components/schemas/JsonValue'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Integration key for backend workloads, or a scoped personal key
        (sr_user_) for account discovery and supported project operations. MCP
        accepts only personal keys.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.