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

# Update a template with settings

> Update a template with settings



## OpenAPI

````yaml /api-reference/emails/openapi.json patch /emails/builder/{templateId}
openapi: 3.0.0
info:
  title: Email API
  description: Documentation for emails API
  version: '1.0'
  contact: {}
servers:
  - url: https://services.leadconnectorhq.com
security: []
tags:
  - name: Emails
    description: Documentation for emails API
  - name: Campaigns
    description: Documentation for emails API
  - name: Templates
    description: Documentation for emails API
  - name: Statistics
    description: Documentation for emails API
paths:
  /emails/builder/{templateId}:
    patch:
      tags:
        - Templates
      summary: Update a template with settings
      description: Update a template with settings
      operationId: patch-template
      parameters:
        - name: templateId
          required: true
          in: path
          schema:
            type: string
        - name: Version
          in: header
          description: API Version
          required: true
          schema:
            type: string
            enum:
              - '2021-07-28'
            example: '2021-07-28'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateEmailTemplateDto'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateEmailTemplateResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedDTO'
        '404':
          description: Not Found
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableDTO'
      security:
        - Location-Access:
            - emails/builder.write
components:
  schemas:
    UpdateEmailTemplateDto:
      type: object
      properties:
        locationId:
          type: string
          description: Location ID where the template belongs
          example: ve9EPM428h8vShlRW1KT
        updatedBy:
          type: string
          description: User ID who is updating the template
          example: zYy3YOUuHxgomU1uYJty
        editorContent:
          description: >-
            Editor content - can be HTML string, plain text string, or DND
            builder object depending on editorType. When editorType is "html" or
            "text", this should be a string. When editorType is "builder", this
            should be a DND object with elements, attrs, and templateSettings.
            Must be provided together with editorType.
          oneOf:
            - type: string
              example: <html><body>Hello World</body></html>
            - $ref: '#/components/schemas/IBuilderJsonMapper'
        editorType:
          type: string
          enum:
            - html
            - builder
            - text
          description: >-
            Type of editor content: "html" for HTML content, "text" for plain
            text content, "builder" for drag-and-drop builder content. Must be
            provided together with editorContent.
          example: html
        previewText:
          type: string
          description: Preview text shown in email clients before opening
          example: Email preview text
        subjectLine:
          type: string
          description: Email subject line
          example: Welcome to our newsletter
        fromName:
          type: string
          description: Sender name displayed in email
          example: John Doe
        fromEmail:
          type: string
          description: Sender email address
          example: john@example.com
        name:
          type: string
          description: Template name
          example: Newsletter Template
        archived:
          type: boolean
          description: Whether the template is archived
          example: false
      required:
        - locationId
    UpdateEmailTemplateResponseDto:
      type: object
      properties:
        ok:
          type: boolean
          description: Indicates if the update was successful
          example: true
        id:
          type: string
          description: Unique template identifier
          example: 507f1f77bcf86cd799439011
        name:
          type: string
          description: Template name
          example: My Email Template
        archived:
          type: boolean
          description: Whether the template is archived
          example: false
        builderVersion:
          type: string
          description: Builder version used for the template
          example: '2'
        fromName:
          type: string
          description: Sender name displayed in email
          example: John Doe
        fromEmail:
          type: string
          description: Sender email address
          example: john@example.com
        subjectLine:
          type: string
          description: Email subject line
          example: Welcome to our newsletter
        previewText:
          type: string
          description: Preview text shown in email clients
          example: Check out our latest updates
        previewUrl:
          type: string
          description: URL to preview the rendered template
          example: https://example.com/preview/template123
        type:
          type: string
          description: Type of template editor used
          enum:
            - html
            - builder
          example: builder
        lastUpdated:
          type: string
          description: Timestamp of last update
          example: '2024-01-15T10:30:00Z'
        createdAt:
          type: string
          description: Timestamp when template was created
          example: '2024-01-01T08:00:00Z'
        isPlainText:
          type: boolean
          description: >-
            Whether the template contains plain text content (true) or HTML
            content (false)
          example: false
      required:
        - ok
        - id
        - name
        - archived
        - builderVersion
        - fromName
        - fromEmail
        - subjectLine
        - previewText
        - previewUrl
        - type
        - lastUpdated
        - createdAt
        - isPlainText
    BadRequestDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        message:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
    UnauthorizedDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 401
        message:
          type: string
          example: 'Invalid token: access token is invalid'
        error:
          type: string
          example: Unauthorized
      required:
        - statusCode
        - message
        - error
    UnprocessableDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 422
        message:
          type: array
          items:
            type: string
          example:
            - Unprocessable Entity
        error:
          type: string
          example: Unprocessable Entity
      required:
        - statusCode
        - message
        - error
    IBuilderJsonMapper:
      type: object
      properties:
        elements:
          description: Array of VNode elements representing the email structure
          type: array
          items:
            type: string
        attrs:
          type: object
          description: Object mapping element IDs to their attributes and styles
        templateSettings:
          $ref: '#/components/schemas/TemplateSettings'
      required:
        - elements
        - attrs
        - templateSettings
    TemplateSettings:
      type: object
      properties: {}

````