{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"Creates a background job for an R2 bucket. The `jobType` field selects the job:\n\n- **`prefixDelete`**: deletes every object whose key begins with `prefix`. A non-empty\n  prefix must end in `/`. An empty prefix (`\"\"`) empties the entire bucket.\n- **`storageClassMigration`**: migrates every object in the bucket between storage\n  classes. `sourceStorageClass` and `destinationStorageClass` must be provided together\n  and must differ; omitting both migrates from `InfrequentAccess` to `Standard`.\n\nPoll the returned `id` with the Get Bucket Job endpoint. Small prefix-delete jobs can\nfinish synchronously and return `COMPLETED`. Objects uploaded after a background job\nstarts are not affected by that job.\n\nFor prefix-delete jobs: abort active multipart uploads before submitting the request,\nsince a synchronously completed job does not abort them, and avoid writing objects or\nstarting multipart uploads while a bucket-emptying job is in progress. Each request\ncreates a distinct job, and the number of active prefix-delete jobs is limited per\nbucket; wait for an existing job to finish before retrying a request rejected with\nHTTP 429. A bucket cannot be emptied while event notifications are configured (HTTP 409\n/ error code 10083). To protect a bucket with R2 Data Catalog enabled, send the\n`cf-r2-data-catalog-check` header; a conflict is returned with HTTP 409 / error code\n10081.\n\nPrefix-delete jobs require permission to delete objects; storage-class migration jobs\nrequire permission to write to the bucket.\n","properties":{"path":{"type":"object","properties":{"account_id":{"$ref":"#/definitions/r2_account_identifier"},"bucket_name":{"$ref":"#/definitions/r2_bucket_name"}},"required":["account_id","bucket_name"],"additionalProperties":false},"headers":{"type":"object","properties":{"cf-r2-jurisdiction":{"type":"string","default":"default","enum":["default","eu","us","fedramp","fedramp-high"],"description":"Jurisdiction where objects in this bucket are guaranteed to be stored."},"cf-r2-data-catalog-check":{"type":"string","description":"For prefix-delete jobs, set this header to reject the request when R2 Data Catalog is enabled for the bucket."}},"required":[],"additionalProperties":false},"body":{"oneOf":[{"$ref":"#/definitions/r2_create_prefix_delete_job_request"},{"$ref":"#/definitions/r2_create_storage_class_migration_job_request"}],"examples":[{"jobType":"prefixDelete","prefix":"logs/2026/"}]}},"required":["path","body"],"additionalProperties":false,"definitions":{"r2_account_identifier":{"description":"Cloudflare account ID that owns the R2 resource.","type":"string","maxLength":32,"examples":["023e105f4ecef8ad9ca31a8372d0c353"]},"r2_bucket_name":{"description":"Name of the bucket.","type":"string","maxLength":64,"minLength":3,"pattern":"^[a-z0-9][a-z0-9-]*[a-z0-9]","examples":["example-bucket"]},"r2_create_prefix_delete_job_request":{"description":"Request body that creates a prefix-delete job.","type":"object","properties":{"jobType":{"type":"string","enum":["prefixDelete"]},"prefix":{"description":"Prefix matched against object keys. A non-empty value must end in `/`.\nAn empty string empties the entire bucket.\n","type":"string","examples":["path/to/"]}},"additionalProperties":false,"required":["jobType","prefix"],"title":"Prefix Delete Job"},"r2_create_storage_class_migration_job_request":{"description":"Request body that creates a storage-class migration job.","type":"object","properties":{"destinationStorageClass":{"type":"string","enum":["Standard","InfrequentAccess"]},"jobType":{"type":"string","enum":["storageClassMigration"]},"sourceStorageClass":{"type":"string","enum":["Standard","InfrequentAccess"]}},"additionalProperties":false,"required":["jobType"],"title":"Storage Class Migration Job"}}},"name":"Create Bucket Job","id":"cloudflare.r2-create-bucket-job","example":{"path":{"account_id":"023e105f4ecef8ad9ca31a8372d0c353","bucket_name":"example-bucket"},"body":{"jobType":"prefixDelete","prefix":"logs/2026/"}},"maxRequests":1,"summary":false}}