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

# Create a generative UI template for an agent



## OpenAPI

````yaml post /api/generative-ui-templates/{agent_name}
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/generative-ui-templates/{agent_name}:
    post:
      tags:
        - Generative UI Templates
      summary: Create a generative UI template for an agent
      operationId: generative_ui_template_create
      parameters:
        - name: agent_name
          in: path
          required: true
          schema:
            type: string
            title: Agent Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerativeUITemplateCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerativeUITemplateResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    GenerativeUITemplateCreate:
      properties:
        template_id:
          type: string
          title: Template Id
          description: Client-provided unique template id
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Human-readable description
        generative_spec:
          additionalProperties: true
          type: object
          title: Generative Spec
          description: json-render layout (e.g. root, elements, state)
      type: object
      required:
        - template_id
        - generative_spec
      title: GenerativeUITemplateCreate
    GenerativeUITemplateResponse:
      properties:
        id:
          type: string
          title: Id
          description: Template id
        agent_name:
          type: string
          title: Agent Name
          description: Owning agent (normalized)
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description
        generative_spec:
          additionalProperties: true
          type: object
          title: Generative Spec
          description: json-render spec
        created_by:
          anyOf:
            - type: string
            - type: 'null'
          title: Created By
          description: Creator identifier
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
          description: Creation time (ISO)
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
          description: Last update time (ISO)
      type: object
      required:
        - id
        - agent_name
        - generative_spec
      title: GenerativeUITemplateResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````