Skip to content
Delete a mount file or folder

Delete a mount file or folder

Delete a file, or a folder with everything inside it, from a mount.

DELETE/api/v1/mounts/:mountId/files

Request#

TypeScript
const response = await fetch("https://api.smallworld.sh/api/v1/mounts/0199a1c4-5b6e-7a10-9c2d-3e4f5a6b7c8d/files?path=/guides", {
  method: "DELETE",
  headers: { Authorization: `Bearer ${apiKey}` },
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
const result = await response.json();

Use your server-side apiKey. Replace the example IDs.

Path parameters#

mountIdUUIDrequired

The mount's ID, returned as id when the mount was created.

Query parameters#

pathstringrequired

A path inside the mount, such as /guides/refunds.md for /workspace/docs/guides/refunds.md in a mount at /workspace/docs. guides/refunds.md names the same file. No empty, . or .. segments and no trailing slash. URL-encode it.

Responses#

Returns deleted: true after deletion succeeds.

200 response
{
  "deleted": true
}
More about this endpoint

This delete is direct: it skips the mount's settings, tool call hooks, and approvals, and takes effect at once. It appears in the mount's change log in the dashboard. Smallworld keeps no history of mount files, so it can't be undone.

A command that first saw something at this path before your delete and changes it, also one waiting for approval, has its changes to the mount discarded, with a notice in stderr.