Cloudflare R2 Storage icon

Cloudflare R2 Storage

Interact with Cloudflare R2 object storage. Upload, download, manage files and buckets. Supports batch operations, multipart uploads, and can be used as a tool by AI Agents.

Object → List

AI-generated

Summary

List objects in an R2 bucket with optional prefix, pagination, and delimiter.

Inputs

  • bucketName (required) — The name of the R2 bucket to list objects from.
  • listOptions — Options for listing objects: prefix to filter, maxKeys for result limit, startAfter for pagination, delimiter to group keys.

Output shape

A list of objects with their keys, plus pagination metadata (truncated, continuation_token, results_count).

The returned objects array may be truncated; continuation_token can be used for further pages. All fields except objects are optional.

Examples

Example 1: List the first 50 images under the 'images/2024/' prefix.

bucketName: my-bucket; listOptions: {prefix: 'images/2024/', maxKeys: 50}

Example 2: Paginate through a large bucket using a startAfter key.

bucketName: logs; listOptions: {startAfter: 'access.log.2024-09-01', delimiter: '/'}

Example 3: Search for all PDF files larger than a certain size (using search operation but exemplifies list).

bucketName: documents; listOptions: {prefix: 'pdfs/', maxKeys: 1000}

Discussion