Index R2 Bucket

Index all files from a Cloudflare R2 bucket into a collection. R2 is S3-compatible — provide your R2 API token’s Access Key ID and Secret Access Key. Returns a job_id for tracking progress via GET /v2/jobs/{job_id}.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

X-Organization-IDstring
API Key authentication via header

Path parameters

collection_namestringRequired

Request

This endpoint expects an object.
bucket_namestringRequired
Name of the R2 bucket
account_idstringRequired

Cloudflare account ID (found in your R2 dashboard URL)

access_key_idstringRequired
R2 S3 API token Access Key ID
secret_access_keystringRequired
R2 S3 API token Secret Access Key
processing_typeenumRequired

Document processing type. ‘advanced’ uses agentic OCR with AI-enhanced extraction for complex layouts, tables, figures, charts, and documents containing images. ‘basic’ provides reliable OCR optimized for general document indexing and high-volume processing.

Allowed values:
jurisdictionenumOptionalDefaults to default

R2 jurisdiction. ‘default’ for global, ‘eu’ for EU-only storage, ‘fedramp’ for FedRAMP-compliant storage.

Allowed values:
max_filesintegerOptional

Maximum number of files to index (optional)

skip_existingbooleanOptionalDefaults to true

Skip files that are already indexed in the collection. When true, only new files will be indexed. Set to false to re-index all files.

custom_metadatamap from strings to anyOptional

Custom metadata to attach to all indexed chunks. Keys must be strings. Values: str, int, float, bool, or array of strings.

Response

Indexing Job Started
job_idstring
statusenum
Allowed values: