# Render an email template

GET https://api.close.com/api/v1/email_template/{id}/render/

Render an email template for the given lead/contact using the current user context.

Accepts two forms of usage:

- Single lead/contact:
  - `lead_id` and `contact_id` is supplied (both required)
- Preview results from a search query
  - `query` (required) contains a search query
  - `entry` (optional, ranges from 0 to 99) specifies the index of the lead/contact that should be rendered.
  - `mode` (optional), which can have a value of:
     - `lead` (default), the first contact of the lead with the index given by `entry` will be rendered (excluding leads that have no email addresses).
     - `contact`, then `entry` refers to the index of the contact (excluding contacts that have no emails). Will return an empty dict if there are no more entries.

Reference: https://developer.close.com/api/resources/email-templates/render

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Close API
  version: 1.0.0
paths:
  /email_template/{id}/render/:
    get:
      operationId: render
      summary: Render an email template
      description: >-
        Render an email template for the given lead/contact using the current
        user context.


        Accepts two forms of usage:


        - Single lead/contact:
          - `lead_id` and `contact_id` is supplied (both required)
        - Preview results from a search query
          - `query` (required) contains a search query
          - `entry` (optional, ranges from 0 to 99) specifies the index of the lead/contact that should be rendered.
          - `mode` (optional), which can have a value of:
             - `lead` (default), the first contact of the lead with the index given by `entry` will be rendered (excluding leads that have no email addresses).
             - `contact`, then `entry` refers to the index of the contact (excluding contacts that have no emails). Will return an empty dict if there are no more entries.
      tags:
        - subpackage_emailTemplates
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: email_account_id
          in: query
          required: false
          schema:
            type: string
        - name: bulk_object_type
          in: query
          required: false
          schema:
            $ref: >-
              #/components/schemas/EmailTemplateIdRenderGetParametersBulkObjectType
        - name: contact_id
          in: query
          required: false
          schema:
            type: string
        - name: contact_preference
          in: query
          required: false
          schema:
            $ref: >-
              #/components/schemas/EmailTemplateIdRenderGetParametersContactPreference
        - name: entry
          in: query
          required: false
          schema:
            type: integer
        - name: lead_id
          in: query
          required: false
          schema:
            type: string
        - name: limit
          in: query
          required: false
          schema:
            type: integer
        - name: query
          in: query
          required: false
          schema:
            type: string
        - name: results_limit
          in: query
          required: false
          schema:
            type: integer
        - name: s_query
          in: query
          required: false
          schema:
            type: string
        - name: sender
          in: query
          required: false
          schema:
            type: string
            format: email
        - name: sort
          in: query
          required: false
          schema:
            type: array
            items:
              $ref: >-
                #/components/schemas/EmailTemplateIdRenderGetParametersSortSchemaItems
        - name: mode
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/EmailTemplateIdRenderGetParametersMode'
        - name: Authorization
          in: header
          description: Basic authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/email_templates_render_Response_200'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                description: Any type
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: Not found
          content:
            application/json:
              schema:
                description: Any type
servers:
  - url: https://api.close.com/api/v1
components:
  schemas:
    EmailTemplateIdRenderGetParametersBulkObjectType:
      type: string
      enum:
        - lead
        - contact
      title: EmailTemplateIdRenderGetParametersBulkObjectType
    EmailTemplateIdRenderGetParametersContactPreference:
      type: string
      enum:
        - lead
        - contact
        - all
      title: EmailTemplateIdRenderGetParametersContactPreference
    EmailTemplateIdRenderGetParametersSortSchemaItemsDirection:
      type: string
      enum:
        - asc
        - desc
      title: EmailTemplateIdRenderGetParametersSortSchemaItemsDirection
    EmailTemplateIdRenderGetParametersSortSchemaItems:
      type: object
      properties:
        direction:
          $ref: >-
            #/components/schemas/EmailTemplateIdRenderGetParametersSortSchemaItemsDirection
        field:
          type: string
      required:
        - direction
        - field
      title: EmailTemplateIdRenderGetParametersSortSchemaItems
    EmailTemplateIdRenderGetParametersMode:
      type: string
      enum:
        - lead
        - contact
      title: EmailTemplateIdRenderGetParametersMode
    email_templates_render_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: email_templates_render_Response_200
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: basic
    OAuth2:
      type: http
      scheme: bearer

```