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

# Create an email template

> Create a template for one candidate email, such as the interview invitation. A template is only sent once it is mapped into an email template group and that group is set on an interviewer (``email_template_group_id``).

Content is screened before it is saved: content that breaks policy returns 422, and softer issues come back in ``content_warnings``.



## OpenAPI

````yaml https://api.heymilo.ai/openapi.json post /api/v2/email-templates
openapi: 3.1.0
info:
  title: HeyMilo Public API
  description: >-
    External developer-facing API for HeyMilo. Create interviewers with agentic
    workflows, ingest candidates, retrieve interview results, and manage
    workspace resources.
  version: 2.0.0
servers:
  - url: https://api.heymilo.ai
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Interviewers
    description: >-
      Create, read, update, and manage interviewers. An interviewer (posting)
      combines job details with an AI agent configuration and agentic workflow.
  - name: Candidates
    description: >-
      Ingest candidates into an interviewer's workflow (sync or async, single or
      bulk) and list candidates with their progress.
  - name: Interviews
    description: >-
      Retrieve full interview results (scorecard, transcript, resume evaluation)
      and manage per-interview metadata.
  - name: Webhooks
    description: >-
      Register, list, and manage webhook endpoints that receive real-time event
      notifications.
  - name: Voices
    description: Browse the workspace voice registry for AI interviewer voices.
  - name: Phone Numbers
    description: List provisioned phone numbers for SMS and voice agents.
  - name: Sender Emails
    description: Manage sender email addresses used for candidate communications.
  - name: Email Templates
    description: >-
      Create, update, delete and view the email templates used for candidate
      outreach. A template is sent once it is mapped into an email template
      group set on an interviewer.
  - name: Email Template Groups
    description: >-
      Create, update, delete and view email template groups, which map each
      email type to a template and pick the sender address. Set a group on an
      interviewer with ``email_template_group_id``.
  - name: Design Templates
    description: >-
      Create, update, delete and view the design templates that style each
      candidate-facing page. A template is used once it is mapped into a design
      template group.
  - name: Design Template Groups
    description: >-
      Create, update, delete and view design template groups, which pick a
      template for each candidate-facing page. Set a group on an interviewer
      with ``design_template_group_id``, or make it the workspace default.
  - name: Interview Templates
    description: >-
      Create, update, delete and view interview templates, reusable agent
      configurations (workflow, questions, criteria, agent settings) saved as a
      snapshot of an interviewer. Create interviewers from one with
      ``interview_template_id``.
  - name: Domains
    description: Manage custom domains for white-labelled interview URLs.
  - name: Questions
    description: >-
      Create, read, update, delete, and reorder questions and criteria for an
      interviewer's workflow. Covers all modalities: voice, sms, form,
      resume_eligibility, resume_scoring, and voice_tags.
  - name: Workspaces
    description: >-
      List the workspaces accessible to the authenticated caller. API-key
      callers receive a single entry; OAuth callers receive every workspace they
      are a member of.
  - name: Teams
    description: >-
      Create, update, delete and list workspace teams, and manage which teams an
      interviewer belongs to. Interviewers can also be assigned at creation time
      via ``team_ids`` on the create-interviewer request. Requires the Teams
      feature to be enabled for the workspace.
paths:
  /api/v2/email-templates:
    post:
      tags:
        - Email Templates
      summary: Create an email template
      description: >-
        Create a template for one candidate email, such as the interview
        invitation. A template is only sent once it is mapped into an email
        template group and that group is set on an interviewer
        (``email_template_group_id``).


        Content is screened before it is saved: content that breaks policy
        returns 422, and softer issues come back in ``content_warnings``.
      operationId: createEmailTemplate
      parameters:
        - name: X-API-KEY
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
        - name: Authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
        - name: X-Workspace-Id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Workspace-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEmailTemplateRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SingleResponse_EmailTemplateResponse_'
        '401':
          description: Invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
        '403':
          description: Email templates are not included in the workspace's plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
        '404':
          description: Email template not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
        '422':
          description: Content failed validation or screening.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/APIErrorResponse'
components:
  schemas:
    CreateEmailTemplateRequest:
      properties:
        template_key:
          type: string
          enum:
            - WEB_INTERVIEW_INVITATION
            - WEB_INTERVIEW_NUDGE
            - WEB_INTERVIEW_FINAL_NUDGE
            - RESUME_INVITATION
            - RESUME_NUDGE
            - FORM_INVITATION
            - FORM_NUDGE
            - SCHEDULING_LINK_EMAIL
            - REPORT_READY_EMAIL
            - RETAKE_AVAILABLE_EMAIL
            - INTERVIEW_COMPLETION
            - LLM_SCENARIO_INVITATION
            - LLM_SCENARIO_NUDGE
            - BOOKING_CONFIRMED_EMAIL
            - BOOKING_RESCHEDULED_EMAIL
            - BOOKING_CANCELLED_EMAIL
            - BOOKING_REMINDER_EMAIL
          title: Template Key
          description: Which email this template replaces. Cannot be changed later.
          examples:
            - WEB_INTERVIEW_INVITATION
        name:
          type: string
          maxLength: 200
          minLength: 1
          title: Name
          description: Human-readable template name.
          examples:
            - Acme interview invitation
        subject:
          type: string
          maxLength: 500
          minLength: 1
          title: Subject
          description: >-
            Email subject line. Supports {{variable}} placeholders such as
            {{candidate_name}}, {{job_title}} and {{company_name}}.
          examples:
            - Your interview for {{job_title}} at {{company_name}}
        content:
          type: string
          maxLength: 100000
          minLength: 1
          title: Content
          description: >-
            Email HTML body. Supports {{variable}} placeholders; invitation
            emails should include {{interview_link}}. A template whose
            placeholders cannot be filled when sending falls back to HeyMilo's
            default email.
          examples:
            - >-
              <p>Hi {{candidate_name}},</p><p>Start your interview here: <a
              href="{{interview_link}}">{{interview_link}}</a></p>
        blackout_period:
          anyOf:
            - $ref: '#/components/schemas/BlackoutPeriodInput'
            - type: 'null'
          description: Optional window when this email is not sent.
      additionalProperties: false
      type: object
      required:
        - template_key
        - name
        - subject
        - content
      title: CreateEmailTemplateRequest
      description: Request body for creating an email template.
    SingleResponse_EmailTemplateResponse_:
      properties:
        data:
          $ref: '#/components/schemas/EmailTemplateResponse'
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
          description: Optional metadata. Shape varies by endpoint.
      type: object
      required:
        - data
      title: SingleResponse[EmailTemplateResponse]
    APIErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/APIError'
      type: object
      required:
        - error
      title: APIErrorResponse
    BlackoutPeriodInput:
      properties:
        enabled:
          type: boolean
          title: Enabled
          description: Whether the blackout period is active.
          default: true
          examples:
            - true
        timezone:
          type: string
          title: Timezone
          description: IANA timezone identifier.
          examples:
            - Europe/Berlin
        start_hour:
          type: integer
          maximum: 23
          minimum: 0
          title: Start Hour
          description: Start hour of the blackout window (0-23).
          examples:
            - 22
        end_hour:
          type: integer
          maximum: 24
          minimum: 0
          title: End Hour
          description: End hour of the blackout window (0-24, where 24 = midnight).
          examples:
            - 7
      additionalProperties: false
      type: object
      required:
        - timezone
        - start_hour
        - end_hour
      title: BlackoutPeriodInput
      description: A window, in the given timezone, when this email is held back.
    EmailTemplateResponse:
      properties:
        object:
          type: string
          const: email_template
          title: Object
          description: Object type identifier.
          default: email_template
        id:
          type: string
          title: Id
          description: Unique email template identifier.
          examples:
            - B31EB9E73BEE
        template_key:
          type: string
          title: Template Key
          description: >-
            Template key indicating the email type, e.g.
            'WEB_INTERVIEW_INVITATION' or 'WEB_INTERVIEW_NUDGE'. See
            createEmailTemplate for the full list.
          examples:
            - WEB_INTERVIEW_INVITATION
        name:
          type: string
          title: Name
          description: Human-readable template name.
          examples:
            - Custom Interview Invitation
        subject:
          type: string
          title: Subject
          description: Email subject line. Supports {{variable}} placeholders.
          examples:
            - Interview Confirmation for {{job_title}} at {{company_name}}
        content:
          type: string
          title: Content
          description: Email HTML body. Supports {{variable}} placeholders.
          examples:
            - <p>Hello {{candidate_name}}, ...</p>
        blackout_period:
          anyOf:
            - $ref: '#/components/schemas/BlackoutPeriod'
            - type: 'null'
          description: Blackout period during which this email will not be sent.
        created_at:
          type: number
          title: Created At
          description: Unix timestamp when the template was created.
          examples:
            - 1739612400
        updated_at:
          type: number
          title: Updated At
          description: Unix timestamp when the template was last updated.
          examples:
            - 1739617200
        content_warnings:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Content Warnings
          description: >-
            Content-safety warnings raised by this save. Only set on create and
            update responses, and only when there were warnings.
      type: object
      required:
        - id
        - template_key
        - name
        - subject
        - content
        - created_at
        - updated_at
      title: EmailTemplateResponse
      description: |-
        A single email template used for candidate communications.

        Templates define the subject line and HTML body for emails sent at
        various stages of the interview workflow (invitations, nudges, etc.).
    APIError:
      properties:
        type:
          type: string
          title: Type
          description: Error category
          examples:
            - invalid_request_error
        code:
          type: string
          title: Code
          description: Machine-readable error code
          examples:
            - validation_error
        message:
          type: string
          title: Message
          description: Human-readable summary
          examples:
            - The request body failed validation
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
          description: Top-level parameter that caused the error
        doc_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Doc Url
          description: Link to relevant documentation
        errors:
          items:
            $ref: '#/components/schemas/APIErrorDetail'
          type: array
          title: Errors
          description: Detailed per-field validation errors
      type: object
      required:
        - type
        - code
        - message
      title: APIError
    BlackoutPeriod:
      properties:
        enabled:
          type: boolean
          title: Enabled
          description: Whether the blackout period is active.
          examples:
            - true
        timezone:
          type: string
          title: Timezone
          description: IANA timezone identifier.
          examples:
            - America/New_York
        start_hour:
          type: integer
          title: Start Hour
          description: Start hour of the blackout window (0-23).
          examples:
            - 22
        end_hour:
          type: integer
          title: End Hour
          description: End hour of the blackout window (0-24, where 24 = midnight).
          examples:
            - 7
      type: object
      required:
        - enabled
        - timezone
        - start_hour
        - end_hour
      title: BlackoutPeriod
      description: Time window during which emails will not be sent.
    APIErrorDetail:
      properties:
        code:
          type: string
          title: Code
          description: Machine-readable error code
          examples:
            - invalid_param
        message:
          type: string
          title: Message
          description: Human-readable explanation
          examples:
            - title must be between 3 and 200 characters
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
          description: Parameter that caused the error
          examples:
            - title
      type: object
      required:
        - code
        - message
      title: APIErrorDetail
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key for authentication. Pass your key in the X-API-KEY header.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.