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

> Update a template



## OpenAPI

````yaml /api-reference/emails/openapi.json post /emails/builder/data
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/data:
    post:
      tags:
        - Templates
      summary: Update a template
      description: Update a template
      operationId: update-template
      parameters:
        - 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/SaveBuilderDataDto'
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuilderUpdateSuccessfulDTO'
        '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:
    SaveBuilderDataDto:
      type: object
      properties:
        locationId:
          type: string
          example: ve9EPM428h8vShlRW1KT
        templateId:
          type: string
          example: zYy3YOUuHxgomU1uYJty
        updatedBy:
          type: string
          example: zYy3YOUuHxgomU1uYJty
        dnd:
          $ref: '#/components/schemas/IBuilderJsonMapper'
          example: '{elements:[], attrs:{}, templateSettings:{}}'
        html:
          type: string
          example: ''
        editorType:
          type: string
          enum:
            - html
            - builder
        previewText:
          type: string
          example: zYy3YOUuHxgomU1uYJty
        isPlainText:
          type: boolean
          example: 'false'
        usedEmailAI:
          type: boolean
          example: false
          description: Whether Email AI was used
      required:
        - locationId
        - templateId
        - updatedBy
        - dnd
        - html
        - editorType
    BuilderUpdateSuccessfulDTO:
      type: object
      properties:
        ok:
          type: string
          example: 'true'
          description: ok
        traceId:
          type: string
          example: 0c52e980-41f6-4be7-8c4b-32332ss
          description: trace id
        previewUrl:
          type: string
          example: https://example.com
          description: preview url
        templateDownloadUrl:
          type: string
          example: https://example.com
          description: template data download url
        versionId:
          type: string
          example: 507f1f77bcf86cd799439011
          description: version id of the saved template
    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: {}

````