API Reference

Use the delete method to delete a file.

try {
  const id = 'file_id_here' // The ID of the file to delete.

  const [data, error] = await sdk.file.delete({
    id,
  });

  // Check for success
  if (error) {
    console.error("Failed to delete the file:", error);
  } else {
    console.log(`File with ID ${id} has been deleted.`);
  }
} catch (error) {
  console.error("An unexpected error occurred:", error.message);
}

Params

  • id (string): The ID of the file you want to delete.

Required API Key Permission

  • Delete File