> ## 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.

# Delete a Folder

> Soft-delete a folder.

cascade=false (default): blocks if the folder has any non-archived child
folder or file (HTTP 409). cascade=true: soft-deletes the folder, every
descendant folder, and every file whose folder_id is in the subtree.

Soft-deletes a folder (sets `archived_at`). By default, refuses with `409` if the folder has any non-archived child folder or file. With `cascade=true`, it archives the folder, every descendant folder, and every file whose `folder_id` falls anywhere in that subtree — all in one call.

### 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

| Field          | Type      | Description                                                                                           |
| -------------- | --------- | ----------------------------------------------------------------------------------------------------- |
| `deleted`      | `boolean` | Always `true`.                                                                                        |
| `folder_count` | `integer` | Number of folders archived — the target folder plus its descendants (`1` if `cascade` wasn't needed). |
| `file_count`   | `integer` | Number of files archived as part of the cascade (`0` if none, or if `cascade` was `false`).           |

### Errors

| Status          | Cause                                                                                                                                      |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `404 Not Found` | `folder_id` doesn't exist among non-archived folders in this org.                                                                          |
| `409 Conflict`  | The folder has at least one descendant folder (at any depth), or a non-archived file anywhere in its subtree, and `cascade` wasn't `true`. |


## OpenAPI

````yaml DELETE /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}:
    delete:
      tags:
        - Folders
      summary: Delete Folder
      description: |-
        Soft-delete a folder.

        cascade=false (default): blocks if the folder has any non-archived child
        folder or file (HTTP 409). cascade=true: soft-deletes the folder, every
        descendant folder, and every file whose folder_id is in the subtree.
      operationId: delete_folder_folders__folder_id__delete
      parameters:
        - name: folder_id
          in: path
          required: true
          schema:
            type: string
            description: UUID of the folder to soft-delete.
            title: Folder Id
          description: UUID of the folder to soft-delete.
        - name: cascade
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              When true, also archives every descendant folder and every file in
              the subtree; when false (default), fails with 409 if the folder
              has any non-archived child folder or file.
            default: false
            title: Cascade
          description: >-
            When true, also archives every descendant folder and every file in
            the subtree; when false (default), fails with 409 if the folder has
            any non-archived child folder or file.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Delete Folder Folders  Folder Id  Delete
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    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

````