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

# Preview schema change

> Preview the data a schema change would produce for one linked workflow, without applying the template or running the workflow



## OpenAPI

````yaml post /v4/templates/{templateId}/preview-schema-change
openapi: 3.0.3
info:
  title: Kadoa API
  version: 3.0.0
  contact:
    name: Support
    email: support@kadoa.com
servers:
  - url: https://api.kadoa.com
security: []
paths:
  /v4/templates/{templateId}/preview-schema-change:
    post:
      tags:
        - Templates
      summary: Preview schema change
      description: >-
        Preview the data a schema change would produce for one linked workflow,
        without applying the template or running the workflow
      parameters:
        - name: templateId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Template ID
      requestBody:
        description: Body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SchemaChangePreviewBody'
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SchemaChangePreviewResponse'
        '400':
          description: '400'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
        '401':
          description: '401'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
        '404':
          description: '404'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
        '500':
          description: '500'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: boolean
                    description: Indicates an error occurred
                  message:
                    type: string
                    description: Error message
                  details:
                    nullable: true
                    description: Additional error details (e.g., validation errors)
                required:
                  - error
                  - message
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SchemaChangePreviewBody:
      type: object
      properties:
        workflowId:
          type: string
          format: uuid
          description: Linked workflow to preview
        targetVersion:
          type: integer
          minimum: 1
          description: Template version to preview
      required:
        - workflowId
        - targetVersion
      title: SchemaChangePreviewBody
      description: Request body for previewing a schema change without applying it
    SchemaChangePreviewResponse:
      type: object
      properties:
        error:
          type: boolean
          enum:
            - false
          description: Error flag (always false on success)
        data:
          type: object
          properties:
            workflowId:
              type: string
              format: uuid
            workflowName:
              type: string
            currentVersion:
              type: integer
              minimum: 1
            targetVersion:
              type: integer
              minimum: 1
            basis:
              type: string
              enum:
                - existing_data
                - configuration_only
            columns:
              type: array
              items:
                type: object
                properties:
                  name:
                    type: string
                    minLength: 1
                  label:
                    type: string
                    minLength: 1
                  dataType:
                    type: string
                    minLength: 1
                    description: >-
                      Target datatype, or the previous datatype for a removed
                      field
                  previousDataType:
                    type: string
                    minLength: 1
                    description: Effective datatype before the schema change, if any
                    nullable: true
                  beforeValueSource:
                    type: string
                    enum:
                      - observed
                      - none
                    description: >-
                      Where the before value came from: observed in stored
                      output, or none
                  afterValueSource:
                    type: string
                    enum:
                      - observed
                      - simulated
                      - none
                    description: >-
                      Where the after value came from: observed, simulated by
                      the model, or none
                  truncated:
                    type: boolean
                    description: >-
                      Whether a value for this field was truncated to fit the
                      preview budget; absent means not truncated
                  status:
                    type: string
                    enum:
                      - unchanged
                      - removed
                      - added
                      - updated
                required:
                  - name
                  - label
                  - dataType
                  - previousDataType
                  - beforeValueSource
                  - afterValueSource
                  - status
            beforeRows:
              type: array
              items:
                type: object
                additionalProperties:
                  nullable: true
              maxItems: 10
            rows:
              type: array
              items:
                type: object
                additionalProperties:
                  nullable: true
              maxItems: 10
            truncated:
              type: boolean
              description: Whether any preview value was truncated to fit the data budget
          required:
            - workflowId
            - workflowName
            - currentVersion
            - targetVersion
            - basis
            - columns
            - beforeRows
            - rows
            - truncated
      required:
        - error
        - data
      title: SchemaChangePreviewResponse
      description: >-
        Read-only AI-generated preview of how a schema change affects one linked
        workflow's data
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````