Cloudflare R2 Objects API
The Objects API from Cloudflare R2 — 3 operation(s) for objects.
The Objects API from Cloudflare R2 — 3 operation(s) for objects.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
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.curl "https://apis.io/api/v1/apis/cloudflare-r2-objects-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
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: 3.2.0
info:
title: Cloudflare R2 S3-Compatible Objects 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: Objects
paths:
/{bucket}:
get:
operationId: list-objects-v2
summary: List Objects V2
description: Returns some or all (up to 1,000) of the objects in a bucket. ListObjectsV2 is preferred over ListObjects.
tags:
- Objects
parameters:
- name: bucket
in: path
required: true
schema:
type: string
description: Name of the bucket
- name: list-type
in: query
required: false
schema:
type: integer
enum:
- 2
description: Set to 2 to use ListObjectsV2
- name: prefix
in: query
required: false
schema:
type: string
description: Limits the response to keys that begin with the specified prefix
- name: delimiter
in: query
required: false
schema:
type: string
description: A delimiter is a character you use to group keys
- name: max-keys
in: query
required: false
schema:
type: integer
default: 1000
maximum: 1000
description: Maximum number of keys to return
- name: continuation-token
in: query
required: false
schema:
type: string
description: Token from previous response to get next page
- name: start-after
in: query
required: false
schema:
type: string
description: Start listing after this key
- name: marker
in: query
required: false
schema:
type: string
description: (V1) Where to begin listing. The response starts listing after this marker
- name: uploads
in: query
required: false
schema:
type: boolean
description: List in-progress multipart uploads when present
- name: location
in: query
required: false
schema:
type: boolean
description: Return bucket location when present
- name: cors
in: query
required: false
schema:
type: boolean
description: Return CORS configuration when present
- name: lifecycle
in: query
required: false
schema:
type: boolean
description: Return lifecycle configuration when present
- name: encryption
in: query
required: false
schema:
type: boolean
description: Return encryption configuration when present
responses:
'200':
description: Success
content:
application/xml:
schema:
$ref: '#/components/schemas/ListBucketResult'
4XX:
description: Error
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
/{bucket}/{key}:
head:
operationId: head-object
summary: Head Object
description: Retrieves metadata from an object without returning the object itself.
tags:
- Objects
parameters:
- name: bucket
in: path
required: true
schema:
type: string
- name: key
in: path
required: true
schema:
type: string
description: Object key
- name: Range
in: header
required: false
schema:
type: string
description: HTTP Range header for partial content
- name: If-Match
in: header
required: false
schema:
type: string
- name: If-None-Match
in: header
required: false
schema:
type: string
- name: If-Modified-Since
in: header
required: false
schema:
type: string
format: date-time
- name: If-Unmodified-Since
in: header
required: false
schema:
type: string
format: date-time
responses:
'200':
description: Object metadata
headers:
Content-Type:
schema:
type: string
Content-Length:
schema:
type: integer
ETag:
schema:
type: string
Last-Modified:
schema:
type: string
4XX:
description: Error
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
get:
operationId: get-object
summary: Get Object
description: Retrieves an object from a bucket.
tags:
- Objects
parameters:
- name: bucket
in: path
required: true
schema:
type: string
- name: key
in: path
required: true
schema:
type: string
description: Object key
- name: Range
in: header
required: false
schema:
type: string
description: HTTP Range header for partial content retrieval
- name: If-Match
in: header
required: false
schema:
type: string
- name: If-None-Match
in: header
required: false
schema:
type: string
- name: If-Modified-Since
in: header
required: false
schema:
type: string
format: date-time
- name: If-Unmodified-Since
in: header
required: false
schema:
type: string
format: date-time
- name: response-content-type
in: query
required: false
schema:
type: string
- name: response-content-disposition
in: query
required: false
schema:
type: string
responses:
'200':
description: Object data
content:
application/octet-stream:
schema:
type: string
format: binary
'206':
description: Partial content
content:
application/octet-stream:
schema:
type: string
format: binary
4XX:
description: Error
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
put:
operationId: put-object
summary: Put Object
description: Adds an object to a bucket.
tags:
- Objects
parameters:
- name: bucket
in: path
required: true
schema:
type: string
- name: key
in: path
required: true
schema:
type: string
- name: Content-Type
in: header
required: false
schema:
type: string
- name: Content-MD5
in: header
required: false
schema:
type: string
- name: Content-Length
in: header
required: false
schema:
type: integer
- name: Cache-Control
in: header
required: false
schema:
type: string
- name: Content-Disposition
in: header
required: false
schema:
type: string
- name: Content-Encoding
in: header
required: false
schema:
type: string
- name: x-amz-meta-*
in: header
required: false
schema:
type: string
description: User-defined metadata headers
- name: x-amz-copy-source
in: header
required: false
schema:
type: string
description: Source for server-side copy
requestBody:
required: false
content:
application/octet-stream:
schema:
type: string
format: binary
responses:
'200':
description: Object stored
headers:
ETag:
schema:
type: string
4XX:
description: Error
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
delete:
operationId: delete-object
summary: Delete Object
description: Removes an object from a bucket.
tags:
- Objects
parameters:
- name: bucket
in: path
required: true
schema:
type: string
- name: key
in: path
required: true
schema:
type: string
responses:
'204':
description: Object deleted
4XX:
description: Error
content:
application/xml:
schema:
$ref: '#/components/schemas/Error'
/{bucket}?delete:
post:
operationId: delete-objects
summary: Delete Multiple Objects
description: Removes multiple objects from a bucket in a single request. Up to 1000 objects can be deleted per request.
tags:
- Objects
parameters:
- name: bucket
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/xml:
schema:
$ref: '#/components/schemas/DeleteObjects'
responses:
'200':
description: Delete results
content:
application/xml:
schema:
$ref: '#/components/schemas/DeleteResult'
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
ListBucketResult:
type: object
properties:
Name:
type: string
description: Bucket name
Prefix:
type: string
description: Prefix filter used
Delimiter:
type: string
description: Delimiter used for grouping keys
MaxKeys:
type: integer
description: Maximum number of keys returned
IsTruncated:
type: boolean
description: Whether results are truncated
NextContinuationToken:
type: string
description: Token for next page (V2)
NextMarker:
type: string
description: Next marker for pagination (V1)
KeyCount:
type: integer
description: Number of keys returned
Contents:
type: array
items:
type: object
properties:
Key:
type: string
LastModified:
type: string
format: date-time
ETag:
type: string
Size:
type: integer
format: int64
StorageClass:
type: string
CommonPrefixes:
type: array
items:
type: object
properties:
Prefix:
type: string
xml:
name: ListBucketResult
DeleteResult:
type: object
properties:
Deleted:
type: array
items:
type: object
properties:
Key:
type: string
Error:
type: array
items:
type: object
properties:
Key:
type: string
Code:
type: string
Message:
type: string
xml:
name: DeleteResult
DeleteObjects:
type: object
properties:
Object:
type: array
items:
type: object
required:
- Key
properties:
Key:
type: string
VersionId:
type: string
Quiet:
type: boolean
xml:
name: Delete
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/