πŸ—‘οΈDelete File

You can delete any uploaded file using the given function.

Only files in the Annual Plan can be deleted. Files in the Permanent Plan cannot be deleted.

const deleteFile = async () => {
  /*
    @param {string} apiKey - Your API key.
    @param {string} fileId - The unique file ID (UUID) of the file you want to delete.
                             Note: This is different from the file CID.
                             You can get fileId from lighthouse.getUploads() 
                             or refer to the List Files section in docs.
  */
  const response = await lighthouse.deleteFile(
    "YOUR_API_KEY",
    "b5f60ba0-b708-41a3-b0f2-5c808ce63b48"
  );

  console.log(response);

  /* Sample response
    {
      "message": "File deleted successfully",
    }
  */
};

deleteFile();

Note:

  • The id parameter is required and should be the unique identifier of the file you want to delete.

  • The file ID is different from the file CID. It is a UUID of the file. You can get it from lighthouse.getUploads() or refer to the List Files section.

  • Once deleted, the file cannot be recovered.

Last updated

Was this helpful?