DELETE
/
boxes
/
{boxId}
/
fs
JavaScript
import GboxSDK from "gbox-sdk";

const gboxSDK = new GboxSDK({
  apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
});

async function main() {
  const box = await gboxSDK.create({ type: "linux" });

  // Delete a file
  const deleteResult = await box.fs.remove({
    path: "/home/user/example.txt"
  });

  console.log("File deleted successfully:", deleteResult.message);

  // Delete a directory
  const deleteDirResult = await box.fs.remove({
    path: "/home/user/temp_folder"
  });

  console.log("Directory deleted successfully:", deleteDirResult.message);
}

main();
{
  "message": "File/Directory deleted successfully"
}

Authorizations

Authorization
string
header
required

Enter your API Key in the format: Bearer <token>. Get it from https://gbox.ai

Path Parameters

boxId
string
required

Box ID

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

Body

application/json

Request parameters for deleting a file/directory

Response

200
application/json

Delete file/dir

Response after deleting file/directory