---
type: API Endpoint
title: "Delete"
description: "Endpoints for moving files and directories to the trash or deleting them outright."
tags: [api, terrain, endpoints, filesystem]
status: stable
generated: { by: process:okf-migration, at: 2026-07-29T00:00:00Z }
---
Deleting Files and/or Directories
---------------------------------
__URL Path__: /secured/filesystem/delete

__HTTP Method__: POST

__Action__: "delete"

__Error Codes__: ERR_NOT_A_FOLDER, ERR_DOES_NOT_EXIST, ERR_NOT_WRITEABLE, ERR_TOO_MANY_PATHS, ERR_NOT_A_USER

The ERR_TOO_MANY_PATHS error code is returned when all of the "paths" and the items and sub-directories under them exceed the maximum number of paths that can be processed by this endpoint.

__Request Parameters__:

__Request Body__:

    {
        "paths" : ["/tempZone/home/rods/test2"]
    }

"paths" can take a mix of files and directories.

__Response__:

    {
        "paths":["/tempZone/home/rods/test2"]
    }

__Curl Command__:

    curl -H "$AUTH_HEADER" -H "Content-Type:application/json" -d '{"paths" : ["/tempZone/home/rods/test2"]}' http://127.0.0.1:3000/secured/filesystem/delete?user=rods


Deleting all items in a Directory
--------------

__URL Path__: /secured/filesystem/delete-contents

__HTTP Method__: POST

__Action__: "delete"

__Error codes__: ERR_NOT_A_FOLDER, ERR_DOES_NOT_EXIST, ERR_NOT_WRITEABLE, ERR_TOO_MANY_PATHS, ERR_NOT_A_USER

The ERR_TOO_MANY_PATHS error code is returned when all items in the source directory and its sub-directories exceed the maximum number of paths that can be processed by this endpoint.

__Request Query Parameters__:

__Request Body__:

    {
        "path": "/tempZone/home/rods/test"
    }

__Response__:

    {
        "paths":[
            "/tempZone/home/rods/test/test1",
            "/tempZone/home/rods/test/test2"
        ]
    }

__Example ERR_TOO_MANY_PATHS Error Response__:

    {
        "error_code": "ERR_TOO_MANY_PATHS",
        "count": 250,
        "limit": 100
    }

__Curl Command__:

    curl -H "$AUTH_HEADER" -H "Content-Type:application/json" -d '{"path": "/tempZone/home/rods/test"}' http://127.0.0.1:3000/secured/filesystem/delete-contents
