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

# Create Template

> Creates a new template with provided details



## OpenAPI

````yaml POST /templates
openapi: 3.0.1
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: http://base.url.com
security:
  - apiKey: []
paths:
  /templates:
    post:
      description: Creates a new template with provided details
      operationId: createTemplate
      requestBody:
        description: Details of the new template to create
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/CreateTemp'
      responses:
        '200':
          description: Template created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: You do not have permission to access this resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
components:
  schemas:
    CreateTemp:
      type: object
      required:
        - name
        - subject
        - text
        - html
        - is_check_email_opened
        - is_check_clicked_link
        - is_check_submitted_data
        - is_check_file_downloaded
        - is_check_file_executed
        - addAttachment
      properties:
        name:
          type: string
          description: Name of the email campaign
        subject:
          type: string
          description: Subject line of the email
        text:
          type: string
          description: Plain text version of the email content
        html:
          type: string
          description: HTML content of the email, styled with MJML
        is_check_email_opened:
          type: boolean
          description: Flag to track if the email has been opened
          default: false
        is_check_clicked_link:
          type: boolean
          description: Flag to track if links within the email have been clicked
          default: false
        is_check_submitted_data:
          type: boolean
          description: Flag to track if data was submitted by the recipient
          default: false
        is_check_file_downloaded:
          type: boolean
          description: Flag to track if any attached file has been downloaded
          default: false
        is_check_file_executed:
          type: boolean
          description: >-
            Flag to track if any executable file attached has been run by the
            recipient
          default: false
        addAttachment:
          type: boolean
          description: Flag to indicate if an attachment should be included in the email
          default: false
        attachment_in_body:
          type: boolean
          description: Flag to include attachment directly in the email body
          default: false
        attachmentRedirectToPhished:
          type: boolean
          description: Flag to redirect the attachment to a phishing site upon opening
          default: false
        attachment_name:
          type: string
          description: Name of the file to be attached, if any
    Template:
      type: object
      required:
        - id
        - name
        - content
      properties:
        id:
          type: string
          description: Unique identifier for the template
        name:
          type: string
          description: Name of the template
        content:
          type: string
          description: HTML content of the template
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    ForbiddenError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: integer
          format: int32
          description: Error code representing the type of error
          example: 403
        message:
          type: string
          description: A message describing the error
          example: You do not have permission to access this resource.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-phishy-api-key

````