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

# Create template

> Create a template scoped to the caller's organization. `name`, `template` body and `type` are required; `category` is required for non-automation types.



## OpenAPI

````yaml /api-reference/openapi.yaml post /api/templates
openapi: 3.0.3
info:
  title: Tether Relay and Tether API
  version: 1.0.0
  description: >-
    Route-derived OpenAPI contract generated from tether-relay backend sources.
    Regenerate with scripts/sync-openapi-from-backend.mjs.
servers:
  - url: https://your-instance.example.com
    description: Production
  - url: http://localhost:2212
    description: Local API service
security: []
tags:
  - name: AI
  - name: Applications
  - name: Approval
  - name: Auth
  - name: Automations
  - name: Calls
  - name: Campaigns
  - name: Contact Analytics
  - name: Contact Metrics
  - name: Contact Notes
  - name: Contacts
  - name: Conversation Monitor
  - name: Conversations
  - name: Departments
  - name: Email
  - name: Escalation Dashboard
  - name: Event Logs
  - name: Google Sheets
  - name: Marketplace
  - name: Messages
  - name: Notification Sounds
  - name: Notifications
  - name: Org Snapshots
  - name: Organizations
  - name: Outreach
  - name: Outreach Metrics
  - name: Outreach Sources
  - name: Pipelines
  - name: Processes
  - name: Prompts
  - name: Reminders
  - name: Sms
  - name: Templates
  - name: Traces
  - name: Training
  - name: Upload
  - name: User Snapshots
  - name: Users
  - name: Vertical
  - name: Webchats
  - name: Webhook
paths:
  /api/templates:
    post:
      tags:
        - Templates
      summary: Create template
      description: >-
        Create a template scoped to the caller's organization. `name`,
        `template` body and `type` are required; `category` is required for
        non-automation types.
      operationId: post_templates
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTemplateRequest'
      responses:
        '201':
          description: Template created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateMutationResponse'
        '400':
          description: Missing required fields
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplatesErrorResponse'
        '500':
          description: Failed to create template
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplatesErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateTemplateRequest:
      type: object
      properties:
        name:
          type: string
          description: Template display name shown in the template picker.
        template:
          type: string
          description: >-
            Template body with `{{firstName}}`-style placeholders resolved at
            send time.
        type:
          type: string
          description: 'Template kind: `sms`, `email`, `campaign`, `script`, `automation`.'
        category:
          type: string
          description: >-
            Grouping label for filtering; required unless `type ===
            "automation"`.
      required:
        - name
        - template
        - type
      additionalProperties: true
      example:
        name: Demo follow-up
        template: Hi {{firstName}}, thanks for the demo today!
        type: message
        category: sales-followup
    TemplateMutationResponse:
      type: object
      properties:
        success:
          type: boolean
          enum:
            - true
        data:
          $ref: '#/components/schemas/TemplateItem'
      required:
        - success
        - data
      additionalProperties: true
      example:
        success: true
        data:
          _id: 66a0a0b0c0d0e0f0a0b0c0d0
          name: Demo follow-up
          template: Hi {{firstName}}, thanks for the demo today!
          type: message
          category: sales-followup
          organizationId: 65a0e0e0e0e0e0e0e0e0e0e0
          createdBy: 65b1f0a2c3d4e5f6a7b8c9d0
          createdAt: '2026-04-12T08:00:00.000Z'
          updatedAt: '2026-04-12T08:00:00.000Z'
    TemplatesErrorResponse:
      type: object
      description: Error envelope used by templates endpoints.
      properties:
        success:
          type: boolean
          enum:
            - false
        message:
          type: string
      additionalProperties: true
      example:
        success: false
        message: Template not found
    TemplateItem:
      type: object
      description: >-
        Mongoose `Template` document. `category` is omitted when `type ===
        "automation"`.
      properties:
        _id:
          type: string
        name:
          type: string
        template:
          type: string
        type:
          type: string
        category:
          type: string
          nullable: true
        userId:
          type: string
        organizationId:
          type: string
        createdBy:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      additionalProperties: true
      example:
        _id: 66a0a0b0c0d0e0f0a0b0c0d0
        name: Demo follow-up
        template: Hi {{firstName}}, thanks for the demo today!
        type: message
        category: sales-followup
        userId: 65b1f0a2c3d4e5f6a7b8c9d0
        organizationId: 65a0e0e0e0e0e0e0e0e0e0e0
        createdBy: 65b1f0a2c3d4e5f6a7b8c9d0
        createdAt: '2026-04-12T08:00:00.000Z'
        updatedAt: '2026-04-12T08:00:00.000Z'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````