Create a Lifecycle Rule with the Native API
    • Dark
      Light

    Create a Lifecycle Rule with the Native API

    • Dark
      Light

    Article Summary

    Lifecycle Rules enable the Backblaze B2 Cloud Storage service to automatically hide and delete older versions of your files that are stored in Backblaze B2. Each Backblaze B2 bucket can have its own Lifecycle Rules, and you can apply Lifecycle Rules to some or all of the files in your bucket.

    The following API calls are related to Lifecycle Rules:

    • b2_create_bucket This operation creates a new bucket.
    • b2_update_bucket This operation changes the settings on a bucket.
    • b2_list_buckets This operation lists all of the buckets in your account.

    When you create a new bucket, you can specify the Lifecycle Rules. Later, you can update the rules on a bucket.

    Each API call has an optional parameter called lifecycleRules that requires three variables in the following JSON format:

    {
        “daysFromHidingToDeleting”: 30,
        “daysFromUploadingToHiding”: null,
        “fileNamePrefix”: “backup/”
    }

    In addition, the b2_delete_bucket operation returns the list of lifecycleRules for the bucket that you want to delete.


    Was this article helpful?