> ## 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.

# Get Template Diff

> List what the next [commit](/reference/commit-template-v2) would make live: the template properties and the variants whose draft differs from the live version. Each changed variant also shows whether it's deleted in the draft and any validation errors that would block its commit.

Use it to choose which variants to pass in `variants` when you commit. This call doesn't change the template.




## OpenAPI

````yaml POST /v2/{workspace}/template/{template_slug}/pre_commit_validate/
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}/pre_commit_validate/:
    post:
      summary: Get Template Diff
      description: >
        List what the next [commit](/reference/commit-template-v2) would make
        live: the template properties and the variants whose draft differs from
        the live version. Each changed variant also shows whether it's deleted
        in the draft and any validation errors that would block its commit.


        Use it to choose which variants to pass in `variants` when you commit.
        This call doesn't change the template.
      operationId: get-template-diff-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: Template slug.
      responses:
        '201':
          description: >-
            The uncommitted changes. Empty `properties` and `variants` mean
            there's nothing to commit.
          content:
            application/json:
              schema:
                type: object
                properties:
                  is_new:
                    type: boolean
                    description: >-
                      `true` if the template has never been committed. Every
                      property is then listed as changed.
                  has_changes:
                    type: boolean
                    description: '`true` if the draft differs from the live version.'
                  properties:
                    type: object
                    description: >-
                      Changed template properties, keyed by property name
                      (`name`, `description`, `tags`, `enabled_channels`,
                      `mock_data`). Unchanged properties are left out.
                    additionalProperties:
                      type: object
                      properties:
                        has_diff:
                          type: boolean
                          description: >-
                            `true` if the draft value differs from the live
                            value.
                        draft:
                          description: Value in the draft. Not returned for `mock_data`.
                        live:
                          description: >-
                            Value in the live version, or `null` if it isn't
                            set. Not returned for `mock_data`.
                  variants:
                    type: array
                    description: >-
                      Variants whose draft differs from the live version.
                      Unchanged variants are left out.
                    items:
                      type: object
                      properties:
                        channel:
                          type: string
                          description: Channel of the variant.
                        id:
                          type: string
                          description: >-
                            Variant ID. Pass `channel` and `id` in `variants` to
                            [commit](/reference/commit-template-v2) this
                            variant.
                        has_diff:
                          type: boolean
                          description: '`true` if the variant has uncommitted changes.'
                        diffs:
                          type: object
                          description: >-
                            Fields that differ between the draft and live
                            variant, each with its `draft` and `live` value.
                            `variant_hash` changes whenever the variant's
                            content or settings change.
                        is_deleted:
                          type: boolean
                          description: >-
                            `true` if the variant is deleted in the draft.
                            Committing it removes it from the live version.
                        errors:
                          type: object
                          description: >-
                            Validation errors, keyed by field. Committing this
                            variant fails with `400` until they're fixed.
                            Returned only when the variant has errors.
              examples:
                changes:
                  summary: Edited, deleted and invalid variants
                  value:
                    is_new: false
                    has_changes: true
                    properties:
                      description:
                        has_diff: true
                        draft: Sent when an order is placed
                        live: null
                    variants:
                      - channel: sms
                        id: default
                        has_diff: true
                        diffs:
                          variant_hash:
                            draft: >-
                              8a06e6d59036a7e37fe1af062f2d0d964385a947f7952466a051a2e123a88204
                            live: >-
                              808a2c24fd4c5d6bd860fe49ad98344f38c3635d525f10100cd19543c92dbe0e
                          seq_no:
                            draft: 1
                            live: 1
                      - channel: sms
                        id: de
                        has_diff: true
                        is_deleted: true
                      - channel: sms
                        id: es
                        has_diff: true
                        errors:
                          body:
                            - missing
                            - missing
                no-changes:
                  summary: Nothing to commit
                  value:
                    is_new: false
                    has_changes: false
                    properties: {}
                    variants: []
        '401':
          $ref: '#/components/responses/AuthenticationError'
        '404':
          description: No template with this slug.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 404
                error_code: not_found
                type: NotFound
                message: 'template (slug: ''order-shipped'') not found'
                detail: 'template (slug: ''order-shipped'') not found'
      security:
        - ServiceTokenAuth: []
      servers:
        - url: https://management-api.suprsend.com
      x-codeSamples:
        - lang: cURL
          label: Get Template Diff
          source: >
            curl -X POST
            "https://management-api.suprsend.com/v2/{workspace}/template/{template_slug}/pre_commit_validate/"
            \
              --header 'Authorization: ServiceToken <token>'
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:
          oneOf:
            - type: string
            - type: object
            - type: array
              items:
                type: string
          description: >-
            Additional error details. A string for most errors. For validation
            errors, either an object mapping field names to their error
            messages, or an array of messages when the error is not tied to a
            field.
  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: Authorization
      description: >-
        Pass as `Authorization: ServiceToken <token>`. You can get Service Token
        from [SuprSend dashboard -> Account Settings -> Service
        Tokens](https://app.suprsend.com/en/account-settings/service-tokens)
        section.

````

## Related topics

- [Commit Template](https://docs.suprsend.com/reference/commit-template-v2.md)
- [Get Template](https://docs.suprsend.com/reference/cli-template-get.md)
- [Get Template Detail](https://docs.suprsend.com/reference/get-template-v2.md)
- [Get Translation](https://docs.suprsend.com/reference/cli-translation-get.md)
- [Tool list](https://docs.suprsend.com/reference/mcp-tool-list.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.