Cloudflare R2 Lifecycle API

The Lifecycle API from Cloudflare R2 — 1 operation(s) for lifecycle.

Operations 2

GET /{bucket}?lifecycle Get Bucket Lifecycle Configuration #
PUT /{bucket}?lifecycle Put Bucket Lifecycle Configuration #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/cloudflare-r2-lifecycle-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

cloudflare-r2-lifecycle-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cloudflare R2 S3-Compatible Lifecycle API
  description: 'An S3-compatible REST API for storing and retrieving objects in Cloudflare R2 buckets. Supports core S3 operations including bucket management, object CRUD, multipart uploads, CORS configuration, lifecycle policies, and server-side encryption. Compatible with AWS S3 SDKs across Python, JavaScript, Go, Java, PHP, Ruby, and Rust. Base URL format: https://<ACCOUNT_ID>.r2.cloudflarestorage.com

    '
  version: 1.0.0
  termsOfService: https://www.cloudflare.com/website-terms/
  contact:
    name: Cloudflare R2 Documentation
    url: https://developers.cloudflare.com/r2/api/s3/api/
servers:
- url: https://{account_id}.r2.cloudflarestorage.com
  description: Cloudflare R2 S3-compatible endpoint
  variables:
    account_id:
      description: Your Cloudflare account ID
      default: YOUR_ACCOUNT_ID
security:
- hmacAuth: []
tags:
- name: Lifecycle
paths:
  /{bucket}?lifecycle:
    get:
      operationId: get-bucket-lifecycle
      summary: Get Bucket Lifecycle Configuration
      description: Returns the lifecycle configuration for the bucket.
      tags:
      - Lifecycle
      parameters:
      - name: bucket
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Lifecycle configuration
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/LifecycleConfiguration'
        4XX:
          description: Error
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: put-bucket-lifecycle
      summary: Put Bucket Lifecycle Configuration
      description: Sets the lifecycle configuration for the bucket.
      tags:
      - Lifecycle
      parameters:
      - name: bucket
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/LifecycleConfiguration'
      responses:
        '200':
          description: Lifecycle configuration set
        4XX:
          description: Error
          content:
            application/xml:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        Code:
          type: string
          description: Error code
        Message:
          type: string
          description: Human-readable error message
        Resource:
          type: string
          description: The resource that caused the error
        RequestId:
          type: string
          description: The request ID for troubleshooting
      xml:
        name: Error
    LifecycleConfiguration:
      type: object
      properties:
        Rule:
          type: array
          items:
            type: object
            properties:
              ID:
                type: string
              Status:
                type: string
                enum:
                - Enabled
                - Disabled
              Filter:
                type: object
                properties:
                  Prefix:
                    type: string
              Expiration:
                type: object
                properties:
                  Days:
                    type: integer
                  Date:
                    type: string
                    format: date-time
              NoncurrentVersionExpiration:
                type: object
                properties:
                  NoncurrentDays:
                    type: integer
              AbortIncompleteMultipartUpload:
                type: object
                properties:
                  DaysAfterInitiation:
                    type: integer
      xml:
        name: LifecycleConfiguration
  securitySchemes:
    hmacAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'AWS Signature Version 4 authentication. Use your R2 API token (Access Key ID and Secret Access Key) generated from the R2 dashboard. Compatible with all AWS S3 SDKs.

        '
externalDocs:
  description: Cloudflare R2 S3 API Compatibility
  url: https://developers.cloudflare.com/r2/api/s3/api/