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

# Create a new template

> Create a new template



## OpenAPI

````yaml /api-reference/emails/openapi.json post /emails/builder
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:
    post:
      tags:
        - Templates
      summary: Create a new template
      description: Create a new template
      operationId: create-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/CreateBuilderDto'
      responses:
        '201':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBuilderSuccesfulResponseDto'
        '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:
    CreateBuilderDto:
      type: object
      properties:
        locationId:
          type: string
          example: ve9EPM428h8vShlRW1KT
        title:
          type: string
          example: template title
        type:
          type: string
          enum:
            - html
            - folder
            - import
            - builder
            - blank
            - ai_template
        updatedBy:
          type: string
          example: zYy3YOUuHxgomU1uYJty
        builderVersion:
          type: string
          enum:
            - '1'
            - '2'
          default: '2'
        name:
          type: string
          example: Template1
        parentId:
          type: string
          example: zYy3YOUuHxgomU1uYJty
        templateDataUrl:
          type: string
          example: ''
        importProvider:
          type: string
          enum:
            - mailchimp
            - active_campaign
            - kajabi
            - other
        importURL:
          type: string
          example: https://tplshare.com/fhYJ3Mi
        templateSource:
          type: string
          example: template_library
        isPlainText:
          type: boolean
          example: false
        subjectLine:
          type: string
          example: Email Subject
        fromName:
          type: string
          example: Name of sender
        fromEmail:
          type: string
          example: test@abc.com
        previewText:
          type: string
          example: preview text
      required:
        - locationId
        - type
        - importProvider
    CreateBuilderSuccesfulResponseDto:
      type: object
      properties:
        redirect:
          type: string
          example: 66e811229245fc098765590
          description: template id
        traceId:
          type: string
          example: 0c52e980-41f6-4be7-8c4b-e2c5a13dc3c2
          description: trace id
      required:
        - redirect
        - traceId
    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

````