Delete an uploaded context file permanently

You can permanently delete a context file using the REST API if you want to optimize storage.

Before you begin

  • You must have files:delete permission for the project.
  • You must know the file ID (UUID).

About this task

Deleting a context file hard-deletes its FileMetadata record and performs a best-effort deletion of the original and converted storage objects. However, it does not unbind the file from existing workflows. Any workflow task agent node previously linked to the file will retain its file UUID.

Note:
If you want to just remove the file from being referenced by a specific workflow, you can do that in the task agent step details view in the UI.

Procedure

  1. Retrieve the file ID from the workflow definition or file metadata:
    curl -X GET "https://<host>/api/v1/files/metadata?file_ids=<file-id>" \ -H "Authorization: Bearer <token>"
  2. Delete the file:
    curl -X DELETE "https://<host>/api/v1/files/<file-id>" \ -H "Authorization: Bearer <token>"

Results

  1. Confirm the file no longer exists. The expected response is 404 Not Found:
    curl -X GET "https://<host>/api/v1/files/<file-id>" \ -H "Authorization: Bearer <token>"
  2. Check that workflow definitions no longer reference the file ID.