# Share Template

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/messages/templates/{id}/share:
    put:
      summary: Share Template
      deprecated: false
      description: >-
        Allows sharing templates within organization - with whole organization
        or specific customers.

        Only allowed in regular Loyalty Clubs
      tags:
        - API Reference/Messaging API/Templates
      parameters:
        - name: id
          in: path
          description: ''
          required: true
          example: 1
          schema:
            type: integer
        - name: Content-Type
          in: header
          description: '[Details](doc-341635)'
          required: true
          example: application/json
          schema:
            type: string
            default: application/json
            const: application/json
        - name: X-User-Agent
          in: header
          description: Arbitrary identifier of your client. [Details](doc-341635)
          required: true
          example: '{{X_USER_AGENT}}'
          schema:
            type: string
            default: '{{X_USER_AGENT}}'
        - name: X-Product-Name
          in: header
          description: API Product for API context. [Details](doc-341635)
          required: true
          example: '{{PRODUCT_NAME}}'
          schema:
            type: string
            default: '{{PRODUCT_NAME}}'
        - name: X-Loyalty-Club-Slug
          in: header
          description: LoyaltyClub for API context. [Details](doc-342138)
          required: false
          example: '{{LOYALTY_CLUB_SLUG}}'
          schema:
            type: string
            default: '{{LOYALTY_CLUB_SLUG}}'
        - name: X-Customer
          in: header
          description: Customer for API context.  [Details](doc-342139)
          required: false
          example: '{{CUSTOMER_ID}}'
          schema:
            type: string
            default: '{{CUSTOMER_ID}}'
        - name: Authorization
          in: header
          description: '[Member](doc-342129) or [User](doc-342130) Authorization.'
          required: false
          example: Bearer {{_OAUTH_TOKEN}}
          schema:
            type: string
            default: Bearer {{_OAUTH_TOKEN}}
        - name: X-Client-Authorization
          in: header
          description: '[Token](doc-342128) Authorization.'
          example: '{{API_TOKEN}}'
          schema:
            type: string
            default: '{{API_TOKEN}}'
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - type: object
                  properties:
                    organization:
                      type: boolean
                      description: share with whole organization
                  x-apidog-orders:
                    - organization
                  required:
                    - organization
                  x-apidog-ignore-properties: []
                - type: object
                  properties:
                    customer_ids:
                      type: array
                      items:
                        type: integer
                        minimum: 1
                      description: share with specific customers
                  x-apidog-orders:
                    - customer_ids
                  required:
                    - customer_ids
                  x-apidog-ignore-properties: []
            examples:
              '1':
                value:
                  organization: true
                summary: Example 1
              '2':
                value:
                  customer_ids:
                    - 2277643
                summary: Example 2
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  template:
                    $ref: '#/components/schemas/Template'
                x-apidog-orders:
                  - template
                required:
                  - template
                x-apidog-ignore-properties: []
              example:
                template:
                  name: Robin Sawayn
                  type: generic
                  content:
                    language: ut
                    body: Hi {{name}}
                    subject: Welcome!
                    url: https://understated-guard.name/
                    image_url: https://loremflickr.com/400/400?lock=6254426832483057
                    data:
                      foo: bar
                    android_payload: {}
                    ios_payload: {}
                  translations: null
                  wrapper_id: null
                  sharing:
                    state: granted_to_organization
          headers: {}
          x-apidog-name: Success
        '404':
          description: ''
          content:
            application/json:
              schema:
                title: ''
                type: object
                properties:
                  error:
                    type: string
                    examples:
                      - Record not found
                x-apidog-orders:
                  - error
                required:
                  - error
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Record Not Found
        '422':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    examples:
                      - Invalid parameters
                    const: Invalid parameters
                  details:
                    type: object
                    properties: {}
                    x-apidog-orders: []
                    description: 'See: [Params Validation](doc-341637)'
                    additionalProperties: true
                    x-apidog-ignore-properties: []
                required:
                  - error
                  - details
                x-apidog-orders:
                  - error
                  - details
                x-apidog-ignore-properties: []
          headers: {}
          x-apidog-name: Invalid Parameters
      security: []
      x-apidog-folder: API Reference/Messaging API/Templates
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/346351/apis/api-4203904-run
components:
  schemas:
    Template:
      type: object
      properties:
        name:
          type: string
          description: Custom name for internal identification
        id: &ref_5
          $ref: '#/components/schemas/id'
          description: Primary identifier of the record
          readOnly: true
        type: &ref_10
          type: string
          enum:
            - plain
            - email
            - bee_email
            - push
            - generic
          x-apidog-enum:
            - value: plain
              name: ''
              description: ''
            - value: email
              name: ''
              description: ''
            - value: bee_email
              name: ''
              description: ''
            - value: push
              name: ''
              description: ''
            - value: generic
              name: ''
              description: ''
          description: 'See: [Template types](doc-354486#types)'
        content:
          oneOf:
            - &ref_0
              $ref: '#/components/schemas/Plain'
            - &ref_1
              $ref: '#/components/schemas/Email'
            - &ref_2
              $ref: '#/components/schemas/BeeEmail'
            - &ref_3
              $ref: '#/components/schemas/Push'
            - &ref_4
              $ref: '#/components/schemas/Generic'
        translations:
          type: array
          items:
            oneOf:
              - *ref_0
              - *ref_1
              - *ref_2
              - *ref_3
              - *ref_4
          description: >-
            See: [Internationalized
            content](doc-354486#internationalized-content)
          nullable: true
        wrapper_id:
          anyOf:
            - *ref_5
            - &ref_11
              type: 'null'
          description: >-
            ID of a [Standalone Template](doc-354680) that should
            [wrap](doc-354486#template-wrapping) this one
        merge_properties: &ref_12
          type: array
          items:
            type: string
            examples:
              - first_name
              - last_name
          readOnly: true
          description: >-
            List of all the [merge-properties](doc-354486#merge-properties)
            detected in the contect
        thumbnail_url: &ref_13
          type: string
          deprecated: true
          examples:
            - https://img.placewise.com/image.png
          readOnly: true
          nullable: true
        sharing:
          anyOf:
            - type: object
              properties:
                state:
                  type: string
                  const: received
                owner_id:
                  type: integer
              x-apidog-orders:
                - state
                - owner_id
              required:
                - state
                - owner_id
              x-apidog-ignore-properties: []
            - type: object
              properties:
                state:
                  type: string
                  const: granted_to_organization
              x-apidog-orders:
                - state
              required:
                - state
              x-apidog-ignore-properties: []
            - type: object
              properties:
                state:
                  type: string
                  const: granted_to_customers
                ids:
                  type: array
                  items:
                    type: integer
              x-apidog-orders:
                - state
                - ids
              required:
                - state
                - ids
              x-apidog-ignore-properties: []
            - type: object
              properties:
                state:
                  type: string
                  const: sharable
              x-apidog-orders:
                - state
              required:
                - state
              x-apidog-ignore-properties: []
            - type: object
              properties:
                state:
                  type: string
                  const: unsharable
              x-apidog-orders:
                - state
              required:
                - state
              x-apidog-ignore-properties: []
          description: check if template is shared
        created_at: &ref_9
          type: string
          description: Time at which the record was created
          format: date-time
          readOnly: true
          examples:
            - '2022-11-15T16:25:58.099512Z'
        updated_at: &ref_8
          type: string
          description: Time at which the record was updated
          format: date-time
          readOnly: true
          examples:
            - '2022-11-15T16:25:58.099512Z'
      required:
        - name
        - id
        - type
        - content
        - translations
        - wrapper_id
        - merge_properties
        - thumbnail_url
        - sharing
        - created_at
        - updated_at
      x-apidog-orders:
        - name
        - 01K4CQ19X49MHRSW4Z6PCDPZD9
        - sharing
        - 01K7EGSW00EVT8K7W6KMT1FJJN
        - 01K7EGTAZ30PMPXNFEF9GTXZWK
      x-apidog-refs:
        01K4CQ19X49MHRSW4Z6PCDPZD9:
          $ref: '#/components/schemas/Template%3A%3ACore'
        01K7EGSW00EVT8K7W6KMT1FJJN:
          $ref: '#/components/schemas/created_at'
        01K7EGTAZ30PMPXNFEF9GTXZWK:
          $ref: '#/components/schemas/updated_at'
      x-apidog-ignore-properties:
        - id
        - type
        - content
        - translations
        - wrapper_id
        - merge_properties
        - thumbnail_url
        - created_at
        - updated_at
      x-apidog-folder: ''
    Generic:
      type: object
      properties:
        language: &ref_6
          $ref: '#/components/schemas/language'
          description: >-
            [Language tag](doc-341959#suported-language-tags). See:
            [Internationalized content](doc-354486#internationalized-content)
        body:
          type: string
          title: ''
          examples:
            - Hi {{name}}
        subject:
          type: string
          examples:
            - Welcome!
          nullable: true
        preheader:
          type: string
          nullable: true
        url:
          type: string
          description: |
            URL to be used by mobile app for redirecting the user
          nullable: true
        image_url:
          type: string
          description: |
            URL of image to be displayed within push
          nullable: true
        data:
          type: object
          examples:
            - https://example.placewise.com/image.png
          properties: {}
          x-apidog-orders: []
          title: ''
          description: |
            Additional data to be passed to mobile app
          x-apidog-ignore-properties: []
          nullable: true
        android_payload:
          type: object
          properties: {}
          x-apidog-orders: []
          description: >-
            Additional android-specific payload [see
            more](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification)
          x-apidog-ignore-properties: []
          nullable: true
        ios_payload:
          type: object
          properties: {}
          x-apidog-orders: []
          description: >-
            Additional ios-specific payload [see
            more](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification#2943363)
          x-apidog-ignore-properties: []
          nullable: true
        footer:
          type: string
          examples:
            - 'To unsubscribe, send STOP to 2242 '
      x-apidog-orders:
        - 01K4D99PJ86J7BM5QPDVSBC1X1
        - body
        - subject
        - preheader
        - url
        - image_url
        - data
        - android_payload
        - ios_payload
        - footer
      required:
        - body
        - subject
        - preheader
        - url
        - image_url
        - data
        - android_payload
        - ios_payload
      x-apidog-refs:
        01K4D99PJ86J7BM5QPDVSBC1X1: &ref_7
          $ref: '#/components/schemas/language1'
      x-apidog-ignore-properties:
        - language
      x-apidog-folder: ''
    language:
      type: string
      description: 'See: [Supported language tags](doc-341959#suported-language-tags)'
      x-apidog-folder: ''
    language1:
      type: object
      properties:
        language: *ref_6
      x-apidog-orders:
        - language
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Push:
      type: object
      properties:
        language: *ref_6
        body:
          type: string
          title: ''
          examples:
            - Hi {{name}}
        subject:
          type: string
          examples:
            - Welcome!
          nullable: true
        url:
          type: string
          description: |
            URL to be used by mobile app for redirecting the user
          nullable: true
        image_url:
          type: string
          description: |
            URL of image to be displayed within push
          nullable: true
        data:
          type: object
          examples:
            - foo: bar
          properties: {}
          x-apidog-orders: []
          title: ''
          description: Additional data to be passed to mobile app
          x-apidog-ignore-properties: []
          nullable: true
        android_payload:
          type: object
          properties: {}
          x-apidog-orders: []
          description: >-
            Additional android-specific payload [see
            more](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#androidnotification)
          x-apidog-ignore-properties: []
          nullable: true
        ios_payload:
          type: object
          properties: {}
          x-apidog-orders: []
          description: >-
            Additional ios-specific payload [see
            more](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification#2943363)
          x-apidog-ignore-properties: []
          nullable: true
      x-apidog-orders:
        - 01K4D99802FW050SST12634SE7
        - body
        - subject
        - url
        - image_url
        - data
        - android_payload
        - ios_payload
      required:
        - body
        - subject
        - url
        - image_url
        - data
        - android_payload
        - ios_payload
      x-apidog-refs:
        01K4D99802FW050SST12634SE7: *ref_7
      x-apidog-ignore-properties:
        - language
      x-apidog-folder: ''
    BeeEmail:
      type: object
      properties:
        language: *ref_6
        body:
          type: string
          title: ''
          examples:
            - <b>Hei {{name}}</b>
          readOnly: true
        subject:
          type: string
          examples:
            - Welcome!
          nullable: true
        preheader:
          type: string
          examples:
            - Something informative
          nullable: true
        thumbnail:
          type: object
          properties:
            url:
              type: string
              description: Auto-generated preview of the email body
              examples:
                - https://example.placewise.com/image.png
              readOnly: true
          x-apidog-orders:
            - url
          required:
            - url
          readOnly: true
          x-apidog-ignore-properties: []
        bee_json:
          type: object
          properties: {}
          examples:
            - foo: bar
          x-apidog-orders: []
          description: JSON generated by [Beefree](https://docs.beefree.io/beefree-sdk)
          x-apidog-ignore-properties: []
          nullable: true
      x-apidog-orders:
        - 01K4D98T2CBAPKZQ6J0NX89ST6
        - body
        - subject
        - preheader
        - thumbnail
        - bee_json
      required:
        - body
        - subject
        - preheader
        - thumbnail
        - bee_json
      x-apidog-refs:
        01K4D98T2CBAPKZQ6J0NX89ST6: *ref_7
      x-apidog-ignore-properties:
        - language
      x-apidog-folder: ''
    Email:
      type: object
      properties:
        language: *ref_6
        body:
          type: string
          title: ''
          examples:
            - <b>Hei {{name}}</b>
        subject:
          type: string
          examples:
            - Welcome!
          nullable: true
        preheader:
          type: string
          examples:
            - Something informative
          nullable: true
        thumbnail:
          type: object
          properties:
            url:
              type: string
              description: Auto-generated preview of the email body
              examples:
                - https://example.placewise.com/image.png
              readOnly: true
          x-apidog-orders:
            - url
          required:
            - url
          readOnly: true
          x-apidog-ignore-properties: []
      x-apidog-orders:
        - 01K4D980ZER3D14Q0JFA9BSQCC
        - body
        - subject
        - preheader
        - thumbnail
      required:
        - body
        - subject
        - preheader
        - thumbnail
      x-apidog-refs:
        01K4D980ZER3D14Q0JFA9BSQCC: *ref_7
      x-apidog-ignore-properties:
        - language
      x-apidog-folder: ''
    Plain:
      type: object
      properties:
        language: *ref_6
        body:
          type: string
          title: ''
          examples:
            - Hei {{name}}
        footer:
          type: string
          examples:
            - 'To unsubscribe, send STOP to 2242 '
      x-apidog-orders:
        - 01K4JHYK3FA0PJJVS6FMVM6HCY
        - body
        - footer
      required:
        - body
      x-apidog-refs:
        01K4JHYK3FA0PJJVS6FMVM6HCY: *ref_7
      x-apidog-ignore-properties:
        - language
      x-apidog-folder: ''
    id:
      type: integer
      description: Primary identifier of the record
      format: uint64
      readOnly: true
      examples:
        - 1
      x-apidog-folder: ''
    updated_at:
      type: object
      properties:
        updated_at: *ref_8
      x-apidog-orders:
        - updated_at
      required:
        - updated_at
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    created_at:
      type: object
      properties:
        created_at: *ref_9
      x-apidog-orders:
        - created_at
      required:
        - created_at
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
    Template::Core:
      type: object
      properties:
        id: *ref_5
        type: *ref_10
        content:
          oneOf:
            - *ref_0
            - *ref_1
            - *ref_2
            - *ref_3
            - *ref_4
        translations:
          type: array
          items:
            oneOf:
              - *ref_0
              - *ref_1
              - *ref_2
              - *ref_3
              - *ref_4
          description: >-
            See: [Internationalized
            content](doc-354486#internationalized-content)
          nullable: true
        wrapper_id:
          anyOf:
            - *ref_5
            - *ref_11
          description: >-
            ID of a [Standalone Template](doc-354680) that should
            [wrap](doc-354486#template-wrapping) this one
        merge_properties: *ref_12
        thumbnail_url: *ref_13
      x-apidog-orders:
        - 01K7EGRYVSWH7VRS1YHWZRRRJW
        - type
        - content
        - translations
        - wrapper_id
        - merge_properties
        - thumbnail_url
      additional_properties: false
      required:
        - id
        - type
        - content
        - translations
        - wrapper_id
        - merge_properties
        - thumbnail_url
      readOnly: true
      x-apidog-refs:
        01K7EGRYVSWH7VRS1YHWZRRRJW:
          $ref: '#/components/schemas/id2'
      additionalProperties: false
      x-apidog-ignore-properties:
        - id
      x-apidog-folder: ''
    id2:
      type: object
      properties:
        id: *ref_5
      x-apidog-orders:
        - id
      required:
        - id
      x-apidog-ignore-properties: []
      x-apidog-folder: ''
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```