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

# Update Folder

Renames an existing folder. The new name must be unique within the folder's parent (or at root level). The folder must belong to a workspace accessible by the authenticated user.


## OpenAPI

````yaml PATCH /api/public/v2/folders/{folder_id}
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/public/v2/folders/{folder_id}:
    patch:
      tags:
        - folders
      summary: Update Folder
      operationId: update_folder_api_public_v2_folders_patch
      parameters:
        - name: folder_id
          in: path
          required: true
          schema:
            type: integer
            title: Folder ID
            description: The ID of the folder to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFolderRequest'
      responses:
        '200':
          description: Folder updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateFolderSuccessResponse'
        '400':
          description: Bad request - Folder with the same name already exists at this level
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FolderExistsError'
        '401':
          description: Unauthorized - Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '404':
          description: Folder not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FolderNotFoundError'
        '422':
          $ref: '#/components/responses/ValidationError'
components:
  schemas:
    UpdateFolderRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
          description: >-
            The new name for the folder. Must be unique within its parent
            folder.
      title: UpdateFolderRequest
    CreateFolderSuccessResponse:
      type: object
      properties:
        success:
          type: boolean
          description: Indicates if the operation was successful
        folder:
          $ref: '#/components/schemas/Folder'
      title: CreateFolderSuccessResponse
    FolderExistsError:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
      title: FolderExistsError
    UnauthorizedError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      title: UnauthorizedError
    FolderNotFoundError:
      type: object
      properties:
        success:
          type: boolean
        message:
          type: string
      title: FolderNotFoundError
    Folder:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier for the folder
        name:
          type: string
          description: The name of the folder
        created_at:
          type: string
          format: date-time
          description: Timestamp when the folder was created
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the folder was last updated
        path:
          type: array
          nullable: true
          items:
            type: object
          description: >-
            JSON array representing the folder hierarchy path. Contains the IDs
            and names of all parent folders. Null for root-level folders.
        workspace_id:
          type: integer
          description: ID of the workspace this folder belongs to
        parent_id:
          type: integer
          nullable: true
          description: ID of the parent folder. Null for root-level folders.
        external_ids:
          type: array
          items:
            $ref: '#/components/schemas/ExternalId'
          description: External ID mappings for the folder.
      title: Folder
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    ExternalId:
      properties:
        source:
          type: string
          maxLength: 128
          minLength: 1
          title: Source
          description: The external system or namespace that owns the ID.
        external_id:
          type: string
          maxLength: 512
          minLength: 1
          title: External Id
          description: The identifier for this entity in the external system.
      type: object
      required:
        - source
        - external_id
      additionalProperties: false
      title: ExternalId
      description: >-
        Customer-defined mapping between a PromptLayer entity and an external
        system identifier.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  responses:
    ValidationError:
      description: Validation error - request parameters or body are invalid.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/HTTPValidationError'
              - $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````