Skip to main content
Delete a file or directory from the sandbox filesystem.

Basic Request

curl -X POST https://api.gravixlayer.com/v1/agents/sandboxes/{sandbox_id}/files/delete \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/home/user/old_file.txt"
  }'

Request Parameters

ParameterTypeRequiredDescription
pathstringYesPath to file or directory to delete

Response

{
  "message": "File deleted successfully",
  "path": "/home/user/old_file.txt"
}

Response Fields

FieldTypeDescription
messagestringSuccess message
pathstringPath of the deleted file or directory

Example: Delete Directory

curl -X POST https://api.gravixlayer.com/v1/agents/sandboxes/{sandbox_id}/files/delete \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "/home/user/temp_folder"
  }'

Safety Notes

  • Permanent deletion: Files cannot be recovered after deletion
  • Directory deletion: Deletes directory and all contents recursively
  • Path validation: Ensure correct path to avoid accidental deletion

Next Steps