Cloudflare R2 Maintenance Configuration API
The Maintenance Configuration API from Cloudflare R2 — 1 operation(s) for maintenance configuration.
The Maintenance Configuration API from Cloudflare R2 — 1 operation(s) for maintenance configuration.
openapi: 3.0.3
info:
title: Cloudflare R2 Cloudflare Buckets Maintenance Configuration API
description: Cloudflare API endpoints for managing R2 object storage buckets, objects, CORS, lifecycle policies, custom domains, event notifications, data catalog, and temporary credentials.
version: 4.0.0
termsOfService: https://www.cloudflare.com/website-terms/
contact:
name: Cloudflare Developer Docs
url: https://developers.cloudflare.com/r2/
servers:
- url: https://api.cloudflare.com/client/v4
description: Cloudflare API v4
tags:
- name: Maintenance Configuration
paths:
/accounts/{account_id}/r2-catalog/{bucket_name}/maintenance-configs:
get:
description: 'Retrieve the maintenance configuration for a specific catalog,
including compaction settings and credential status.
'
operationId: get-maintenance-config
parameters:
- description: Identifies the account.
in: path
name: account_id
required: true
schema:
$ref: '#/components/schemas/r2-data-catalog_account-id'
- description: Specifies the R2 bucket name.
in: path
name: bucket_name
required: true
schema:
$ref: '#/components/schemas/r2-data-catalog_bucket-name'
responses:
'200':
content:
application/json:
example:
errors: []
messages: []
result:
credential_status: present
maintenance_config:
compaction:
state: enabled
target_size_mb: '128'
snapshot_expiration:
max_snapshot_age: 7d
min_snapshots_to_keep: 100
state: enabled
success: true
schema:
allOf:
- $ref: '#/components/schemas/r2-data-catalog_api-response-single'
- properties:
result:
$ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-config-response'
type: object
description: Maintenance configuration retrieved successfully.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Bad request.
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Authentication failed.
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Forbidden.
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Catalog not found.
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Internal server error.
security:
- api_token: []
- api_email: []
api_key: []
summary: Get catalog maintenance configuration
tags:
- Maintenance Configuration
x-api-token-group:
- Workers R2 Data Catalog Write
- Workers R2 Data Catalog Read
post:
description: 'Update the maintenance configuration for a catalog. This allows you to
enable or disable compaction and adjust target file sizes for optimization.
'
operationId: update-maintenance-config
parameters:
- description: Identifies the account.
in: path
name: account_id
required: true
schema:
$ref: '#/components/schemas/r2-data-catalog_account-id'
- description: Specifies the R2 bucket name.
in: path
name: bucket_name
required: true
schema:
$ref: '#/components/schemas/r2-data-catalog_bucket-name'
requestBody:
content:
application/json:
example:
compaction:
state: enabled
target_size_mb: '256'
snapshot_expiration:
max_snapshot_age: 14d
min_snapshots_to_keep: 5
state: enabled
schema:
$ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-update-request'
required: true
responses:
'200':
content:
application/json:
example:
errors: []
messages: []
result:
compaction:
state: enabled
target_size_mb: '256'
snapshot_expiration:
max_snapshot_age: 14d
min_snapshots_to_keep: 5
state: enabled
success: true
schema:
allOf:
- $ref: '#/components/schemas/r2-data-catalog_api-response-single'
- properties:
result:
$ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-config'
type: object
description: Maintenance configuration updated successfully.
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Bad request.
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Authentication failed.
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Forbidden.
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Catalog not found.
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
description: Internal server error.
security:
- api_token: []
- api_email: []
api_key: []
summary: Update catalog maintenance configuration
tags:
- Maintenance Configuration
x-api-token-group:
- Workers R2 Data Catalog Write
components:
schemas:
r2-data-catalog_maintenance-update-params:
description: Contains maintenance update parameters.
properties:
compaction:
$ref: '#/components/schemas/r2-data-catalog_compaction-update-params'
snapshot_expiration:
$ref: '#/components/schemas/r2-data-catalog_snapshot-expiration-update-params'
type: object
r2-data-catalog_catalog-compaction-config:
description: Configures compaction for catalog maintenance.
properties:
state:
$ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-state'
target_size_mb:
$ref: '#/components/schemas/r2-data-catalog_catalog-target-file-size'
required:
- state
- target_size_mb
type: object
r2-data-catalog_catalog-maintenance-config-response:
description: Contains maintenance configuration and credential status.
properties:
credential_status:
$ref: '#/components/schemas/r2-data-catalog_credential-status'
maintenance_config:
$ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-config'
required:
- maintenance_config
- credential_status
type: object
r2-data-catalog_credential-status:
description: Shows the credential configuration status.
enum:
- present
- absent
example: present
type: string
r2-data-catalog_catalog-target-file-size:
description: Sets the target file size for compaction in megabytes. Defaults to "128".
enum:
- '64'
- '128'
- '256'
- '512'
example: '128'
type: string
r2-data-catalog_api-response-errors:
description: Contains errors if the API call was unsuccessful.
items:
properties:
code:
description: Specifies the error code.
type: integer
message:
description: Describes the error.
type: string
required:
- code
- message
type: object
type: array
r2-data-catalog_api-response-success:
description: Indicates whether the API call was successful.
example: true
type: boolean
r2-data-catalog_catalog-maintenance-state:
description: Specifies the state of maintenance operations.
enum:
- enabled
- disabled
example: enabled
type: string
r2-data-catalog_api-response-messages:
description: Contains informational messages.
items:
properties:
code:
description: Specifies the message code.
type: integer
message:
description: Contains the message text.
type: string
required:
- code
- message
type: object
type: array
r2-data-catalog_snapshot-expiration-update-params:
description: Updates snapshot expiration configuration (all fields optional).
properties:
max_snapshot_age:
description: Updates the maximum age for snapshots optionally.
pattern: ^\d+(d|h|m|s)$
type: string
min_snapshots_to_keep:
description: Updates the minimum number of snapshots to retain optionally.
format: int64
minimum: 1
type: integer
state:
allOf:
- $ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-state'
description: Updates the state optionally.
type: object
r2-data-catalog_api-response-common-failure:
properties:
errors:
items:
properties:
code:
type: integer
message:
type: string
type: object
minItems: 1
type: array
messages:
items:
type: object
type: array
success:
enum:
- false
type: boolean
type: object
r2-data-catalog_bucket-name:
description: Specifies the R2 bucket name.
example: my-data-bucket
maxLength: 63
minLength: 3
pattern: ^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$
type: string
r2-data-catalog_account-id:
description: Use this to identify the account.
example: 0123456789abcdef0123456789abcdef
pattern: ^[a-fA-F0-9]{32}$
type: string
r2-data-catalog_api-response-single:
properties:
errors:
$ref: '#/components/schemas/r2-data-catalog_api-response-errors'
messages:
$ref: '#/components/schemas/r2-data-catalog_api-response-messages'
success:
$ref: '#/components/schemas/r2-data-catalog_api-response-success'
required:
- success
- errors
- messages
type: object
r2-data-catalog_catalog-maintenance-config:
description: Configures maintenance for the catalog.
properties:
compaction:
$ref: '#/components/schemas/r2-data-catalog_catalog-compaction-config'
snapshot_expiration:
$ref: '#/components/schemas/r2-data-catalog_snapshot-expiration-config'
type: object
r2-data-catalog_compaction-update-params:
description: Updates compaction configuration (all fields optional).
properties:
state:
allOf:
- $ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-state'
description: Updates the state optionally.
target_size_mb:
allOf:
- $ref: '#/components/schemas/r2-data-catalog_catalog-target-file-size'
description: Updates the target file size optionally.
type: object
r2-data-catalog_catalog-maintenance-update-request:
allOf:
- $ref: '#/components/schemas/r2-data-catalog_maintenance-update-params'
description: Contains request to update catalog maintenance configuration.
r2-data-catalog_snapshot-expiration-config:
description: Configures snapshot expiration settings.
properties:
max_snapshot_age:
description: 'Specifies the maximum age for snapshots. The system deletes snapshots older than this age.
Format: <number><unit> where unit is d (days), h (hours), m (minutes), or s (seconds).
Examples: "7d" (7 days), "48h" (48 hours), "2880m" (2,880 minutes).
Defaults to "7d".
'
example: 7d
pattern: ^\d+(d|h|m|s)$
type: string
min_snapshots_to_keep:
description: Specifies the minimum number of snapshots to retain. Defaults to 100.
example: 100
format: int64
minimum: 1
type: integer
state:
$ref: '#/components/schemas/r2-data-catalog_catalog-maintenance-state'
required:
- state
- min_snapshots_to_keep
- max_snapshot_age
type: object
securitySchemes:
api_email:
in: header
name: X-Auth-Email
type: apiKey
api_key:
in: header
name: X-Auth-Key
type: apiKey
api_token:
scheme: bearer
type: http
user_service_key:
in: header
name: X-Auth-User-Service-Key
type: apiKey