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

# Get template

> Retrieve a template by ID, including its version history



## OpenAPI

````yaml get /v4/templates/{templateId}
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}:
    get:
      tags:
        - Templates
      summary: Get template by ID
      description: Retrieve a template with all its published versions
      parameters:
        - name: templateId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Template ID
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateDetailResponseBody'
        '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:
    TemplateDetailResponseBody:
      type: object
      properties:
        error:
          type: boolean
          enum:
            - false
          description: Error flag (always false on success)
        data:
          type: object
          properties:
            id:
              type: string
              format: uuid
              description: Template ID
            name:
              type: string
              description: Template name
            description:
              type: string
              description: Template description
              nullable: true
            teamId:
              type: string
              format: uuid
              description: Owning team ID
            latestVersion:
              type: number
              description: Latest published version number
              nullable: true
            workflowCount:
              type: number
              description: Number of workflows linked to this template
            hasPrompt:
              type: boolean
              description: Whether the latest version has a prompt
            hasSchema:
              type: boolean
              description: Whether the latest version has a schema
            hasSchemaValidationRules:
              type: boolean
              description: Whether the latest version has schema validation rules
            hasNotifications:
              type: boolean
              description: Whether the latest version has notification settings
            hasFrequency:
              type: boolean
              description: Whether the latest version controls frequency
            archivedAt:
              type: string
              description: Archive timestamp (null if active)
              nullable: true
            createdAt:
              type: string
              description: Creation timestamp
            updatedAt:
              type: string
              description: Last update timestamp
            versions:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: Version row ID
                  templateId:
                    type: string
                    format: uuid
                    description: Parent template ID
                  version:
                    type: number
                    description: Version number
                  name:
                    type: string
                    description: Custom display name (null = default 'v.N')
                    nullable: true
                  prompt:
                    type: string
                    description: User prompt
                    nullable: true
                  schemaId:
                    type: string
                    format: uuid
                    description: Referenced data_schemas ID
                    nullable: true
                  schemaFields:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          description: Field name
                        description:
                          type: string
                          description: Field description
                        fieldType:
                          type: string
                          description: Field type (SCHEMA, CLASSIFICATION, etc.)
                        example:
                          nullable: true
                          description: >-
                            Example value (string, array, or object for
                            OBJECT/ARRAY dataTypes)
                        dataType:
                          type: string
                          description: Data type (STRING, NUMBER, DATE, LINK, etc.)
                        isKey:
                          type: boolean
                          description: >-
                            Marks this field as part of the record's primary
                            key. Key fields define row identity across runs and
                            enable data linking (records with the same key
                            values are treated as the same record over time,
                            used for dedupe and change detection). Set true ONLY
                            when the field is (1) unique per record on the
                            source, (2) stable across runs (does not change for
                            the same logical record), and (3) reliably present
                            (not nullable/missing). Key fields should be scalar
                            STRING, NUMBER, or LINK fields; avoid structured,
                            semantic, boolean, image, and timestamp/date fields
                            as keys. Good candidates: external IDs, SKUs,
                            canonical URLs, posting IDs. Bad candidates: prices,
                            counts, timestamps, free-text titles/descriptions,
                            or anything that can change between runs. Multiple
                            fields may be marked isKey to form a composite key
                            (all parts must hold the same guarantees). If no
                            field satisfies these guarantees, leave isKey unset
                            on every field — data linking will simply be
                            disabled, which is preferable to a wrong key.
                            Choosing a non-stable or non-unique key causes
                            duplicate rows and missed updates.
                        categories:
                          type: array
                          items:
                            type: object
                            properties:
                              title:
                                type: string
                                description: Short title/label of the category
                              definition:
                                type: string
                                description: Full definition/description of the category
                            required:
                              - title
                              - definition
                          description: Predefined categories for CLASSIFICATION fields
                      required:
                        - name
                    nullable: true
                    description: Resolved schema fields from data_schemas
                  schemaValidationRules:
                    type: object
                    additionalProperties:
                      type: object
                      additionalProperties:
                        nullable: true
                    description: Schema validation rules for this version
                    nullable: true
                  notifications:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: Notification configuration ID
                        eventType:
                          type: string
                          description: Event type (e.g., workflow_finished, error)
                        eventConfiguration:
                          type: object
                          additionalProperties:
                            nullable: true
                          description: Event-specific config
                        enabled:
                          type: boolean
                          description: Whether this notification is enabled
                        channels:
                          type: array
                          items:
                            type: object
                            properties:
                              channelId:
                                type: string
                                format: uuid
                              channelName:
                                type: string
                              channelType:
                                type: string
                            required:
                              - channelId
                              - channelName
                              - channelType
                          description: Linked notification channels
                      required:
                        - id
                        - eventType
                        - eventConfiguration
                        - enabled
                        - channels
                  frequency:
                    type: object
                    properties:
                      interval:
                        type: string
                        enum:
                          - ONLY_ONCE
                          - EVERY_10_MINUTES
                          - HALF_HOURLY
                          - HOURLY
                          - THREE_HOURLY
                          - SIX_HOURLY
                          - TWELVE_HOURLY
                          - EIGHTEEN_HOURLY
                          - DAILY
                          - TWO_DAY
                          - THREE_DAY
                          - WEEKLY
                          - BIWEEKLY
                          - TRIWEEKLY
                          - FOUR_WEEKS
                          - MONTHLY
                          - REAL_TIME
                          - CUSTOM
                        description: >-
                          Update interval enum
                          (HOURLY/DAILY/REAL_TIME/CUSTOM/...). When CUSTOM,
                          schedules must be provided.
                      schedules:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - repeat
                                - cron
                              description: Schedule type
                            interval:
                              type: string
                              description: Repeat token (e.g., '1h', '1d') when type=repeat
                            expressions:
                              type: array
                              items:
                                type: string
                              description: Cron expressions when type=cron
                          required:
                            - type
                        description: >-
                          Cron/repeat schedule specs. Required when
                          interval=CUSTOM.
                    description: Frequency configuration for this version
                    nullable: true
                  createdAt:
                    type: string
                    description: Creation timestamp
                  schemaName:
                    type: string
                    nullable: true
                    description: Name of the linked schema
                  schemaEntity:
                    type: string
                    nullable: true
                    description: Entity name from the linked schema
                required:
                  - id
                  - templateId
                  - version
                  - name
                  - prompt
                  - schemaId
                  - frequency
                  - createdAt
              description: All published versions
          required:
            - id
            - name
            - description
            - teamId
            - latestVersion
            - archivedAt
            - createdAt
            - updatedAt
            - versions
          description: Template with versions
      required:
        - error
        - data
      title: TemplateDetailResponseBody
      description: Response wrapper for template detail
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API key for authentication

````