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

# Create Persona Template

> Creates a new template.



## OpenAPI

````yaml POST /ext/template
openapi: 3.0.3
info:
  title: TruGen Developer Platform API
  version: 1.0.0
  description: OpenAPI specification for MCP endpoint
servers:
  - url: https://api.trugen.ai/v1
security: []
paths:
  /ext/template:
    post:
      summary: Create a new Template
      description: Creates a new template.
      operationId: createTemplate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                template_name:
                  type: string
                  description: Name of the template
                  example: HR Assistant
                template_system_prompt:
                  type: string
                  description: System prompt text used by the template
                  example: You are a helpful HR AI Assistant.
                config:
                  type: object
                  description: Settings and configuration for the template
                  properties:
                    maxCallDuration:
                      type: integer
                      description: Maximum allowed call duration in seconds
                      example: 5
                    conversationalContext:
                      type: string
                      description: Context for maintaining conversation across calls
                      example: ''
                knowledge_base:
                  type: array
                  description: List of knowledge bases attached to this agent.
                  nullable: true
                  items:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                        description: Knowledge base identifier.
                        example: ac79226e-73e1-41fe-8cde-469ae4e244fa
                      name:
                        type: string
                        description: Name of the knowledge base.
                        example: Product Support Articles
                      description:
                        type: string
                        description: Short summary of the knowledge base content.
                        example: >-
                          Contains FAQs and troubleshooting guides for product
                          lines.
                record:
                  type: boolean
                  description: Whether the call should be recorded
                  example: true
      responses:
        '201':
          description: Template created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: Unique ID of the newly created template.
                    example: d65a4f92-44b1-4fe6-b2ac-a1cb66366ddc
                  message:
                    type: string
                    example: Template created successfully
        '400':
          description: Invalid request body
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Invalid request body
        '401':
          description: Unauthorized – missing or invalid API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: 'Unauthorized: not a valid authorization api key'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
              example:
                error: Failed to retrieve template details
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````