> ## 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 publish

> 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 POST /templates/{id}/actions/publish/execute
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}/actions/publish/execute:
    post:
      tags:
        - Agent messaging
      summary: Templates publish
      description: >-
        Feature-gated personal-key operation. Scope, saved grants, current role
        and resource ownership all apply. Billing is excluded.
      operationId: templates_publish
      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/McpPreparedExecution'
      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:
    McpPreparedExecution:
      type: object
      properties:
        prepared_action_id:
          type: string
          format: uuid
        idempotency_key:
          type: string
          minLength: 1
          maxLength: 160
      additionalProperties: false
      x-sendrealm-mcp-contract: true
      required:
        - prepared_action_id
        - idempotency_key
    TemplateDetail:
      allOf:
        - $ref: '#/components/schemas/TemplateSummary'
        - type: object
          required:
            - versions
          properties:
            versions:
              type: array
              items:
                $ref: '#/components/schemas/TemplateVersion'
    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
    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'
    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.