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

# Create or Update Template

> Create a new template or update an existing one. If the template slug already exists, the template metadata is updated. Changes are saved to the draft version.




## OpenAPI

````yaml POST /v2/{workspace}/template/{template_slug}/
openapi: 3.1.1
info:
  title: SuprSend API
  description: APIs supported on suprsend platform
  version: 1.2.2
servers:
  - url: https://hub.suprsend.com
security:
  - sec0: []
  - BearerAuth: []
paths:
  /v2/{workspace}/template/{template_slug}/:
    post:
      summary: Create or Update Template
      description: >
        Create a new template or update an existing one. If the template slug
        already exists, the template metadata is updated. Changes are saved to
        the draft version.
      operationId: upsert-template-v2
      parameters:
        - in: path
          name: workspace
          required: true
          schema:
            type: string
          description: Workspace slug.
        - in: path
          name: template_slug
          required: true
          schema:
            type: string
          description: Unique template slug. Used as the identifier for the template.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  description: Template display name.
                  example: Order Confirmed
                description:
                  type: string
                  description: Optional description for the template.
                  example: Sent when an order is placed
                tags:
                  type: array
                  items:
                    type: string
                  description: Tags for organising templates.
                  example:
                    - transactional
                enabled_channels:
                  type: array
                  items:
                    type: string
                    enum:
                      - email
                      - sms
                      - whatsapp
                      - inbox
                      - androidpush
                      - iospush
                      - webpush
                      - slack
                      - ms_teams
                  description: Channels to enable for this template.
                  example:
                    - email
                    - sms
      responses:
        '200':
          description: Template created or updated successfully
          content:
            application/json:
              schema:
                type: object
              example:
                $schema: https://schema.suprsend.com/template/v2/schema.json
                slug: welcome-onboarding
                created_at: '2026-04-01T05:57:21.081312Z'
                last_triggered_at: null
                name: Welcome Onboarding
                description: Welcome email for new users
                tags:
                  - onboarding
                  - welcome
                enabled_channels:
                  - email
                  - slack
                status: draft
                version_no: null
                hash: >-
                  74335de96f6ddc077b90310ff746a8f8cd64852acbbe260c626be54ff28bed0d
                commit_message: null
                active_at: null
                updated_at: '2026-04-08T09:24:38.918548Z'
                updated_by:
                  name: API Service
                  email: service-token@api.example.com
                channels:
                  - channel: email
                    is_active: false
                    variants_count: 1
                  - channel: slack
                    is_active: false
                    variants_count: 1
        '401':
          $ref: '#/components/responses/AuthenticationError'
      security:
        - ServiceTokenAuth: []
      servers:
        - url: https://management-api.suprsend.com
      x-codeSamples:
        - lang: cURL
          label: Upsert Template
          source: >
            curl -X POST
            "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/"
            \
              --header 'Authorization: ServiceToken <token>' \
              --header 'Content-Type: application/json' \
              --data '{
                "name": "Order Confirmed",
                "description": "Sent when an order is placed",
                "tags": ["transactional"],
                "enabled_channels": ["email", "sms"]
              }'
components:
  responses:
    AuthenticationError:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 401
            error_code: authentication_failed
            type: AuthenticationFailed
            message: Invalid service token.
            detail: Invalid service token.
  schemas:
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
          description: HTTP status code
        error_code:
          type: string
          description: Specific error code identifier
        type:
          type: string
          description: Error type classification
        message:
          type: string
          description: Human-readable error message
        detail:
          type: string
          description: Additional error details
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: Authorization
      x-bearer-format: bearer
      description: >-
        Bearer authentication header of the form `Bearer <token>`, where <token>
        is your auth token.
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API_Key
      description: >-
        Pass as `Bearer <API_KEY>`. Get API Key from SuprSend dashboard
        Developers -> API Keys section.
    ServiceTokenAuth:
      type: apiKey
      in: header
      name: ServiceToken <token>
      description: >-
        You can get Service Token from [SuprSend dashboard -> Account Settings
        -> Service
        Tokens](https://app.suprsend.com/en/account-settings/service-tokens)
        section.

````