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

# Publish template

> Publish a template, which clears the preview HTML. The preview_html field will be set to NULL after this operation.



## OpenAPI

````yaml /openapi.json post /v1/templates/{id}/publish
openapi: 3.0.3
info:
  title: Emailr API
  version: 1.0.0
servers:
  - url: https://api.emailr.dev
    description: Production
security: []
tags:
  - name: emails
    description: Email sending and management
  - name: contacts
    description: Contact management
  - name: templates
    description: Email template management
  - name: domains
    description: Domain verification and management
  - name: webhooks
    description: Webhook configuration
  - name: broadcasts
    description: Broadcast campaign management
  - name: segments
    description: Contact segmentation
paths:
  /v1/templates/{id}/publish:
    post:
      tags:
        - templates
      summary: Publish template
      description: >-
        Publish a template, which clears the preview HTML. The preview_html
        field will be set to NULL after this operation.
      operationId: publishTemplate
      parameters:
        - schema:
            type: string
            format: uuid
            example: 123e4567-e89b-12d3-a456-426614174000
          required: true
          name: id
          in: path
      responses:
        '200':
          description: Template published
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '404':
          description: Template not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    Template:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: 123e4567-e89b-12d3-a456-426614174000
        organization_id:
          type: string
          format: uuid
        name:
          type: string
        subject:
          type: string
        html_content:
          type: string
          nullable: true
        text_content:
          type: string
          nullable: true
        variables:
          type: array
          nullable: true
          items:
            type: string
        from_email:
          type: string
          nullable: true
        from_name:
          type: string
          nullable: true
        reply_to:
          type: string
          nullable: true
        preview_text:
          type: string
          nullable: true
        preview_html:
          type: string
          nullable: true
          description: Preview HTML content for AI agent review workflow
        inbox_id:
          type: string
          nullable: true
          format: uuid
          description: Associated inbox ID for sender identity defaults
          example: 123e4567-e89b-12d3-a456-426614174000
        tags:
          type: array
          items:
            type: string
          description: Tags for categorization.
          example:
            - newsletter
            - vip
        created_by:
          type: string
          nullable: true
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - organization_id
        - name
        - subject
        - html_content
        - text_content
        - variables
        - from_email
        - from_name
        - reply_to
        - preview_text
        - preview_html
        - inbox_id
        - tags
        - created_by
        - created_at
        - updated_at
    Error:
      type: object
      properties:
        error:
          type: string
          example: An error occurred
        code:
          type: string
          example: VALIDATION_ERROR
        details: {}
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: API key authentication. Use your API key as the bearer token.

````