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

# Update a Folder

> Rename and/or move a folder. Rejects cycles.

Renames and/or moves a folder. Only the fields you send are changed (Pydantic `exclude_unset`), and `parent_id` is treated specially: to move a folder back to root, send `"parent_id": null` explicitly — the endpoint distinguishes that from omitting the field entirely.

Moving a folder rejects cycles: the endpoint fetches every folder in the org and walks the in-memory tree to find every descendant of the folder being moved (org folder counts are assumed small), then rejects the move with `400` if the proposed new parent is one of those descendants or is the folder itself — rather than corrupting the tree.

Folder names are unique per parent, case-insensitively — the same `(org_id, parent_id, lower(name))` constraint as [Create a Folder](/api-reference/folders/create-folder) — so renaming into a collision returns `409`.

### Auth

Requires a CRM manage [scope](/authentication#scopes) and an active organization on the token. Any `*:manage` scope qualifies — in practice `contacts:manage`, `deals:manage`, `companies:manage`, or `activities:manage`.

### Response

Returns the updated folder row (same shape as [List Folders](/api-reference/folders/list-folders)'s `folders[]`).

### Errors

| Status            | Cause                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `400 Bad Request` | No fields set; `name` empty after trimming; new `parent_id` equals `folder_id`; or new `parent_id` is a descendant of `folder_id` (would create a cycle).                                                                                                                                                                                                                                                                                                            |
| `404 Not Found`   | `folder_id` doesn't exist in this org.                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `409 Conflict`    | The rename/move collides with an existing sibling name. **Also returned if `parent_id` names a folder that doesn't exist** — unlike [Create a Folder](/api-reference/folders/create-folder), this endpoint doesn't pre-check that the new parent exists, so an invalid `parent_id` surfaces as the same foreign-key-driven `409` as a name collision. Verify the parent with [List Folders](/api-reference/folders/list-folders) first if you're not sure it exists. |


## OpenAPI

````yaml PATCH /folders/{folder_id}
openapi: 3.1.0
info:
  title: anycrm-api
  version: 0.0.1
servers: []
security: []
tags:
  - name: Customer Intelligence
    description: >-
      Company research and ICP-fit scoring — create a research run, track its
      progress, and read back scored companies as leads.
  - name: Outreach
    description: >-
      The cold-email management console — domains, mailboxes, and campaigns — as
      a thin control plane over the SalesForge stack.
  - name: AnyCard
    description: >-
      Authenticated CRUD for AnyCard, the org's digital business-card /
      lead-capture product.
  - name: AnyCard Events
    description: >-
      Event-attribution analytics for AnyCard — which captured leads converted,
      broken down by source, owner, and deal.
  - name: AnyCard Share Links
    description: >-
      Unauthenticated endpoints reached by anyone who scans a QR code or opens a
      shared AnyCard link.
  - name: AI
    description: >-
      A streaming (SSE) AI chat endpoint with account-commit actions it can take
      on the caller's behalf.
  - name: Analytics Assistant
    description: >-
      The natural-language analytics assistant — a guarded text-to-SQL loop
      (SSE) that answers ad-hoc questions over the org's CRM data as a
      least-privilege, read-only database role.
  - name: Account Readiness
    description: >-
      Account Readiness Profiles — AI-scored signals on whether an account is
      ready for outreach or expansion, computed via a Temporal workflow.
  - name: Integrations
    description: >-
      Pipedream Connect — issuing connect tokens and managing the org's
      connected third-party accounts.
  - name: Feedback
    description: >-
      User-submitted platform feedback (bug reports, feature requests) — global,
      not scoped to one organization.
  - name: Public Media
    description: >-
      Unauthenticated image reads for publicly-embeddable assets (card photos,
      inline email images) — allowlisted by key shape; everything else in the
      storage bucket stays private.
  - name: Service Health
    description: Service liveness.
paths:
  /folders/{folder_id}:
    patch:
      tags:
        - Folders
      summary: Patch Folder
      description: Rename and/or move a folder. Rejects cycles.
      operationId: patch_folder_folders__folder_id__patch
      parameters:
        - name: folder_id
          in: path
          required: true
          schema:
            type: string
            description: UUID of the folder to rename and/or move.
            title: Folder Id
          description: UUID of the folder to rename and/or move.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FolderPatchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Patch Folder Folders  Folder Id  Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    FolderPatchRequest:
      properties:
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: Renames the folder.
        parent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Id
          description: >-
            Moves the folder under this parent id; pass null explicitly to move
            it back to root. Rejected if it would create a cycle.
      type: object
      title: FolderPatchRequest
    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
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````