Skip to main content
Box Employee
May 22, 2025 6:54 AM UTC
Question

Box API - Create Folder and enable "Auto-Delete on selected date"

I'm looking at the API for "Create Folder" and I don't see any mention of the "Auto-Delete" inside the JSON payload. I see where to configure 'Sharing' and 'Email upload'... Is this actually an option? Can I configure a folder and then set it to auto delete 90 days after creation all via the API?

    7 replies

    Box Employee
    May 22, 2025 6:54 AM UTC

    Hey ,

     

    You can achieve that by either calling the delete folder endpoint or by using the Box Retention Policy endpoint to determine a duration that a folder cannot be deleted. At the end of this period(90 days in this case) you can choose to: permanently delete or remove the retention policy from the folder.

     

    Let me know if this is helpful or if you have any other questions, thank you! 

    Translate
    Box Employee
    May 22, 2025 6:54 AM UTC

    The idea is to not have to need to make an additional API call (90 days later) to delete the folder. There is a setting in box at both the folder and file level that allows you to set it to delete (move to trash) on a specified date. I'm trying to figure out if I can configure that setting via the API (Create Folder or Update Folder) or some other API call to manage the settings on the folder. 

    Translate
    Box Employee
    May 22, 2025 6:54 AM UTC

     Unfortunately, that setting is not currently supported via the Update Folder API endpoint.

    Translate
    Box Employee
    May 22, 2025 6:54 AM UTC

    Is there any option for automating this function via the API or SDK? 

    Translate
    Box Employee
    May 22, 2025 6:54 AM UTC

     As  mentioned, Box offers Governance features like Retention Policies, which can be used to ensure a file is not deleted for some amount of time and then delete it at the end of that period.  However, aside from that, there is not a simple feature in the API or SDK to perform this functionality automatically.

    Translate
    Box Employee
    May 22, 2025 6:54 AM UTC

    "Governance features" - Does this require additional cost/features for Box? And are those Governance features available via SDK/API? 

    Translate
    Box Employee
    May 22, 2025 6:54 AM UTC

    Yes, Governance is generally sold as an add-on feature to enterprise accounts.  The Retention Policies feature I mentioned is available in our API and is supported in our SDKs.

    Translate