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

# PUT /api/admin/content/templates

> Create or update message template



## OpenAPI

````yaml put /api/admin/content/templates
openapi: 3.1.0
info:
  title: Dittofeed API
  description: Dittofeed API Swagger Documentation
  version: 0.0.1
servers: []
security: []
paths:
  /api/admin/content/templates:
    put:
      tags:
        - Content
      description: Create or update message template
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                workspaceId:
                  type: string
                id:
                  type: string
                name:
                  type: string
                definition:
                  anyOf:
                    - description: Mobile push template resource
                      type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - MobilePush
                        title:
                          type: string
                        body:
                          type: string
                        imageUrl:
                          type: string
                        android:
                          type: object
                          properties:
                            notification:
                              type: object
                              properties:
                                channelId:
                                  type: string
                          required:
                            - notification
                      required:
                        - type
                    - description: Email template resource
                      anyOf:
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - Email
                            from:
                              type: string
                            subject:
                              type: string
                            replyTo:
                              type: string
                            cc:
                              type: string
                            bcc:
                              type: string
                            name:
                              type: string
                            headers:
                              type: array
                              items:
                                type: object
                                properties:
                                  name:
                                    type: string
                                  value:
                                    type: string
                                required:
                                  - name
                                  - value
                            attachmentUserProperties:
                              description: >-
                                Names of user properties to attach to the email
                                as attachments.
                              type: array
                              items:
                                type: string
                            emailContentsType:
                              type: string
                              enum:
                                - Code
                            body:
                              type: string
                          required:
                            - type
                            - from
                            - subject
                            - body
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - Email
                            emailContentsType:
                              type: string
                              enum:
                                - LowCode
                            body:
                              $ref: '#/components/schemas/def-0'
                            from:
                              type: string
                            subject:
                              type: string
                            replyTo:
                              type: string
                            cc:
                              type: string
                            bcc:
                              type: string
                            name:
                              type: string
                            headers:
                              type: array
                              items:
                                type: object
                                properties:
                                  name:
                                    type: string
                                  value:
                                    type: string
                                required:
                                  - name
                                  - value
                            attachmentUserProperties:
                              description: >-
                                Names of user properties to attach to the email
                                as attachments.
                              type: array
                              items:
                                type: string
                          required:
                            - type
                            - emailContentsType
                            - body
                            - from
                            - subject
                    - description: SMS template resource
                      type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - Sms
                        body:
                          type: string
                      required:
                        - type
                        - body
                    - description: Webhook template resource
                      type: object
                      properties:
                        type:
                          type: string
                          enum:
                            - Webhook
                        identifierKey:
                          type: string
                        body:
                          type: string
                      required:
                        - type
                        - identifierKey
                        - body
                draft:
                  anyOf:
                    - anyOf:
                        - description: Mobile push template resource
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - MobilePush
                            title:
                              type: string
                            body:
                              type: string
                            imageUrl:
                              type: string
                            android:
                              type: object
                              properties:
                                notification:
                                  type: object
                                  properties:
                                    channelId:
                                      type: string
                              required:
                                - notification
                          required:
                            - type
                        - description: Email template resource
                          anyOf:
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Email
                                from:
                                  type: string
                                subject:
                                  type: string
                                replyTo:
                                  type: string
                                cc:
                                  type: string
                                bcc:
                                  type: string
                                name:
                                  type: string
                                headers:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      name:
                                        type: string
                                      value:
                                        type: string
                                    required:
                                      - name
                                      - value
                                attachmentUserProperties:
                                  description: >-
                                    Names of user properties to attach to the
                                    email as attachments.
                                  type: array
                                  items:
                                    type: string
                                emailContentsType:
                                  type: string
                                  enum:
                                    - Code
                                body:
                                  type: string
                              required:
                                - type
                                - from
                                - subject
                                - body
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - Email
                                emailContentsType:
                                  type: string
                                  enum:
                                    - LowCode
                                body:
                                  $ref: '#/components/schemas/def-0'
                                from:
                                  type: string
                                subject:
                                  type: string
                                replyTo:
                                  type: string
                                cc:
                                  type: string
                                bcc:
                                  type: string
                                name:
                                  type: string
                                headers:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      name:
                                        type: string
                                      value:
                                        type: string
                                    required:
                                      - name
                                      - value
                                attachmentUserProperties:
                                  description: >-
                                    Names of user properties to attach to the
                                    email as attachments.
                                  type: array
                                  items:
                                    type: string
                              required:
                                - type
                                - emailContentsType
                                - body
                                - from
                                - subject
                        - description: SMS template resource
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - Sms
                            body:
                              type: string
                          required:
                            - type
                            - body
                        - description: Webhook template resource
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - Webhook
                            identifierKey:
                              type: string
                            body:
                              type: string
                          required:
                            - type
                            - identifierKey
                            - body
                    - type: 'null'
                resourceType:
                  anyOf:
                    - type: string
                      enum:
                        - Declarative
                    - type: string
                      enum:
                        - Internal
              required:
                - workspaceId
                - name
        required: true
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  workspaceId:
                    type: string
                  id:
                    type: string
                  name:
                    type: string
                  type:
                    anyOf:
                      - type: string
                        enum:
                          - Email
                      - type: string
                        enum:
                          - MobilePush
                      - type: string
                        enum:
                          - Sms
                      - type: string
                        enum:
                          - Webhook
                  definition:
                    anyOf:
                      - description: Mobile push template resource
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - MobilePush
                          title:
                            type: string
                          body:
                            type: string
                          imageUrl:
                            type: string
                          android:
                            type: object
                            properties:
                              notification:
                                type: object
                                properties:
                                  channelId:
                                    type: string
                            required:
                              - notification
                        required:
                          - type
                      - description: Email template resource
                        anyOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Email
                              from:
                                type: string
                              subject:
                                type: string
                              replyTo:
                                type: string
                              cc:
                                type: string
                              bcc:
                                type: string
                              name:
                                type: string
                              headers:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    value:
                                      type: string
                                  required:
                                    - name
                                    - value
                              attachmentUserProperties:
                                description: >-
                                  Names of user properties to attach to the
                                  email as attachments.
                                type: array
                                items:
                                  type: string
                              emailContentsType:
                                type: string
                                enum:
                                  - Code
                              body:
                                type: string
                            required:
                              - type
                              - from
                              - subject
                              - body
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Email
                              emailContentsType:
                                type: string
                                enum:
                                  - LowCode
                              body:
                                $ref: '#/components/schemas/def-0'
                              from:
                                type: string
                              subject:
                                type: string
                              replyTo:
                                type: string
                              cc:
                                type: string
                              bcc:
                                type: string
                              name:
                                type: string
                              headers:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    value:
                                      type: string
                                  required:
                                    - name
                                    - value
                              attachmentUserProperties:
                                description: >-
                                  Names of user properties to attach to the
                                  email as attachments.
                                type: array
                                items:
                                  type: string
                            required:
                              - type
                              - emailContentsType
                              - body
                              - from
                              - subject
                      - description: SMS template resource
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - Sms
                          body:
                            type: string
                        required:
                          - type
                          - body
                      - description: Webhook template resource
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - Webhook
                          identifierKey:
                            type: string
                          body:
                            type: string
                        required:
                          - type
                          - identifierKey
                          - body
                  draft:
                    anyOf:
                      - description: Mobile push template resource
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - MobilePush
                          title:
                            type: string
                          body:
                            type: string
                          imageUrl:
                            type: string
                          android:
                            type: object
                            properties:
                              notification:
                                type: object
                                properties:
                                  channelId:
                                    type: string
                            required:
                              - notification
                        required:
                          - type
                      - description: Email template resource
                        anyOf:
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Email
                              from:
                                type: string
                              subject:
                                type: string
                              replyTo:
                                type: string
                              cc:
                                type: string
                              bcc:
                                type: string
                              name:
                                type: string
                              headers:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    value:
                                      type: string
                                  required:
                                    - name
                                    - value
                              attachmentUserProperties:
                                description: >-
                                  Names of user properties to attach to the
                                  email as attachments.
                                type: array
                                items:
                                  type: string
                              emailContentsType:
                                type: string
                                enum:
                                  - Code
                              body:
                                type: string
                            required:
                              - type
                              - from
                              - subject
                              - body
                          - type: object
                            properties:
                              type:
                                type: string
                                enum:
                                  - Email
                              emailContentsType:
                                type: string
                                enum:
                                  - LowCode
                              body:
                                $ref: '#/components/schemas/def-0'
                              from:
                                type: string
                              subject:
                                type: string
                              replyTo:
                                type: string
                              cc:
                                type: string
                              bcc:
                                type: string
                              name:
                                type: string
                              headers:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    name:
                                      type: string
                                    value:
                                      type: string
                                  required:
                                    - name
                                    - value
                              attachmentUserProperties:
                                description: >-
                                  Names of user properties to attach to the
                                  email as attachments.
                                type: array
                                items:
                                  type: string
                            required:
                              - type
                              - emailContentsType
                              - body
                              - from
                              - subject
                      - description: SMS template resource
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - Sms
                          body:
                            type: string
                        required:
                          - type
                          - body
                      - description: Webhook template resource
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - Webhook
                          identifierKey:
                            type: string
                          body:
                            type: string
                        required:
                          - type
                          - identifierKey
                          - body
                  updatedAt:
                    type: number
                required:
                  - workspaceId
                  - id
                  - name
                  - type
                  - updatedAt
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                anyOf:
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - UniqueConstraintViolation
                      message:
                        type: string
                    required:
                      - type
                      - message
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - IdError
                      message:
                        type: string
                    required:
                      - type
                      - message
components:
  schemas:
    def-0:
      title: LowCodeEmailJsonBody
      type: object
      properties:
        type:
          type: string
        attrs:
          type: object
          additionalProperties: {}
        content:
          type: array
          items:
            $ref: '#/components/schemas/def-0'
        marks:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              attrs:
                type: object
                additionalProperties: {}
            required:
              - type
        text:
          type: string

````