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

# Add Template Section

> Add a new section to an existing template.



## OpenAPI

````yaml /api-reference/openapi-v1.json post /api/v1/templates/{template_id}/sections
openapi: 3.0.0
info:
  title: Artos API
  description: API for document generation, template management, and document organization
  version: 1.0.0
  contact:
    name: Artos Support
    email: internal@artosai.com
servers:
  - url: https://api.artosai.com
    description: Production server
  - url: http://localhost:8000
    description: Local development server
security:
  - bearerAuth: []
paths:
  /api/v1/templates/{template_id}/sections:
    post:
      tags:
        - Templates
      summary: Add Template Section
      description: Add a new section to an existing template.
      operationId: addTemplateSection
      parameters:
        - name: template_id
          in: path
          required: true
          description: UUID of template
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddTemplateSectionRequest'
            example:
              section_name: 3. Safety Summary
              level: 1
              order_index: 2
      responses:
        '200':
          description: Section added successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddTemplateSectionResponse'
        '400':
          description: Authentication errors
        '403':
          description: Unauthorized access
        '404':
          description: Template not found
        '500':
          description: Database operation failures
components:
  schemas:
    AddTemplateSectionRequest:
      type: object
      properties:
        section_name:
          type: string
          description: Name/title of the section
        level:
          type: integer
          description: Nesting level (1=top-level, 2=subsection, etc.)
        order_index:
          type: integer
          description: Position of section in the template (0-based)
      required:
        - section_name
        - level
        - order_index
    AddTemplateSectionResponse:
      type: object
      properties:
        message:
          type: string
          description: Success message
        section_id:
          type: string
          description: UUID of the created section
        template_id:
          type: string
          description: UUID of the parent template
        section_name:
          type: string
          description: Name of the created section
        level:
          type: integer
          description: Nesting level of the section
        order_index:
          type: integer
          description: Position of the section in the template
      required:
        - message
        - section_id
        - template_id
        - section_name
        - level
        - order_index
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Token provides organization-scoped access.

````