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

# Create a new Template



## OpenAPI

````yaml Commerce post /templates
openapi: 3.1.0
info:
  title: Commerce
  version: '3.0'
  contact:
    email: samuel@driv.ly
    name: Samuel Lippert
    url: https://driv.ly/
  description: Drivly Commerce API
servers:
  - url: https://commerce.driv.ly/api
security: []
paths:
  /templates:
    parameters:
      - schema:
          type: integer
        name: depth
        in: query
        required: false
        description: The number of levels of related objects to include in the response
    post:
      summary: Create a new Template
      operationId: post-template
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewTemplate'
      responses:
        '200':
          description: Template Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Template'
                  success:
                    type: boolean
        '400':
          description: Missing Required Information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
                examples:
                  - error:
                      code: 400
                      message: Missing Required Information
                    success: false
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
                examples:
                  - error:
                      code: 401
                      message: Unauthorized
                    success: false
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
                examples:
                  - error:
                      code: 429
                      message: Too Many Requests
                    success: false
components:
  schemas:
    NewTemplate:
      $id: NewTemplate
      examples:
        - id: tmp_39fjkd93nmd0
          type: Email
          subject: Invoice Details
          messageText: Hello, please find your invoice attached.
      required:
        - type
        - messageText
      title: Template
      type: object
      properties:
        id:
          type: string
          description: Template is uniquely identified by id
        type:
          type: string
          description: Template has Template Type
        messageText:
          type: string
          description: Template has Message Text
        subject:
          type: string
          description: Template has Subject
    Template:
      $id: Template
      examples:
        - id: tmp_39fjkd93nmd0
          type: Email
          subject: Invoice Details
          messageText: Hello, please find your invoice attached.
      required:
        - id
        - type
        - messageText
      title: Template
      type: object
      properties:
        id:
          type: string
          description: Template is uniquely identified by id
        type:
          type: string
          description: Template has Template Type
        messageText:
          type: string
          description: Template has Message Text
        subject:
          type: string
          description: Template has Subject
    ErrorModel:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: number
            message:
              type: string
        success:
          type: boolean

````