Create Bucket

Creates a new R2 bucket.

/accounts/{account_identifier}/r2/buckets

post

R2 Bucket

r2-create-bucket

Debug "planAvailability"

null

Debug "tokenPermissions"

{
  "enum": [
    "com.cloudflare.edge.r2.bucket.create"
  ]
}

Debug "parameters"

[
  {
    "in": "path",
    "name": "account_identifier",
    "required": true,
    "schema": {
      "description": "Account ID",
      "example": "023e105f4ecef8ad9ca31a8372d0c353",
      "maxLength": 32,
      "type": "string"
    }
  }
]

Debug "requestBody"

{
  "content": {
    "application/json": {
      "schema": {
        "example": "{\"name\": \"example-bucket\"}",
        "properties": {
          "locationHint": {
            "description": "Location of the bucket",
            "enum": [
              "apac",
              "eeur",
              "enam",
              "weur",
              "wnam"
            ],
            "type": "string"
          },
          "name": {
            "description": "Name of the bucket",
            "example": "example-bucket",
            "maxLength": 64,
            "minLength": 3,
            "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "type": "object"
      }
    }
  },
  "required": true
}

Debug "responses"

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "properties": {
                "errors": {
                  "items": {
                    "properties": {
                      "code": {
                        "minimum": 1000,
                        "type": "integer"
                      },
                      "message": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "code",
                      "message"
                    ],
                    "type": "object",
                    "uniqueItems": true
                  },
                  "type": "array"
                },
                "messages": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "result": {
                  "type": "object"
                },
                "success": {
                  "description": "Whether the API call was successful",
                  "enum": [
                    true
                  ],
                  "type": "boolean"
                }
              },
              "required": [
                "success",
                "errors",
                "messages",
                "result"
              ],
              "type": "object"
            },
            {
              "properties": {
                "result": {
                  "description": "A single R2 bucket",
                  "properties": {
                    "creation_date": {
                      "description": "Creation timestamp",
                      "type": "string"
                    },
                    "location": {
                      "description": "Location of the bucket",
                      "enum": [
                        "apac",
                        "eeur",
                        "enam",
                        "weur",
                        "wnam"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "description": "Name of the bucket",
                      "example": "example-bucket",
                      "maxLength": 64,
                      "minLength": 3,
                      "pattern": "^[a-z0-9][a-z0-9-]*[a-z0-9]",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              },
              "type": "object"
            }
          ]
        }
      }
    },
    "description": "Create Bucket response"
  },
  "4XX": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "errors": {
              "items": {
                "properties": {
                  "code": {
                    "minimum": 1000,
                    "type": "integer"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": [
                  "code",
                  "message"
                ],
                "type": "object",
                "uniqueItems": true
              },
              "type": "array"
            },
            "messages": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "result": {
              "enum": [
                null
              ],
              "nullable": true,
              "type": "object"
            },
            "success": {
              "description": "Whether the API call was successful",
              "enum": [
                false
              ],
              "example": false,
              "type": "boolean"
            }
          },
          "required": [
            "success",
            "errors",
            "messages",
            "result"
          ],
          "type": "object"
        }
      }
    },
    "description": "Create Bucket response failure"
  }
}

Debug "security"

[
  {
    "api_token": []
  }
]