Remove a Filestack File with the REST API

For developers who deal with sensitive data, we offer the ability to remove access to files. This process wipes all traces of the file from our servers and deletes it out of temporary storage. If the file was originally pulled from a cloud source like google drive, the Filestack file link is deleted but the original file is not. However, if pickAndStore or another store method was used to make a copy of the original file, the remove request will delete the copy as well as the Filestack link to the file. Per REST, this is accomplished via a DELETE request to the file link

Important:

Filestack has added an additional layer of security that will be required in order to perform a remove call. This change is detailed here. The REMOVE REST API call now requires one of two possible methods for validating the request.

The remove request will not work with Filestack CDN urls and requires the use of urls in the format of https://www.filestackapi.com/api/file/FILESTACK_HANDLE

Example Remove Requests:

Note: unlike the other examples, these ones can't just be copied and pasted into a console, as deleting a file link only works once!

The first option for formatting a remove request is to include a valid filestack policy and signature with the remove permission. Details on creating and using Filestack policies and signatures can be found in the Security section of the documentation.

User and Password example

The request is accompanied by a base64 string containing the "App Secret" that can be found in the Security section of the developer portal under App Secret. The header string to be base64 encoded should look like this: 'app:TN6MAIP4XZHLFLX7RO2D77X4JU'. If you encode this at https://www.base64encode.org/ for example, you should receive: 'YXBwOlRONk1BSVA0WFpITEZMWDdSTzJENzdYNEpV'

You will need to have a valid Filestack policy and signature in order to perform the requested call. This allows you to select who can and cannot perform certain actions on your site. Read more about security and how to generate policies and signatures