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

# Delete by Path

> Delete the file or folder at a path. Folders are deleted recursively.

<Note>
  **Destructive operation:** Folder deletion is recursive and permanent. The project root (`/`) cannot be deleted.
</Note>

## What this does

Deletes whatever exists at the given path. If the path is a folder, all files and subfolders within it are deleted recursively. Returns `204 No Content` on success with no response body.

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE \
    "https://api.cloudsquid.io/api/projects/my-project/files?path=/invoices/2024/jan.pdf" \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  response = requests.delete(
      "https://api.cloudsquid.io/api/projects/my-project/files",
      params={"path": "/invoices/2024/jan.pdf"},
      headers={"X-API-Key": "YOUR_API_KEY"}
  )
  assert response.status_code == 204
  ```

  ```javascript JavaScript theme={null}
  await fetch(
    "https://api.cloudsquid.io/api/projects/my-project/files?path=/invoices/2024/jan.pdf",
    {
      method: "DELETE",
      headers: { "X-API-Key": "YOUR_API_KEY" }
    }
  );
  ```
</CodeGroup>

Response: `204 No Content` (empty body)


## OpenAPI

````yaml delete /projects/{project_name}/files
openapi: 3.0.3
info:
  title: Cloudsquid
  description: This is the backend of cloudsquid specification
  termsOfService: cloudsquid.io
  contact:
    email: info@cloudsquid.io
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.11
servers:
  - url: https://api.cloudsquid.io/api
    description: API
security:
  - api-key: []
paths:
  /projects/{project_name}/files:
    parameters:
      - name: project_name
        in: path
        required: true
        description: The name of the project
        schema:
          type: string
    delete:
      tags:
        - filesystem
      summary: Delete a path
      description: >
        Delete the file or folder at the given path. Folders are deleted
        recursively.

        The project root cannot be deleted.
      parameters:
        - name: path
          in: query
          required: true
          description: Absolute path inside the project (cannot be empty or `/`)
          schema:
            type: string
      responses:
        '204':
          description: Deleted
        '400':
          description: Bad or malformed request (invalid path, root deletion attempted)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Path does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Something unexpected happened
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        errorMessage:
          type: string
      required:
        - errorMessage
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: X-API-Key

````