API Documentation

SFTP Delete File or Directory

Delete a file or directory on a VPS. By default, only files and empty directories are removed; pass recursive: true to remove a directory and its contents. A small set of root system paths (/, /usr, /etc, /var, /home) are always rejected.

Required scope: vps:manage

Path Parameters

Parameter Type Description
id string The VPS ID

Headers

Header Required Value
Authorization Yes Bearer YOUR_API_KEY
Content-Type Yes application/json

Request Body

Field Type Required Description
path string Yes Absolute path of the file or directory to delete
recursive boolean No When true, delete a directory and all of its contents (default: false)
{
  "path": "/tmp/build-cache",
  "recursive": true
}

Response

{
  "data": {
    "path": "/tmp/build-cache",
    "deleted": true,
    "recursive": true
  }
}

Response Fields

Field Type Description
path string Normalized absolute path that was deleted
deleted boolean Always true on success
recursive boolean Whether recursive mode was used

Errors

Status Code Description
400 INVALID_BODY Request body is not valid JSON
400 INVALID_PATH Path is not absolute or is a protected root directory
400 DELETE_FAILED Generic deletion failure
403 DELETE_FAILED Permission denied on the target path
404 NOT_FOUND VPS not found, not accessible, or path does not exist
409 DELETE_FAILED Directory is not empty (omit recursive: true and try again)
502 SSH_AUTH SSH authentication failed
502 SSH_CONN Could not connect to VPS
504 SSH_TIMEOUT SSH command timed out

Example

curl -X DELETE "https://site.quest/api/v1/vps/699cdea2ab57a244bb5273fd/sftp/delete" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"path": "/tmp/build-cache", "recursive": true}'

MCP

This endpoint is not yet wrapped as an MCP tool. Use the REST endpoint above directly.