{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"Replaces the Cross-Origin Resource Sharing (CORS) rules for an R2 bucket. Rules specify which origins, methods, and headers are allowed for browser requests to objects in the bucket.","properties":{"path":{"type":"object","properties":{"bucket_name":{"$ref":"#/definitions/r2_bucket_name"},"account_id":{"$ref":"#/definitions/r2_account_identifier"}},"required":["bucket_name","account_id"],"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."}},"required":[],"additionalProperties":false},"body":{"type":"object","properties":{"rules":{"type":"array","items":{"$ref":"#/definitions/r2_cors-rule"}}}}},"required":["path","body"],"additionalProperties":false,"definitions":{"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_account_identifier":{"description":"Cloudflare account ID that owns the R2 resource.","type":"string","maxLength":32,"examples":["023e105f4ecef8ad9ca31a8372d0c353"]},"r2_cors-rule":{"type":"object","properties":{"allowed":{"description":"Object specifying allowed origins, methods and headers for this CORS rule.","type":"object","additionalProperties":false,"properties":{"headers":{"description":"Specifies the value for the Access-Control-Allow-Headers header R2 sets when requesting objects in this bucket from a browser. Cross-origin requests that include custom headers (e.g. x-user-id) should specify these headers as AllowedHeaders.","type":"array","items":{"type":"string","examples":["x-requested-by"]}},"methods":{"description":"Specifies the value for the Access-Control-Allow-Methods header R2 sets when requesting objects in a bucket from a browser.","type":"array","items":{"enum":["GET","PUT","POST","DELETE","HEAD"],"type":"string"}},"origins":{"description":"Specifies the value for the Access-Control-Allow-Origin header R2 sets when requesting objects in a bucket from a browser.","type":"array","items":{"type":"string","examples":["http://localhost:3000"]}}},"required":["methods","origins"]},"exposeHeaders":{"description":"Specifies the headers that can be exposed back, and accessed by, the JavaScript making the cross-origin request. If you need to access headers beyond the safelisted response headers, such as Content-Encoding or cf-cache-status, you must specify it here.","type":"array","items":{"type":"string","examples":["Content-Encoding"]}},"id":{"description":"Identifier for this rule.","type":"string","examples":["Allow Local Development"]},"maxAgeSeconds":{"description":"Specifies the amount of time (in seconds) browsers are allowed to cache CORS preflight responses. Browsers may limit this to 2 hours or less, even if the maximum value (86400) is specified.","type":"number","examples":[3600]}},"additionalProperties":false,"required":["allowed"]}}},"name":"Set Bucket CORS Policy","id":"cloudflare.r2-put-bucket-cors-policy","example":{"path":{"bucket_name":"example-bucket","account_id":"023e105f4ecef8ad9ca31a8372d0c353"},"body":{}},"maxRequests":1,"summary":false}}