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

# Create folder

> Creates a folder at the top level or inside another folder.



## OpenAPI

````yaml /api-reference/rest/openapi.yaml post /v1/knowledge-bases/folders
openapi: 3.1.0
info:
  title: Zero Runtime REST API
  version: '1.0'
  description: >-
    Create, configure, version and deploy agents, and wire SIP telephony to
    them.
servers:
  - url: https://api.zeroruntime.ai
security:
  - token: []
tags:
  - name: Agents
  - name: Versions
  - name: Deployment
  - name: Phone numbers
  - name: Routing rules
  - name: Calls
  - name: Batch calls
  - name: Knowledge bases
  - name: Knowledge base folders
paths:
  /v1/knowledge-bases/folders:
    post:
      tags:
        - Knowledge base folders
      summary: Create folder
      description: Creates a folder at the top level or inside another folder.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 80
                  description: Must be unique among the folders next to it.
                  example: Pricing
                parentId:
                  type:
                    - string
                    - 'null'
                  description: >-
                    The folder to create it in. Leave it out for a top-level
                    folder. Folders nest up to 5 levels deep.
                  example: f4p9z
      responses:
        '201':
          description: The new folder.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeFolder'
              example:
                folderId: m2c7r
                name: Pricing
                parentId: f4p9z
                depth: 2
                docCount: 0
                totalDocCount: 0
                createdAt: '2026-10-13T09:05:00.000Z'
                updatedAt: '2026-10-13T09:05:00.000Z'
        '400':
          description: The body didn't validate.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: The parent folder doesn't exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
              example:
                message: Parent folder not found
        '409':
          description: |
            One of:

            - `A folder with that name already exists here`
            - `Folders cannot be nested more than 5 levels deep`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
              example:
                message: A folder with that name already exists here
components:
  schemas:
    KnowledgeFolder:
      type: object
      properties:
        folderId:
          type: string
          example: f4p9z
        name:
          type: string
          example: Product docs
        parentId:
          type:
            - string
            - 'null'
        depth:
          type: integer
          description: '`1` for a top-level folder.'
        docCount:
          type: integer
          description: Knowledge bases directly in this folder.
        totalDocCount:
          type: integer
          description: Knowledge bases in this folder and its subfolders.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    KnowledgeBaseValidationError:
      type: object
      properties:
        message:
          type: string
          example: Invalid payload
        errors:
          type: object
          description: Every problem found, grouped by field.
          properties:
            formErrors:
              type: array
              items:
                type: string
            fieldErrors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
    Message:
      type: object
      properties:
        message:
          type: string
    Error:
      type: object
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: Missing or invalid `Authorization` header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    token:
      type: apiKey
      in: header
      name: Authorization
      description: Your API token, sent raw (no `Bearer` prefix).
      x-default: <auth-token>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.