This article is for Flatfile's Portal 2.0, Portal 3.0, and Workspaces. If you'd like to check out the latest version of the Flatfile Data Exchange Platform, click here!
In Flatfile, you now have the ability to automatically bulk delete batches that were uploaded prior to a specified date. These deletions can be automated using cron.
You can do this by accessing the API and sending a few simple commands:
https://api.us.flatfile.io/delete/batches?teamId=YOUR_TEAM_ID&olderThanUnit=hour&olderThanQuantity=1&sendEmail=true
Let’s go over the elements of this API call that allow you to customize your request.
First, `teamId` must be set to your team ID (the team ID that contains the batches you would like to delete).
Next, `olderThanUnit` must be `minute`, `hour`, `day`, `week`, or `month`. This specifies, as the name suggests, the units of the next element: `olderThanQuantity`.
`olderThanQuantity` defines the quantity of the units defined in `olderThanUnit`. For example, if `olderThanUnit=day` and `olderThanQuanity=4`, you will delete all batches older than 4 days.
Remember, just like with your other API requests, you must include the API key with the mandatory header `X-Api-Key`.
For additional reference, our API docs can be accessed here.