How to Configure Data Retention Policies in Flatfile
Last updated: October 10, 2025
Introduction
This guide will walk you through how to set up and manage data retention policies in Flatfile to automatically manage the lifecycle of your data.
Prerequisites
Enterprise contract (for automatic data retention features)
API access to Flatfile
Steps
Understanding Data Retention Scope
Data retention policies are configured at the environment level only
The default retention period is 365 days
Creating a Data Retention Policy
Use the API endpoint at https://reference.flatfile.com/api-reference/data-retention-policies/create
Specify the period in days (minimum value is 1)
Configure parameters like lastActivity or sinceCreated based on your needs
Tips
When a space expires, all its associated workbooks are automatically expired
There is no maximum limit to the retention period you can set
For custom retention logic, you can utilize cron events in your server-side listener
Troubleshooting
If you don't see retention settings in the UI, these must be configured via API
Retention policies cannot be set at the space, workbook, or account level - only at the environment level